Download MetaTrader 5
To add comments, please log in or register
Do you need private account monitoring? The Signals will provide you one!
Arav007
412
Arav007 2014.09.13 15:33 

I have been testing this EA for a while now. But it's not Performing as Expected.

 

My requirement was that the EA should Open trade just Once after fulfilling a trading condition.

Like if the 'Buy' condition is met, it'll Open Buy trades just Once. It wont open any more trade

if the current trades got closed somehow unless Sell condition is met. Then it'll open Sell trades.


But often this EA is opening consecutive Buy/Sell trades even after closing of existing Buy/Sell trades.


Again, it was supposed to open pre-defined number of trades like 2/3 trades at once but it's not

following that too! Often it's failing to open more than One trade at once.


Another concerning matter is, I'm running this EA on a VPS. Now the EA isn't Opening trades

often even though the Trading condition got met already. Then if I restart the Meta Trader terminal,

it opens all the Due orders instantly according to the current market condition! I searched the 'Experts' and 'Journal' tabs but haven't found

any 'Error' message about Opening trades. 

 

So please enlighten the Flaws in this EA for which it's not  performing correctly.

 

Thanks 

Files:
ma.mq4 20 kb
ffoorr
983
ffoorr 2014.09.13 16:33  

The opening order problem is there :

int Two_Sell_Orders(double LotSize_3,int TakeProfit_2,int TakeProfit_3,int StopLoss_1,int Slippage_1)
  {

   double OpenPrice=Bid;
   int count=2;
   double dTakeProfitPrice_2,dTakeProfitPrice_3;
   dStopLossPrice=NormalizeDouble(OpenPrice+StopLoss_1*dPip,Digits);

   dTakeProfitPrice_2 = NormalizeDouble(OpenPrice - TakeProfit_2 * dPip,Digits);
   dTakeProfitPrice_3 = NormalizeDouble(OpenPrice - TakeProfit_3 * dPip,Digits);

   iLastError=0;
   if(count==2)
     {
      SellOrder_1=OrderSend(Symbol(),iOrderType_Sell,LotSize_3,OpenPrice,Slippage_1,dStopLossPrice,dTakeProfitPrice,"Sell Order",MagicNumber,0,Red);

      if(SellOrder_1>0) //Checking if the order was opened or not
        {
         Print("Sell Order 1 Opened");
         count=count-1;
        }
      else
        {
         iLastError=GetLastError();
         Print("Error in opening Sell order 1");
        }
     }

   if(count==1)
     {
      SellOrder_2=OrderSend(Symbol(),iOrderType_Sell,LotSize_3,OpenPrice,Slippage_1,dStopLossPrice,dTakeProfitPrice_1,"Sell Order",MagicNumber,0,Red);

      if(SellOrder_2>0) //Checking if the order was opened or not
        {
         Print("Sell Order 2 Opened");
         count=count-1;
        }
      else
        {
         iLastError=GetLastError();
         Print("Error in opening Sell order 2");
        }
     }

   return(count);
  }
//+------------------------------------------------------------------+


If someone want to open two order in a row, just put two OrderSend( )

  
     int tick_1 = -1;
         tick_1 = OrderSend (  );
     if( tick_1 > 0 )  
       {
        int tick_2 = -1;
            tick_2 =   OrderSend(   )  
         if(tick_2 >0 ) => exit 
Arav007
412
Arav007 2014.09.13 16:36  
ffoorr:

The opening order problem is there :


If someone want to open two order in a row, just put two OrderSend( )





Thanks. I'll try it for sure. What about other errors?
ffoorr
983
ffoorr 2014.09.13 17:03  
There is no strategy,  no command to open or close orders ;-))
Arav007
412
Arav007 2014.09.13 17:30  
ffoorr:
There is no strategy,  no command to open or close orders ;-))


Not sure whether you are Kidding or not but there are those lines:

if (Fast_MA>Slow_MA && !Buy_Once)
{
if (MA_Difference_1>=Value_Diff && iOpenOrders_Buy ==0)
{
ffoorr
983
ffoorr 2014.09.13 17:44  

Yes you are right, there is some command orders I have not see.

This EA is poorly coded, one would have to code it all again to make it work,

You can find lots of cross MA EA coded properly on the Net, it would be faster

/
To add comments, please log in or register