Hi, i want to use a variable on an old candle, example: i have my condition met on “today candle”, i want to save that candle higher price to use in the future, by example if a new candle breakout that old candle price, i can do another condition or take a trade. The problem is the old candle, can be at a different number of candle in past. So i dont know how many candle it can be in past.
Thanks
Your description is a little difficult to understand but do you mean?
if (my conditions met on this candle) then
myprice = high
endif
//buy at myprice
if not onmarket and close < myprice then
buy 1 contract at myprice stop
endif
//do something else if price > myprice
if close > myprice then
if (whatever you want to do or check next) then
...
endif
Example: see on picture, my condition draw this arrow, so i want when a new candle in future will breakout this candle with that condition with a higher candle, then i can execute my other code.
Hope my explanation is better
thanks
The code you gived to me work good, thanks