Indicator that displays the total volume up to that “time”


Category:
0
0

Hello Peter.  I was hoping if making an indicator where lets say the market has closed for the day so I go on a 5 min chart, if I was to put my “crosshair” on 1:40PM, it would display the total volume for the day but only up to 1:40pm?

I hopefully explained it properly.  Thanks.

Marked as spam
Posted by (Questions: 2, Answers: 3)
Asked on May 7, 2017 11:08 pm
2022 views
1
Private answer

The Thinkorswim platform does not provide access to the user interface. So there is no way to write code that can tell where you have placed the crosshairs. One option is to create a custom study, plotted in a lower subgraph. The code in the study would reset the volume at market open, then plot the sum of volume for the remainder of the trading day.
declare lower;
def newDay = GetDay() <> GetDay()[1];
rec sumOfVolume = CompoundValue(1, if newDay then volume else sumOfVolume[1] + volume, 0);
plot data = sumOfVolume;

Screenshot below show the study on a 5 min chart of AAPL and the crosshairs are at 1:40 pm ET.

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on May 8, 2017 8:57 am
0

Hi Pete, I have found some discrepancy from the volume output from your code as well as the system daily volume. I really cannot figure it out why there is such discrepancy, I am hoping you can give a hand please. Thanks (Please do let me know if you need a screenshot, as comment section seems cannot attach screenshot)

declare lower;

def newDay = GetDay() GetDay()[1];
rec sumOfVolume = CompoundValue(1, if newDay then volume else sumOfVolume[1] + volume, 0);
plot data = sumOfVolume;
AddLabel(1, “Today Vol (System): ” + volume(period = “DAY”), Color.WHITE);

( at September 1, 2018 12:55 pm)
0

The code is 100% correct. The problem is Thinkorswim is wrong. Believe that? Yeah, I believe it. To prove it, I just recorded the volume of each 15 bar in a spreadsheet. The total matches what is reported by the code I provided in my answer.

So the question now is, where is Thinkorswim getting their daily volume from? And why does it not match the volume they are reporting on the intraday charts? I suggest you report this issue to TDA support. Keep us posted on their response.

( at September 1, 2018 2:51 pm)
0

Thanks Pete! I will report this to TDA and see what they can do about it. Thanks again Pete! You are awesome!!

( at September 1, 2018 4:12 pm)
0
Private answer

Thank you.  The code works nicely ?

 

Marked as spam
Posted by (Questions: 2, Answers: 3)
Answered on May 9, 2017 11:05 am