Hi all,
I’m trying to test the volatility prior to opening a trade. I’m trying to identify if Volatility has spike over a certain number during the last two hours and if so the trade should not open. How do I go about effectively storing it to a variable and then re-use at the time the trades tests the market before it opens a trade?
Thanks
How do you measure volatility? If you have your own formula, you can look at its value with simple offset in the past.
I use the Chaikan Volatility indicator. So to measure the max, lets say from 7am to 9am one can use code like
VOL = Volatility[10,10]
IF TIME>=090000 and TIME <= 090000 THEN
VOLATEST = MAX(VOLATEST,VOL)
ENDIF
That will give me the MAX no before the trade might open at 090500. But I need the reading to be ZERO before 7am and then ZERO again after 9am.
Possible?
You want to reset your VOLATEST value to 0 after 090000 ? Anyway, just set VOLATEST=0 at the TIME you want.