🤔 Stop Loss - Middle of Last Candle?
-
How do i set a stop loss to be placed at the middle point of the last candle's total size? I dont think the "median price" is the right option in candle settings.
-
@davidmcc You could:
- Substract the distance between the candle's high minus the low
- Divide this distance by 2.
- Sum that quantity to the low of the candle you are interested in.
This should point out the exact middle. Then in "Stop-Loss" you use "Custom-pip" and insert the variable you are using.
Keep in mind that the stop loss placement may fail if your entry price is invalid.
-
@Abade69 Sounds like i need some cutom variables.
Any idea of blocks / values I can use to get started?
-
@davidmcc Wait, I'll prepare an example... Are you using MT4 or MT5?
-
@Abade69 MT5. Thank you
-
@davidmcc Here it is: https://fxdreema.com/shared/mnDuTcAvd
It will paint a pink line where the mid point of the last candle is. Included execution examples for buys and sells and how to trail it using the mid point, hope it is a good starting point for your EA.
-
@davidmcc
Use formula block to get 0.5*(Candle High + Candle Low). That's what you need -
@Abade69 dude thank you so much! I'll let you know how it goes.
-
@davidmcc This option brings the same results and it's much cleaner:

MT5 distorts the levels and candles, that's why it may seem a bit off in some places. Hope it works!
-
@sktsec thank you sir!
-
@Abade69 It's funny because I tried that but I guess I didn't set it up properly before. It does work actually. Thanks for mentioning it again.
-
@davidmcc Always check the "Candle ID" box, that's where the EA is taking the information from.
Candle ID = 1 means you are reading the last candle information.
Candle ID = 2 means you are reading the information of the candle before 1
and so on..
Candle ID = 0 means you are reading information of the current candle, so the total size will always be zero if you try to read it too early (that's the default value if you leave it empty). -
Also check your buy/sell price is above/below the previous candle median price.
-
@sktsec very good point and definitely something to consider. Thank you!
-
@Abade69 I appreciate that info. Thank you sir