Overloading the broker´s server

 

I am using EA in charts and rec'd warning message from broker as follows:

"Our IT department has found some issues regarding your Demo account. You are sending to our servers more than 50,000 actions per day. We kindly ask you to reduce the amount of requests, otherwise we would have to disable your demo account and block your IP address starting from the following business day to avoid demo server overloading. "


In order to deduce "actions" send to server, I want to clarify what type of codes are server-action and what type of codes are local-action.

Some codes and functions related to server-action:

- Ordersend

- OrderModify

- OrderClose

- OrderDelete

Others code and functions not sure if they are counted as "server action" or not:

- Print

- OrderSelect

- indicators values read

- Comment printed on chart

- Global and local variable declaration


Could anyone suggest the above codes and functions related to "server action" so that I can amend the codes in EA?

Thank you!

 

Only trade functions go to the broker, what you call server-actions.

50k is a ridiculous amount of trade requests. Stop deleting and replacing or modifying your 500 order grid on every tick for example.

 

You are choking your brokers server.

If it wasn't a demo server they would have most likely blocked your IP already.

If you post the code we can point you to the problem.

 

Thank you for answering.

After reading the log file, problems may come from "Modify" function

Here is the code for "modify order" to work as trailing stop:


//---Global Variables------------------------         


float EntryPriceHighBuy = 0;
float EntryPriceLowSell = 0;


//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   
   if(TtlOdrBuy>0){
                           NewSL = EntryPriceHighBuy;                
                 if(Bid>ModifyPrice_1){ 
                           NewSL = EntryPriceHighBuy;
                           if(NewSL>SLBuySame_1)         ModifyOdr(OdrTktBuySame_1,NewSL);
                           
                 }
   }

   if(TtlOdrSell>0){
                  double NewSL = 0;
                  if(Ask<ModifyPrice_2){          
                           NewSL = EntryPriceLowSell;
                           if(NewSL<SLSellSame_1)         ModifyOdr(OdrTktSellSame_1,NewSL);
                  }
   }        
//---------------------------------------------------------------------
  }  //--End of OnTick
//+------------------------------------------------------------------+

//----------------Modify Order------------------------------------------------

void ModifyOdr(int OdrTkt, double NewSL){
       
       bool res;

        for (int i=OrdersTotal()-1; i>=0; i--) 
        { 
            if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) break; 
            if (Symbol()==OrderSymbol())
            {

                  if(OrderTicket()==OdrTkt)
                  {
                        if(OrderStopLoss()!=NewSL)
                           res=OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(NewSL,Digits),OrderTakeProfit(),0,clrGreen);
            
                        if(!res)
                           Print("Error in OrderModify. Error code=",GetLastError(),",OdrTkt=",OdrTkt,",NewSL=",NewSL,",OldSL=",OrderStopLoss());
                  }
            }
         }                  
}

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                                                            |...
 
  1. Check the new SL is at least a point away, in the direction of the trade, before you modify it.

  2. if(OrderStopLoss()!=NewSL)
    Doubles are rarely equal. Understand the links in:
              The == operand. - MQL4 programming forum
  3. Your OrderModify and your result check should be inside the same block.
Reason: