Idea by: Nikolay Khrushchev
Code mq5 by: barabashkakvn
The EA works on hedge accounts only!
Swing-based Expert Advisor: the EA sets a pending Sell stop or Buy stop order with an increased lot and in the opposite direction.
Inputs:
Each time, the EA starts a trading cycle after falling within the allowed time interval between Start hour and End hour provided that there are no pending orders and no positions opened by this EA. An open position is accompanied by a pending stop order. A position volume depends on the Money management and The value for "Money management" parameters, while the volume of a pending Stop order depends on the Lot coefficient and Multiply the volume of all positions parameters.
Position direction is determined according to the following rule:
Close of bar #0 > Close of bar #1 -> open BUY; OTHERWISE -> open SELL
Pending stop order type depends on an open position:
if BUY, a Sell stop is set; if SELL, a Buy Stop is placed
A pending stop order is set at Step from the current price. Trailing Stop and Trailing Step are enabled further on together with the profit tracking mechanisms (Profit target in money and Minimum Equity).
When a pending order is triggered, a pending stop order with an increased lot is set again in the opposite direction.
It is recommended to run optimization on small timeframes. First of all, look for the Stop Loss, Take Profit and Step parameters.
Traduit du russe par MetaQuotes Ltd.
Code original : https://www.mql5.com/ru/code/22788
Volatility_Ratio2
Indicator Volatility Ratio2
Lot Check
This is a utility for rounding the lot size correctly