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

Powerful EA Template - MetaTrader 4 Expert | MT4 EA Download - MetaTrader 4 Resources

author EAcpu | 2 reads | 0 comments |

Robust EA Template - expert for MetaTrader 4

Inovance Technology - https://www.inovancetech.com/

Powerful EA templates help with correctly setting take profit and stop loss levels, entering and exiting positions, and handling terminal issues such as crashes or disconnections.

To use it, enter your entry conditions in the "Long and Short Entry Conditions" section at the bottom of the EA. Enter a long condition, and if a long signal is generated in the "LongSignal()" function, "1" is returned; enter a short condition, and if a short signal is generated in the "ShortSignal()" function, "-1" is returned.

If your conditions are met, a single buy or sell order will be placed; if both long and short conditions are met, no order will be placed. It will exit the trade if Take Profit or Stop Loss is reached, or if there is a signal in the opposite direction, in which case it will exit the existing trade and open a new one in the appropriate direction.

Robust EA Template - expert for MetaTrader 4

The "Long and Short Entry Conditions" section shows an example strategy ( note: this is an arbitrary strategy and is for demonstration purposes only ).

 //+------------------------------------------------------------------+
//|Long and short entry conditions |
//+------------------------------------------------------------------+
Integer indCCI0 period = 14 ; // indicator 1 period
Integer indRSI1 period = 14 ; // indicator 2 period
//+------------------------------------------------------------------+
//|Long entries (return "1" for long entries, "0" for no entries) |
//+------------------------------------------------------------------+
integer long signal()
  {
doubleCCI0 = iCCI ( void , 0 , indCCI0 period, PRICE_CLOSE , 1 );
Double relative strength index 1 = RSI ( invalid , 0 , indRSI1 period, PRICE_CLOSE , 1 );
integer match = 0 ;
if (CCI0>- 200 && CCI0<=- 150 ) match++;
Else if (CCI0>- 100 && CCI0<=- 50 ) match++;
if (RSI1> 0 && RSI1<= 25 ) match ++;
if (match == 2 ) return 1 ;
return 0 ;
  } //+------------------------------------------------------------------+
//|Short entries (long entries return "-1", no entries return "0") |
//+------------------------------------------------------------------+
Integer short signal()
  {
doubleCCI0 = iCCI ( void , 0 , indCCI0 period, PRICE_CLOSE , 1 );
Double relative strength index 1 = RSI ( invalid , 0 , indRSI1 period, PRICE_CLOSE , 1 );
integer match = 0 ;
if (CCI0 > 50 && CCI0 <= 150 ) match ++;
if (RSI1 > 80 && RSI1 <= 100 ) match ++;
if (match == 2 ) return - 1 ;
return 0 ;
  }


suggestion:


Attachment download

📎 robust_ea_template.mq4 (11.8 KB)

Source: MQL5 #13942

Verification code Refresh