Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

This is the cross-platform МТ45 Expert Advisor - Expert for MetaTrader 5

author EAcpu | 6 reads | 0 comments |

This is a cross-platform МТ45 Expert Advisor - expert for MetaTrader 5

This is a cross-platform МТ45 Expert Advisor - expert for MetaTrader 5

This is a cross-platform МТ45 Expert Advisor - expert for MetaTrader 5

This is a cross-platform МТ45 Expert Advisor - expert for MetaTrader 5

After a losing trade, МТ45 EA opens the next trade with a higher lot size.

The first trade is always a buy operation, after which the positions alternate, i.e. buy-sell-buy.

The EA opens a position at the opening of the candlestick.

After stop loss, the EA will increase the lot size by the Kuala Lumpur coefficient until it reaches the maximum machine learning value. The batch is then reset to the initial batch, .

EURUSD, Н1 time frame. The optimization time interval of EA is 11.01.2014-09.09.2017

 Enter integer Stop = 600 ; // Stop loss
Enter an integer and get = 700 ; // Take profit
Enter integer slip = 100 ; // slippage
Input integer minnesota = 123 ; // magic
Enter double LT= 0.01 ; // a lot
Enter double KL = 2 ; // lot increase ratio
Enter double ML = 10 ; // Maximum lot size


Cross-platform mode is implemented using preprocessor directives. Example of Martingale function:

 //+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double many()
  {
Double lot size = LT; //--- MQL4
#ifdef __MQL4__ if ( order selection ( order history total () - 1 , SELECT_BY_POS , mode_history ))
    {
If ( Order Profit ()> 0 ) Lot Size=LT;
If ( order profit ()< 0 ) batch= order batch ()*KL;
    } #endif //--- MQL5
#ifdef __MQL5__ if ( history selection ( 0 , time current ()))
    {
      Double profit = HistoryDealGetDouble(HistoryDealGetTicket(HistoryDealsTotal()-1),DEAL_PROFIT);
      double LastLot=HHistoryDe​​alGetDouble(HistoryDe​​alGetTicket(HistoryDe​​alsTotal()-1),DEAL_VOLUME);
      if(profit>0) lot size=LT;
      if(profit<0) Lot size=LastLot*KL;
    } #endif

if (batch>ML)batch=LT;
return (many);
  }


МetaТrader 4 terminal:

This is a cross-platform МТ45 Expert Advisor - expert for MetaTrader 5

МetaТrader 5 terminal:

This is a cross-platform МТ45 Expert Advisor - expert for MetaTrader 5


Attachment download

📎 mt45.mq4 (10.21 KB)

📎 mt45.mq5 (10.21 KB)

Source: MQL5 #19102

Verification code Refresh