what is the function for (buy/sell) same pair multiple time

 

what is the function for (buy/sell) same pair multiple time 

means buy eurusd lot 0.01 ten times at same time

 
Abdul Salam:

what is the function for (buy/sell) same pair multiple time 

means buy eurusd lot 0.01 ten times at same time

int i=0; while(i<10) { Buy("EURUSD",0.01); i++; }
 
Icham Aidibe:

ok thanks

 
Buy("EURUSD",0.01) * 10;
 
nicholi shen:

that's also correct 

 

Hi,

Am new to trading systems. Can someone teach me how to add this function in mq15?

 
Abdul Salam:

that's also correct 

No it's not, this is :

Buy("EURUSD",0.01); Buy("EURUSD",0.01); Buy("EURUSD",0.01); Buy("EURUSD",0.01); Buy("EURUSD",0.01); 
Buy("EURUSD",0.01); Buy("EURUSD",0.01); Buy("EURUSD",0.01); Buy("EURUSD",0.01); Buy("EURUSD",0.01); 
Satyajaya:

Hi,

Am new to trading systems. Can someone teach me how to add this function in mq15?

Yes. Don't buy ten times 0.01 lots, buy directly 0.1, done once slippage is counted once. 

 

i have this code how can i change it such that it can buy/sell multiple trades at same time.

void OnTick(){

   orderNum=0; dir=0;

   for (int i=OrdersTotal()-1;i>-1;i--){

      if(OrderSelect(i,SELECT_BY_POS)==false)continue;

      if(OrderMagicNumber()!=BN||OrderSymbol()!=_Symbol)continue;

      if(OrderType()==0)dir=1;else dir=-1;

      orderNum++;

 
Abdul Salam:

i have this code how can i change it such that it can buy/sell multiple trades at same time.

void OnTick(){

   orderNum=0; dir=0;

   for (int i=OrdersTotal()-1;i>-1;i--){

      if(OrderSelect(i,SELECT_BY_POS)==false)continue;

      if(OrderMagicNumber()!=BN||OrderSymbol()!=_Symbol)continue;

      if(OrderType()==0)dir=1;else dir=-1;

      orderNum++;

It's not there it should be used, find the "OrderSend" in your code & copy paste the right function. Don't forget the ...

alt+s to paste code in
 
Icham Aidibe:

OrderSend(_Symbol,cmd,lot,pr,slip,SL,TP,comment,BN);

here cmd is used for buy/sell and pr for ask/bid and BN for magic number

what should i add in them such that it can buy/sell the pair more than one times

 
Abdul Salam:

OrderSend(_Symbol,cmd,lot,pr,slip,SL,TP,comment,BN);

here cmd is used for buy/sell and pr for ask/bid and BN for magic number

what should i add in them such that it can buy/sell the pair more than one times

Your previous code that starts with 

for (int i=OrdersTotal()-1;i>-1;i--){

That just loops through the orders you have open already.

The OrderSend function sends one order. If you want to send more than one order you will have to call it more than once. You can use a for loop to do that as well if you would like.

int howMany=10;

for(;howMany>0;howMany--)
{
    // put whatever you want to happen 10 times in here.
}

Reason: