Download MetaTrader 5
To add comments, please log in or register
Having difficulties in understanding the Trading Signals service? Read the article!
Tsering Dawa Lama
260
Tsering Dawa Lama 2014.10.17 11:39 

Hello dear Coders,

could you please confirm whether or not the following code, which i conceived in the night in bed, will extract the pair, which is not from the chart where this EA is placed but has the same magic number as the pair of the chart? bc_cnt and sc_cnt are the buy and sell counts of the two pairs of the same magic number. b2_lot and s2_lot are the total buy lots and sell lots. Will the code send the trades successfully? I tried it in demo but haven't seen the counter trades till now. so i ask for your opinion and help. thanks

    for(i=0; i<OrdersTotal(); i++)
     {
      double symbola;
      if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue;
      if(OrderMagicNumber()!=magic) continue;
      if(bc_cnt>0 && sc_cnt>0) break;
      if(OrderSymbol()!=Symbol()) symbola=OrderSymbol(); 
      if(bc_cnt>0 && sc_cnt==0)
        {
         if(iCustom(symbola,15,"SuperTrend",10,3.0,0,0)!=EMPTY_VALUE) 
         res=OrderSend(symbola,1,b2_lot,Bid,3,0,0,"L"+(s_cnt+1),magic,0,Red); 
            if(!res)
               Print("Error in OrderSend. Error code=",GetLastError());
            else
               Print("Order Sent successfully.");        
       break;
        }  
       if(sc_cnt>0 && bc_cnt==0)
        { 
        if(iCustom(symbola,15,"SuperTrend",10,3.0,1,0)!=EMPTY_VALUE) 
        res=OrderSend(symbola,0,s2_lot,Ask,3,0,0,"L"+(b_cnt+1),magic,0,Blue);
            if(!res)
               Print("Error in OrderSend. Error code=",GetLastError());
            else
               Print("Order Sent successfully.");       
       break; 
        }
      }
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.10.18 01:16  
You use an indicator which we don't have.
Ernst Van Der Merwe
4397
Ernst Van Der Merwe 2014.10.18 07:03  
tsedawa:

Hello dear Coders,

could you please confirm whether or not the following code, which i conceived in the night in bed, will extract the pair, which is not from the chart where this EA is placed but has the same magic number as the pair of the chart? bc_cnt and sc_cnt are the buy and sell counts of the two pairs of the same magic number. b2_lot and s2_lot are the total buy lots and sell lots. Will the code send the trades successfully? I tried it in demo but haven't seen the counter trades till now. so i ask for your opinion and help. thanks

double symbola;

should be

string symbola;

Tsering Dawa Lama
260
Tsering Dawa Lama 2014.10.18 10:00  
pipPod:

double symbola;

should be

string symbola;

Thank you very much pipPod. ofcourse its a string how stupid i am. i am not used to coding so silly mistakes. thanks again for pointing out the mistake. today and tomorrow market is closed so i will check on monday if it sends the right trade and i will post the result here. my ea is addapted from a martingale system. but i have incorporated many many new ideas to make it as safe as possible without compromising much on the profitability of a martingale system. the above code is my latest idea. hope it works.

thanks again. much appreciated.

/
To add comments, please log in or register