Checking recent candles
-
Hello, I hope you're doing well.
I want to create a time range or candle period, for example, the last 10 candles, and check whenever a candle closes larger than all the previous 10 candles. If it’s bullish, it should open a Buy position, and if it’s bearish, it should open a Sell position.
Additionally, I need an input for the candle size, and the candle’s shadow (wick) should not exceed one-quarter of the total candle size.
My main issue is checking the previous candles. -
@ennoch You can do it as explained here:
-
You misunderstood me. I want to measure the size of recent candles. For example, if the size of candle ID six is the largest candle in the last 10 candles at 100 pips, then whenever a candle closes larger than 100 pips, it should open a position for me.
What you explained measures the market price, not the candle size.
If you see this picture, you will understand.

-
In that case uoi need a custom loop searching for that information. No single fxDreema block can do that. Are you familiar with loops and variables?
-
I have limited familiarity, and I’ve tried to write this code a few times but couldn’t succeed. I thought of asking my question in the forum, hoping someone might help me.
-
This will check the last number of candles chosen in the inputs, and print in variable/comment the largest, it works on total candle size, if you want body High - Low would need changed to Open - Close. Should do what you want, for example, variable == 1 would give you the signal for 1 being the biggest: https://fxdreema.com/shared/t0H77rtkd