Dear Seetu friends.
I have been testing the ValueWhen function and could successfully store the high and low of a candle after a certain trigger.
The issue is that, after prices go over or below the stored high and low (which is a buy or sell), I need the variable (which had the high and low stored) to become with 0 value again. If I do not do that, the buy and sell can be triggered again after several candles.
Simplified example of what I am trying to do:
===
MaxCandle = valuewhen(close > CalcEMA(close,9), high);
MinCandle = valuewhen(close > CalcEMA(close,9), low);
buy = close > MaxCandle;
Sell = close < MinCandle;
if (buy==1 or sell ==1) { MaxCandle = 0; MinCandle = 0; }
===
In the explore tab, I can see that MaxCandle and MinCandle still keeps the high and low after buy or sell is triggered.
Appreciate your support.
Thank you.
Leandro