Download MetaTrader 5

Too many orders

To add comments, please log in or register
cape1354
186
cape1354  

When the arrow comes out, the order is placed in order to place an order with the red line at the beginning of the red line, and the order is placed in more than four units per minute.

How do I put the conditions at "If"





//BUY Open
      if((UpTrend != EMPTY_VALUE) &&(Buy != EMPTY_VALUE ) )  
        {
         ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,10,0,0,"ma sample",16384,0,Blue);
         if(ticket>0) 
           {
            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) /
            Print("BUY order opened : ",OrderOpenPrice()); 
           }
         else 
         Print("Error opening BUY order : ",GetLastError()); 
         return(0); 
        }


//--------------------------------------------------------------------

// iCustom

//--------------------------------------------------------------------

bool UpTrend, DownTrend, Buy, Sell;
double  Average_Profit,   Minimum_Move,  Success_Rate, Best_Profit;

   UpTrend= iCustom(NULL,0,"\\Market\\PipFinite", //File Path of indicator 
                                                                                       
                              //NEXT LINES WILL BE INDCATOR INPUTS
                              " ", 3,1000, " ",true,7,true,2,8,8,true,"","Dark",true,"",true," ",
                              false,                                 
                              false,                                 
                              false,  
                              //END FOR INPUTS
                                                             
                              0,//Index Buffer                               
                              1//Shift used is 1 because signals is at Close of bar
                          );


    Buy= iCustom(NULL,0,"\\Market\\PipFinite", //File Path of indicator 
                                                                                       
                              //NEXT LINES WILL BE INDCATOR INPUTS
                               " ", 3,1000, " ",true,7,true,2,8,8,true,"","Dark",true,"",true," ",
                              false,                                 
                              false,                                 
                              false,  
                              //END FOR INPUTS
                                                             
                              14,//Index Buffer                               
                              1//Shift used is 1 because signals is at Close of bar
                          );  


whroeder1
15925
whroeder1  
cape1354: order is placed in more than four units per minute. How do I put the conditions at "If"
if((UpTrend != EMPTY_VALUE) &&(Buy != EMPTY_VALUE ) )  
You are checking for a condition.
  1. Check for a change in condition.
    //    if((UpTrend != EMPTY_VALUE) &&(Buy != EMPTY_VALUE ) )  
    static bool buyCondition = false;
    bool buyPrev = buyCondition;
    buyCondition = UpTrend != EMPTY_VALUE && Buy != EMPTY_VALUE;
    if(buyCondition && !buyPrev)
    
  2. Or, check if you already have orders open by counting open orders with MN and Symbol.
    Using OrdersTotal directly and/or no Magic number filtering on your OrderSelect loop means your code is incompatible with every EA (including itself on other charts and manual trading.) Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 forum
To add comments, please log in or register