Hello
What is best practice to store the opening price at a specific time (ex. 090000 – 9am) in a variable
I tried the following code:
if time >= 090000 and time <= 090005 then
myopenprice = open
endif
return myopenprice
Thanks for your support.
I would say:
IF time = 090000 OR (time > 090000 AND time[1] < 090000) THEN
the first part (time = 090000) will be true whenever a bar closes at that time sharp, while the latter will be true whenever a bar does NOT close at 090000 sharp but it’s the first one to cross that time.
Thanks @robertogozzi
The following solution is working for me:
IF time = 090100 OR (time > 090100 AND time[1] < 090100) THEN
myopendax = open
endif
IF time = 153100 OR (time > 153100 AND time[1] < 153100) THEN
myopenus = open
endif
return myopendax coloured(255,255,0,255) style (dottedline,2), myopenus coloured(255,0,255,255) style (dottedline,2)