Trading Strategy
After a losing trade, the ΠΠ’45 EA opens the next trade with a higher lot.
The first deal is always a Buy operation, after that positions alternate, i.e. buying-selling-buying.
The EA opens positions at the candlestick opening.
After a Stop Loss, the EA increases the lot by KL coefficient until it reaches the maximum value of ML. Then the lot is reset to the initial one, LΠ’.
EURUSD, the Π1 timeframe. The EA is optimized at an interval of 11.01.2014-09.09.2017
Expert Advisor Settings
input intΒ Β Β Β Stop = 600;Β Β // Stop Loss input intΒ Β Β Β Take = 700;Β Β // Take Profit input intΒ Β Β Β Slip = 100;Β Β // Slippage input intΒ Β Β Β MNΒ Β = 123;Β Β // Magic input double LTΒ Β = 0.01; // Lot input double KLΒ Β = 2;Β Β Β Β // Lot increase ratio input double MLΒ Β = 10;Β Β // Maximum lot
Features
The cross-platform mode is implemented using preprocessor directives. An example of the Martingale function:
//+------------------------------------------------------------------+ //|Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β | //+------------------------------------------------------------------+ double Lot() Β Β { Β Β double lot=LT; //---Β Β MQL4 #ifdef __MQL4__ Β Β if(OrderSelect(OrdersHistoryTotal()-1,SELECT_BY_POS,MODE_HISTORY)) Β Β Β Β { Β Β Β Β Β Β if(OrderProfit()>0) lot=LT; Β Β Β Β Β Β if(OrderProfit()<0) lot=OrderLots()*KL; Β Β Β Β } #endif //---Β Β MQL5 #ifdef __MQL5__ Β Β if(HistorySelect(0,TimeCurrent())) Β Β Β Β { double profit=HistoryDealGetDouble(HistoryDealGetTicket(HistoryDealsTotal()-1),DEAL_PROFIT); double LastLot=HHistoryDealGetDouble(HistoryDealGetTicket(HistoryDealsTotal()-1),DEAL_VOLUME); if(profit>0) lot=LT; if(profit<0) lot=LastLot*KL; Β Β Β Β } #endif Β Β if(lot>ML)lot=LT; Β Β return(lot); Β Β }
Backtests
The ΠetaΠ’rader 4 terminal:
The ΠetaΠ’rader 5 terminal:
Tips
- It is recommended to use this EA only as a basis for your own strategy.