Calculate total Volume from Open candle to High of day candle


Category:
0
0

So far this is what I Have so far, but it calculates total volume from the open .

 

#Volume from Open to Intraday High (exclude premarket)

def totaldayvolume = volume(period = “DAY”);

plot data = if IsNaN(close[-1]) then totaldayvolume else Double.NaN;

 

 

I need help molding this code so that It only shows “front side volume” and STOPS totaling volume once the HOD candle is reached. If a new HOD candle is formed, the count may continue.

 

For example. if a stock opens at 2$ at 9:30am and spikes to $5 dollars then drops back to 3 dollars, Calculate the volume from the open candle ($2) to the HOD candle ($5)

 

 

Thank you

Marked as spam
Posted by (Questions: 7, Answers: 3)
Asked on January 5, 2020 2:48 pm
318 views
0
Private answer

We cannot solve this using any of the code you provided.

This solution displays a chart label in the upper left corner of the chart and shows the total volume from the opening bar through the bar that is the current high of day.

def openingBar = SecondsTillTime(930) == 0;
rec trackVolume = if openingBar then volume else trackVolume[1] + volume;
rec trackHigh = if openingBar then high else if high > trackHigh[1] then high else trackHigh[1];
def potentialHOD = high[1] > trackHigh[2] and high < trackHigh;
rec frontSideVolume = if potentialHOD then trackVolume[1] else frontSideVolume[1];
AddLabel(yes, Concat("Front Side Volume: ", frontSideVolume), Color.WHITE);

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on January 6, 2020 1:11 pm