The algorithm of the adviser is designed taking into account medium-term trading. The core of the algorithm is the analysis of the medium-term price movement and two MA indicators.
The Expert Advisor can open pending orders with either a permanent lot or a lot, depending on the risk per trade.
Each order has a fixed stop loss and take profit.
There is a trailing stop to accompany profitable positions.
The function of money management helps to correctly distribute the risks.
Advisor does not use martingale.
There is an option to control the opening of the bar and the prohibition of work on each tick for faster testing at the prices of OHLC M1.
Each placed pending order has a lifetime in minutes, after which the unfulfilled order is deleted.
When placing a pending order, a special indent from the price of a specific delta in points is used. This delta is selected using optimization and should not be less than the level of the stop-level of the currency pair.
There is also an option to modify and move placed pending orders closer to the price.
Testing was conducted on the server MetaQuotes.
Account with support for Hedge mode.
Currency pair “EURJPY”.
The testing period is from 2010.02.02 to 2018.11.24.
Test mode “OHLC” on the M1 timeframe.
Test mode “All ticks” on the M1 timeframe.
InpTakeProfit = 100; // Take Profit (in pips)
InpStopLoss = 5; // Stop Loss (in pips)
InpTrailingStop = 40; // Trailing Stop (in pips)
InpTrailingStep = 5; // Trailing Step (in pips)
ExpirationMinutes = 2; // Time live orders, min
InpLots = 0; // Lots (or “Lots”>0 and “Risk”==0 or “Lots”==0 and “Risk”>0)
Risk = 5; // Risk (or “Lots”>0 and “Risk”==0 or “Lots”==0 and “Risk”>0)
InpDifference = 45; // Difference from МА (in pips)
ExpertEveryTick = true; // Disable EveryTick
InpMA_ma_period = 25; // МА period
InpMA2_ma_period = 40; // МА2 period
InpMA_ma_shift = 0; // MA PRICE_HIGH and PRICE_LOW: horizontal shift
InpMA_PH_ma_method = MODE_SMA; // MA PRICE_HIGH: smoothing type
InpMA_PL_ma_method = MODE_SMA; // MA PRICE_LOW: smoothing type
InpDelta = 5; // Delta for orders
TrailingOrders = true; // Mov orders
m_magic = 111372744; // Magic number