Stop loss and take profit helper by Mutabor
The utility is designed for two purposes:
- Automatic setting of stop loss and take profit levels.
- Automatic modification of stop loss and take profit levels when a certain profit is reached.
When the utility is started, the default values are configured as follows.
- on/off level moving - enable/disable moving levels with the price. (true)
- when begin move tp/sl levels - the number of points missing until the take profit level. (25 points)
- init SL - initial stop loss in points, set when an order is opened. (200 points)
- init TP - initial take profit in points, set when an order is opened. (200 points)
- TP after move - new take profit value. Set after the difference between the levels of the first and third parameters is reached. (100 points)
- SL after move - new stop loss value. Set after the difference between the levels of the first and third parameters is reached. (100 points)
Settings based on automatic levels:
- timeframe - any timeframe
- candles calculation - number of candles for calculating levels
The levels are calculated using the formulas:
Pivot = (high + close + low)/3 R1 = (2 * Pivot) - low S1 = (2 * Pivot) - high R2 = Pivot + (R1 -S1) R3 = high + (2* (Pivot - low)) S2 = Pivot - (R1 - S1) S3 = low - (2*(high - Pivot)) H = high L = low U = if the candle is bullish, then close. Otherwise - open D = if the candle is bullish, then open. Otherwise - close
6 parameters that include or exclude specific level types from the result and display
Instruction manual for an example
- You open a position. levels from the first two parameters (100 points of stop loss and 100 points of take profit) are set immediately.
- When the price moves in the profitable direction, if the profit exceeds the difference between parameters init stop loss and when begin move tp/sl levels (100 - 25 = 75 points), the take profit and stop loss levels are shifted to the new values take profit after move and stop loss after move points away from the current price.
- That is, the new values are equal to +50 and -50 points from the new price.
- You have a breakeven of 25 = (-100 (initial value) + 75 (reached level) + 50 (new value)) points. The new take profit value is 275 = (175+100).
- Now, if the price continues to move in the direction of profit, when 100 points (75+25) are exceeded, the protective levels will be moved by another 25 points (half of 50 - the new value of take profit).
- Thus, breakeven secures 50 points of profit, the current price is 100, the take profit value is 150 points from the position opening price.
- After 25 more points, the process will be repeated and another 25 points will be secured by breakeven.
In Automatic and Manual mode, the new SL and TP values are not configured. The closest level is taken or default values if there are no levels.
Play around with the parameters to find the optimal values for your trading style.
Demo version: https://www.mql5.com/en/market/product/28559
DOES NOT EXPOSE PROTECTION ORDERS AT ALREADY OPEN POSITIONS!