Friday, June 15, 2018

How to use two expert advisor on MT4

Today I explain how to use two Expert Advisor ( EA) on MT4.
Open you MT4 and right click on expert folder and create two expert advisor : singleopenbuy and singleopensell
Now add two your favourite currency window and active expert advisor one by one in both window.
In the first window active  singleopenbuy In the second window active singleopensell

Now you are ready for trading trade automatic open one sell and one buy on same time everytimes.


Create new expert advisor for singleopenbuy with this code :

//+------------------------------------------------------------------+
//|                                                   singleopen.mq4 |
//|                        Copyright 2018, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int start(){

//manage open orders here

if (OrdersTotal() > 0){
      return(0);
}

//open new orders here
{                                          // Opening BUY
   OrderSend(Symbol(),OP_BUY,0.01,Ask,2,Bid-5*Point,Bid+5*Point);
   return(0);                                   // Exit start()
  }

}

-----------------------------------------------------------------------------------------------------------------


Create new expert advisor for singleopensell with this code :

//+------------------------------------------------------------------+
//|                                                   singleopen.mq4 |
//|                        Copyright 2018, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int start(){

//manage open orders here

if (OrdersTotal() > 0){
      return(0);
}

//open new orders here
{                                          // Opening BUY
   OrderSend(Symbol(),OP_SELL,0.01,Bid,2,Ask+5*Point,Ask-5*Point);
   return(0);                                   // Exit start()
  }

}

No comments:

Post a Comment