- This EA works using a reversal logic: Buy → Stop Loss → Sell Stop → ...
- Multicurrency program (10 trading instruments are defined in the EA parameters).
- It is attached to one chart and trades up to ten trading instruments.
- Individual parameters are used for each trading instrument.
- The main logic is the same for all instruments.
- Martingale - customizable multiplier. It is possible to limit the number of increase steps.
- The EA opens the first order based on the signal:
- the price crosses the МА line.
- the price crosses the nearest extremum on the chart.
- Take Profit and Stop Loss are set to the order.
- A pending Stop order is placed according to the Stop Loss level, with an increased lot.
- The series of increases until closing by Take Profit or until reaching the maximum lot of the series (MLL).
Parameters for each instrument are set as a string.
TOOLSn - name of the trading instrument.
T - chart timeframe for signals (0 - M1, 1 - M5, 2 - M15, 3 - M30, 4 - H1, 5 - H4, 6 - D1, 7 - W1, 8 - MN).
NB - indicator period; if S = 0 or 1, defines the period of the MA indicator; if S = 2 or 3, defines the number of chart bars.
S = (0 - 3) - the type of signal for entering the market:
- 0 - MA(NB): the price crosses the МА with a period of NB upwards - the first trade in the series is Buy, downwards - Sell.
- 1 - MA(NB): the price crosses the МА with a period of NB upwards - the first trade in the series is Sell, downwards - Buy.
- 2 - analysis of the last NB bars of the chart; price above the High of the bar group - Sell signal, below the Low - Buy (rebound).
- 3 - analysis of the last NB bars of the chart; price above the High of the bar group - Buy signal, below the Low - Sell (breakout).
L.LL = 0.01 - initial lot (if M < 2, then the minimum is 0.02, because the lot of the next order of the series may not increase).
M = 2.00 - multiplier of the next lot, fractional values can be used (for example: 1.3 or 1.67).
MLL = 0.70 - the maximum lot size of the series; once it is closed, the series starts with the initial lot:
- If set to 0, the lot increase series will be limited by the maximum lot size set by broker or the available deposit.
- For example, if L.LL=0.01, M=2.0, MLL=0.70, then the lots in series will be: 0.01, 0.02, 0.04, 0.08, 0.16, 0.32, 0.64 - reset - 0.01, 0.02, 0.04, ...
C = 0 or 1:
- 0 - work based on simple logic (reversal).
- 1 - enable the additional modification of Stop Loss of the market order and moving the pending Stop order with a change in the lot. If the price passes 2/3 of points from the order price to Take Profit, the EA moves the Stop Loss of the market order into a small profit at TzPNT points from the price and modifies the pending Stop order: the opening price is equal to the Stop Loss of the market order, the lot size is set equal to the lot size of the market order.
TP = 45 - Take Profit.
SL = 40 - Stop Loss.
TzPNT = 5 - protective Stop Loss. Enabled when C = 1 and when the price approaches ТР (if Buy - bid > OpenPrice+(TakeProfit-OpenPrice)*0.66).
Example of setting the EA parameters
- S_S_ = TOOLSn T NB S L.LL M MLL C TP SL TzPNT
- CURRENCY_1 = EURUSD 2 60 3 0.01 2.0 0.7 1 70 60 30
- CURRENCY_2 = USDCAD 2 60 1 0.01 2.0 0.70 1 60 40 15
- CURRENCY_10 = off
- Magic = 1955
- The_data_on_the_chart = true
* Unused CURRENCY_ in the EA parameters must be disabled by specifying the value off.
Explanation of the parameters for EURUSD:
- 2 - the M15 timeframe.
- 60 - High and Low of the last 60 bars of the chart.
- 3 - when the price exceeds the High, the first order in the series with the lot of 0.01 will be Buy; when the price falls below the Low - Sell.
- 0.01 - lot size.
- 2.0 - multiplier.
- 0.7 - limitation for the increase in the series.
- 1 - enabled modification of SL and Stop order when approaching TP.
- 70 - Take Profit.
- 60 - Stop Loss.
- 30 - protective Stop Loss.
Recommendations on usage
- The EA is attached to the window of currency parameter, which is present in the EA settings.
- It is recommended to set the chart timeframe to the same as in the parameters for this currency pair. The EA parameters presented above are best used on EURUSD - M15 (T=2).
- To limit the losses, limit the maximum lot in the series by MLL.
- The EA can be tested in the strategy tester and the parameters for currency pairs can be selected independently. To speed up the testing, you can disable the output of data to the chart.