News Robot Market Submission Error

 

I have created a news trading EA but when submitting it to the market approval and moderation, the automatic approval system says it has errors when it does not. It says it places no trades, whereas it does place trades the settings need to be for a specific time and date. Please can someone suggest how to resolve this so that the EA can be submitted for moderation.


Thanks!

 
The checks a trading robot must pass before publication in the Market
The checks a trading robot must pass before publication in the Market
  • www.mql5.com
Before any product is published in the Market, it must undergo compulsory preliminary checks, as a small error in the expert or indicator logic can cause losses on the trading account. That is why we have developed a series of basic checks to ensure the required quality level of the Market products. If any errors are identified by the Market...
 
JUDE GOLDFORSTER:

I have created a news trading EA but when submitting it to the market approval and moderation, the automatic approval system says it has errors when it does not. It says it places no trades, whereas it does place trades the settings need to be for a specific time and date. Please can someone suggest how to resolve this so that the EA can be submitted for moderation.


Thanks!

Hello,

you can to add a part of code, up in the OnTick() function, to make some trades on tester.

Like that...

//---------------------------------------------------------------------
//Pass tester to approval product
int OpenedOrders=0;
int iSendOrder1=0;
int iSendOrder2=0;
bool iCloseOrder1=false;
bool iCloseOrder2=false;
double Profit1=0;
double Profit2=0;
double OrdersTakeProfit=10;
double OrdersStopLoss=10;
double LotsSize=NormalizeDouble(0.01,2);
//---------------------------------------------------------------------
if((IsTesting())||(IsVisualMode())||(IsOptimization()))
  {
   if(OrdersTotal()>0)
     {
      for(i=OrdersTotal()-1; i>=0; i--)
        {
         if(OrderSelect(i,SELECT_BY_POS)==true)
           {
            if(OrderMagicNumber()==123321)
              {
               OpenedOrders++;
               if(OrderType()==OP_BUY)
                 {
                  Profit1=OrderProfit()+OrderCommission()+OrderSwap();
                  if((Profit1>=(OrderLots()*OrdersTakeProfit)*MarketInfo(Symbol(),MODE_TICKVALUE)*10)||(Profit1<=-((OrderLots()*OrdersStopLoss)*MarketInfo(Symbol(),MODE_TICKVALUE)*10)))
                    {
                     iCloseOrder1=OrderClose(OrderTicket(),OrderLots(),Bid,3,clrNONE);
                    }
                 }
               if(OrderType()==OP_SELL)
                 {
                  Profit2=OrderProfit()+OrderCommission()+OrderSwap();
                  if((Profit2>=(OrderLots()*OrdersTakeProfit)*MarketInfo(Symbol(),MODE_TICKVALUE)*10)||(Profit2<=-((OrderLots()*OrdersStopLoss)*MarketInfo(Symbol(),MODE_TICKVALUE)*10)))
                    {
                     iCloseOrder2=OrderClose(OrderTicket(),OrderLots(),Ask,3,clrNONE);
                    }
                 }
              }
           }
        }
     }
   else
      if(Hour()==12)
        {
         if((OpenedOrders==0)&&(AccountFreeMarginCheck(Symbol(),OP_BUY,LotsSize)+AccountFreeMarginCheck(Symbol(),OP_SELL,LotsSize)>0))
           {
            iSendOrder1=OrderSend(Symbol(),OP_BUY,LotsSize,Ask,3,0,0,"",123321,0,clrBlue);
            iSendOrder2=OrderSend(Symbol(),OP_SELL,LotsSize,Bid,3,0,0,"",123321,0,clrRed);
           }
        }
   return;
  }
//+------------------------------------------------------------------+

Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
  • www.mql5.com
//| Expert initialization function                                   | //| Expert deinitialization function                                 | //| Expert tick function                                             | //| test1                                                            |...
 

That code has errors with normalized lot; i can delete it and just put lot, however it also has undefined "i". See screen shot, please resolve "i"


 
Still not sure how to resolve...
 
JUDE GOLDFORSTER:

That code has errors with normalized lot; i can delete it and just put lot, however it also has undefined "i". See screen shot, please resolve "i"


Try this.. I make the changes!

void OnTick()
  {
//---------------------------------------------------------------------
//Pass tester to approval product
   int OpenedOrders=0;
   int iSendOrder1=0;
   int iSendOrder2=0;
   bool iCloseOrder1=false;
   bool iCloseOrder2=false;
   double Profit1=0;
   double Profit2=0;
   double OrdersTakeProfit=10;
   double OrdersStopLoss=10;
   double LotsSize=NormalizeDouble(0.01,2);
//---------------------------------------------------------------------
   if((IsTesting())||(IsVisualMode())||(IsOptimization()))
     {
      if(OrdersTotal()>0)
        {
         for(int i=OrdersTotal()-1; i>=0; i--)
           {
            if(OrderSelect(i,SELECT_BY_POS)==true)
              {
               if(OrderMagicNumber()==123321)
                 {
                  OpenedOrders++;
                  if(OrderType()==OP_BUY)
                    {
                     Profit1=OrderProfit()+OrderCommission()+OrderSwap();
                     if((Profit1>=(OrderLots()*OrdersTakeProfit)*MarketInfo(Symbol(),MODE_TICKVALUE)*10)||(Profit1<=-((OrderLots()*OrdersStopLoss)*MarketInfo(Symbol(),MODE_TICKVALUE)*10)))
                       {
                        iCloseOrder1=OrderClose(OrderTicket(),OrderLots(),Bid,3,clrNONE);
                       }
                    }
                  if(OrderType()==OP_SELL)
                    {
                     Profit2=OrderProfit()+OrderCommission()+OrderSwap();
                     if((Profit2>=(OrderLots()*OrdersTakeProfit)*MarketInfo(Symbol(),MODE_TICKVALUE)*10)||(Profit2<=-((OrderLots()*OrdersStopLoss)*MarketInfo(Symbol(),MODE_TICKVALUE)*10)))
                       {
                        iCloseOrder2=OrderClose(OrderTicket(),OrderLots(),Ask,3,clrNONE);
                       }
                    }
                 }
              }
           }
        }
      else
         if(Hour()==12)
           {
            if((OpenedOrders==0)&&(AccountFreeMarginCheck(Symbol(),OP_BUY,LotsSize)+AccountFreeMarginCheck(Symbol(),OP_SELL,LotsSize)>0))
              {
               iSendOrder1=OrderSend(Symbol(),OP_BUY,LotsSize,Ask,3,0,0,"",123321,0,clrBlue);
               iSendOrder2=OrderSend(Symbol(),OP_SELL,LotsSize,Bid,3,0,0,"",123321,0,clrRed);
              }
           }
      return;
     }
//+------------------------------------------------------------------+
  }