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

ExpertClor_v01 - MetaTrader 5 Expert | Forex Indicator Download - MT4/MT5 Resources

author EAcpu | 2 reads | 0 comments |

ExpertClor_v01 - expert for MetaTrader 5

The author of the ideaJohn Smith , the author of the MQL5 codeBarabashkakon .

Assistant Expert Advisor. Only closing positions:

ExpertClor_v01 - expert for MetaTrader 5

The position moves to the breakeven point, the stop loss is calculated based on the StopATR_auto indicator, and the position is closed at the intersection of the two MAs (Moving Averages).

In order to provide conditions for the EA to run, you should add the compiled stop ATR_automatic indicator file to the folder MQL5\Indicators\Downloads :

 //+------------------------------------------------------------------+
//|Expert initialization function |
//+------------------------------------------------------------------+
Integer initialization ()
  { //--- ... //--- Create a handle for the indicator iCustom handle_icustom= custom (m_symbol.Name(), time frame, "Download\\StopATR_auto" ,
                          average number of bars,
                          Target                          );

Although this Expert Advisor only closes a position, I added a small piece of code for opening a position:

 //+------------------------------------------------------------------+
//|Expert check function |
//+------------------------------------------------------------------+
Blank check ()
  { //--- if ( MQLInfo Integer ( MQL_DEBUG ) || MQLInfo Integer ( MQL_PROFILER ) || 
MQLInfo Integer ( MQL_Tester ) || MQLInfo Integer ( MQL_Optimization ))
    {
static long counter = - 50 ;
static boolean tradebuy = true ;

if (counter== 0 )
        m_trade.Buy(m_symbol.LotsMin());
else if (counter % 1500 == 0 )
        {
if ( refreshrate ())
          {
if (transaction_buy)
              {
              OpenBuy(m_symbol.LotsMin());
              tradebuy= false ;
              }
other {
              OpenSell(m_symbol.LotsMin());
              tradebuy= true ;
              }
          }
else counter = counter - 9 ;
        }

      counter++;
    } //---

This unit only works when you test or optimize this Expert Advisor. Begin buying or selling after every 1,500 ticks.


Attachment download

📎 expertclor_v01.mq5 (34.31 KB)

Source: MQL5 #18677

Verification code Refresh