I want to start with first candle of the trading day and add the next and next candles data to a variable for plotting the total, how to creat a loop

Viewed 18

//@version=5

indicator("Oml",overlay=false)

abc=0.0

bcd=0.0

cde=0.0

red=0.0

green=0.0

t=time(timeframe.period,"0930-1530:1234567")

time_cond=not na(t)

if (time_cond and open>close)

abc:=close-open

while (abc>0)

red:=abc+red
 

if (time_cond and open<close)

bcd:=close-open

while (bcd>0)

green:=bcd+green

plot(red,color=color.red)

plot(green,color=color.green)

0 Answers
Related