Hello, I would like to create a condition when a gap of more than 0.7% (between the previous day’s closing and the opening of the day) appears on the market.
My goal is to make it a condition to program a strategy that will only take trades with Proorder on directional days with large gaps, and extreme openings with volume.
I was able to code a gap indicator but as soon as I try to put a % variation it doesn’t work.
Can someone help me?
C1 = variation (dopen(0) > dclose(1))* 0.5
C1 = variation (dopen(0) > dclose(1))* 0.7
VARIATION cannot be used because it makes the difference between the same price on different candles. Also you used a logical value instead of a price.
Try this:
x = dopen(0) - dclose(1)
y = x * 100 / dclose(1)
C1 = (y >= 0.7)
Roberto beat me to it and I’ve no doubt did it correctly! 🙂
Mods
this post can be deleted please
robertogozzi: let’s keep it
Thank you so much @robertogozzi and @GraHal !