Different behavior of EA in the different platform

 

Hello,

I coded one EA. I added it to different platforms, and appeared problem with a couple. On the few platforms EA makes the same trades, but on few the code has problems below:

Platform A. problem is with one trade per day - like the system doesn't "see" loop

Platforms B (LMAX and Iron FX-ZSSTP). problem is with one transaction. During fast and rapid move the EA opens trades till is possible - something like error of feedback. It looks like the EA has not information that trade was opened.

In every case I used the same EA. Has anyone any ideas how to fix it (of course without change a broker) ?

 
This forum focuses on MT4 only. So, are you referring to MT4 or not ?
 
I know what is focuse for this forum. My EA was coded in MQL4.
 
Then show us your code. We will look into it when someone have the spare time. Please use SRC when posting the code.
 
kot_filemon:
I know what is focuse for this forum. My EA was coded in MQL4.

So you mean different behavior on different broker, not platform. The platform is MT4.

You have to check your code, print some variables to find where is the difference. Different brokers, or different accounts on the same broker, can you different trading parameters (spread, digits, stoplevels, minimum volume, etc...)

 

Wrong title & questions leads to wrong expected answers.


No wonder people keep saying .. to get a good answer, good question is a must.


But he does say ...

Platforms B (LMAX and Iron FX-ZSSTP)

I am surprised that kind of platform uses mql4 for coding.

 
#property copyright "m_c"
#property link      "http://www.metaquotes.net"


extern int Ticket;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
   double Type=OrderType();
     double Poczatek=0;
       double TrailingStop=250;
         int MagicNumber=OrderMagicNumber();

   double cz_otw=13.30;
      double cz_zam=19.00;

   int godzina=Hour();
    double minuty=Minute();
      double czas_obecny=godzina+minuty/100;
         if (czas_obecny>=cz_zam) return(0);
            if (czas_obecny<=cz_otw) return(0);
               if((czas_obecny>=cz_otw)&& (czas_obecny<cz_zam) ) OrderTicket(); 
               
 for (int i=OrdersTotal()-1;i>=0;i--)
   {
      if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false)break;
       if (OrderSymbol()!=Symbol())continue;
        if (MagicNumber!=OrderMagicNumber())continue;              
       
  
   if (Type==OP_BUY)
      if((Bid-OrderOpenPrice())>Point*Poczatek || (Bid-OrderOpenPrice())<Point*Poczatek)
         if (OrderStopLoss()<Bid-Point*TrailingStop)
         OrderModify(OrderTicket(),OrderOpenPrice(),Bid-(Point*TrailingStop),OrderTakeProfit(),0);
   
    if (Type==OP_SELL)
      if((OrderOpenPrice()-Ask)>Point*Poczatek || (OrderOpenPrice()-Ask)<Point*Poczatek)
         if(OrderStopLoss()>Ask+TrailingStop*Point||OrderStopLoss()==0)     
         OrderModify(OrderTicket(),OrderOpenPrice(),Ask+(Point*TrailingStop),OrderTakeProfit(),0);
        
   }

 datetime Midnight=TimeCurrent()-(TimeCurrent()%(PERIOD_D1*60));
         datetime start_of_Day=Midnight+(13*PERIOD_H1*60)+(30*PERIOD_M1);  
                   
         for (int j=OrdersTotal()-1;j>=0;j--)
          {
            if (OrderSelect(j,SELECT_BY_POS,MODE_TRADES))
             if (OrderSymbol()==Symbol())
              if (MagicNumber==OrderMagicNumber())
               {                   
                  datetime z=OrderOpenTime();
                  if (z>=start_of_Day)return(0);
               }
              
          }
         for (int k=OrdersHistoryTotal()-1;k>=0;k--)
            {
               if(OrderSelect(k,SELECT_BY_POS,MODE_HISTORY))
                 if (OrderMagicNumber()==MagicNumber)  
                   if (OrderSymbol()==Symbol())      
                { 
                  datetime opp=OrderOpenTime();          
                     if (opp>=start_of_Day)return(0);        
                }   
                           
            }






int B=buy(Ticket);
   int S=sell(Ticket);
  
   return(0);
 }
//+------------------------------------------------------------------+
 int buy (int Ticket)
    {
    
 
    double ABC=condition;
     
    RefreshRates();
      if (OrdersTotal()==0 && ABC  )
         {           
            Ticket=OrderSend(Symbol(),OP_BUY,0.5,Ask,1,0,0,"buy",MagicNumber,Blue); 
                  
         } 
    
      return (Ticket);
    }
    
    int sell (int Ticket)
    {
      
  
    double XYZ=condition; 
    
    RefreshRates();
     if (OrdersTotal()==0 && XYZ )
        {         
            Ticket=OrderSend(Symbol(),OP_SELL,0.5,Bid,1,0,0,"sell",MagicNumber,Red);       
        }
    
      return (Ticket);
    }
 

LMAX and Iron FX-ZSSTP use MT4 and MT5 platform and other technology too.

 
kot_filemon:

You can't use OrderTicket(), OrderType(), OrderMagicNumber() or other Orderxxx() before an order is selected with OrderSelect().
 

What is this line of code meant to do?

            if((czas_obecny>=cz_otw)&& (czas_obecny<cz_zam) ) OrderTicket(); 

The variable Type is declared as a double, but not assigned a specific value, so the result from this code may be random

   if (Type==OP_BUY)
      if((Bid-OrderOpenPrice())>Point*Poczatek || (Bid-OrderOpenPrice())<Point*Poczatek)
         if (OrderStopLoss()<Bid-Point*TrailingStop)
         OrderModify(OrderTicket(),OrderOpenPrice(),Bid-(Point*TrailingStop),OrderTakeProfit(),0);
   
    if (Type==OP_SELL)
      if((OrderOpenPrice()-Ask)>Point*Poczatek || (OrderOpenPrice()-Ask)<Point*Poczatek)
         if(OrderStopLoss()>Ask+TrailingStop*Point||OrderStopLoss()==0)     
         OrderModify(OrderTicket(),OrderOpenPrice(),Ask+(Point*TrailingStop),OrderTakeProfit(),0);
 
Yup. The EA have some serious coding (mostly logic & condition) issues that needs to be taken care of.
Reason: