How control orders to open in different charts

 

I want to open orders in multiple charts in a giving condition.

example in EURUSD chart ,when price above MA10 and MA15 and no orderstotal , open buy orders.

after sometime later , in USDCHF chart ,same signal occurs ,need to open next order .

Here problem is how can code orders total counts to open next orders.

if one or more open orders present ,open next order in condition is complicated.

will open so many orders frequently.

give me some examples.

thanks

if(  Symbol1MA10 >Close[0] && Symbol1MA15 >Close[0])
  
 {
   OrderSend(symbol1,OP_SELL,lot,MarketInfo(symbol1,MODE_BID),3,0,0,"Main Sell",MAGIC,0,Red);//this is rabbit
  
 }
 

  if(  Symbol1MA10 <Close[0] && Symbol1MA15 <Close[0])
  
 {
   OrderSend(symbol1,OP_BUY,lot,MarketInfo(symbol1,MODE_ASK),3,0,0,"Main Buy",MAGIC,0,Green);//this is rabbit
   
   
 }
 
 //==========================================================
 
  if(  Symbol2MA10 <Symbol2Close && Symbol2MA15 < Symbol2Close)
  
 {
   OrderSend(symbol2,OP_BUY,lot,MarketInfo(symbol2,MODE_ASK),3,0,0,"Main Buy",MAGIC,0,Green);//this is rabbit
   
   
 }
 
  
 
 if(  Symbol2MA10 >Symbol2Close && Symbol2MA15 >Symbol2Close)
  
 {
   OrderSend(symbol2,OP_SELL,lot,MarketInfo(symbol2,MODE_BID),3,0,0,"Main Sell",MAGIC,0,Red);//this is rabbit
  
 }
 
LONNV:

I want to open orders in multiple charts in a giving condition.

example in EURUSD chart ,when price above MA10 and MA15 and no orderstotal , open buy orders.

after sometime later , in USDCHF chart ,same signal occurs ,need to open next order .

Here problem is how can code orders total counts to open next orders.

if one or more open orders present ,open next order in condition is complicated.

will open so many orders frequently.

give me some examples.

thanks

let me phrase your question into my understanding. You want to create an EA that can open position more than one currencies but you don't want it to open more than numbers of orderstotal. is this right?

 
Luandre Ezra:

let me phrase your question into my understanding. You want to create an EA that can open position more than one currencies but you don't want it to open more than numbers of orderstotal. is this right?

ok check photo here

When MA cross down, EU open order

and also on another chart ,MA is cross but not open orders

because of OrdersTotal()==0 function

I want to open orders whenever MA cross in many different charts but first trde condition must be OrdersTogtal()==0 ,

if OrdersTotal()>= 0, will open many orders at same price because of not control orders.

How can solve it.


 
Luandre Ezra:

let me phrase your question into my understanding. You want to create an EA that can open position more than one currencies but you don't want it to open more than numbers of orderstotal. is this right?

codes and results

 double FastMovingAverageS1 =     iMA(symbol1,0 ,period1,0,MODE_EMA,PRICE_CLOSE,0);
       
       double LastFastMovingAverageS1 = iMA(symbol1,0 ,period1,0,MODE_EMA,PRICE_CLOSE,1);
  
       double SlowMovingAverageS1 =     iMA(symbol1,0 ,period2,0,MODE_EMA,PRICE_CLOSE,0);//current bar 
       
       double LastSlowMovingAverageS1 = iMA(symbol1,0 ,period2,0,MODE_EMA,PRICE_CLOSE,1);//previous bar
 
      
        double FastMovingAverageS2 =     iMA(symbol2,0 ,period1,0,MODE_EMA,PRICE_CLOSE,0);
       
       double LastFastMovingAverageS2 = iMA(symbol2,0 ,period1,0,MODE_EMA,PRICE_CLOSE,1);
  
       double SlowMovingAverageS2 =     iMA(symbol2,0 ,period2,0,MODE_EMA,PRICE_CLOSE,0);//current bar 
       
       double LastSlowMovingAverageS2 = iMA(symbol2,0 ,period2,0,MODE_EMA,PRICE_CLOSE,1);//previous bar
 
      
        double FastMovingAverageS3 =     iMA(symbol3,0 ,period1,0,MODE_EMA,PRICE_CLOSE,0);
       
       double LastFastMovingAverageS3 = iMA(symbol3,0 ,period1,0,MODE_EMA,PRICE_CLOSE,1);
  
       double SlowMovingAverageS3 =     iMA(symbol3,0 ,period2,0,MODE_EMA,PRICE_CLOSE,0);//current bar 
       
       double LastSlowMovingAverageS3 = iMA(symbol3,0 ,period2,0,MODE_EMA,PRICE_CLOSE,1);//previous bar
 
      
        
       
        
       
     if ( OrdersTotal() == 0 || CountOrdersThisPairMainBUY()>0 ||CountOrdersThisPairMainSELL()>0 )
      {
      
    if ((LastFastMovingAverageS1<LastSlowMovingAverageS1)&& (FastMovingAverageS1>SlowMovingAverageS1) ) //2 - trade condition = 100 /40 
             {
               OrderSend (symbol1,OP_BUY ,lot , Ask, 3,0,0,"Main Buy",MAGIC,0,Green); // 3 -open order
              
             }
           
          
    if ((LastFastMovingAverageS1>LastSlowMovingAverageS1)&&  (FastMovingAverageS1<SlowMovingAverageS1) )
             {
               OrderSend (symbol1,OP_SELL ,lot, Bid, 3,0,0,"Main Sell",MAGIC,0,Red);
             
            }
          
     
           if ((LastFastMovingAverageS2<LastSlowMovingAverageS2)&& (FastMovingAverageS2>SlowMovingAverageS2) ) //2 - trade condition = 100 /40 
             {
               OrderSend (symbol2,OP_BUY ,lot , Ask, 3,0,0,"Main Buy",MAGIC,0,Green); // 3 -open order
              
             }
           
          
    if ((LastFastMovingAverageS2>LastSlowMovingAverageS2)&&  (FastMovingAverageS2<SlowMovingAverageS2) )
             {
               OrderSend (symbol2,OP_SELL ,lot, Bid, 3,0,0,"Main Sell",MAGIC,0,Red);
             
            }
          
      if ((LastFastMovingAverageS3<LastSlowMovingAverageS3)&& (FastMovingAverageS3>SlowMovingAverageS3) ) //2 - trade condition = 100 /40 
             {
               OrderSend (symbol3,OP_BUY ,lot , Ask, 3,0,0,"Main Buy",MAGIC,0,Green); // 3 -open order
              
             }
           
          
    if ((LastFastMovingAverageS3>LastSlowMovingAverageS3)&&  (FastMovingAverageS3<SlowMovingAverageS3) )
             {
               OrderSend (symbol3,OP_SELL ,lot, Bid, 3,0,0,"Main Sell",MAGIC,0,Red);
             
            }
          
     
   
     }