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

To add comments, please log in or register
Abdul Salam
2906
Abdul Salam  

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

means buy eurusd lot 0.01 ten times at same time

Icham Aidibe
11287
Icham Aidibe  
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++; }
Abdul Salam
2906
Abdul Salam  
Icham Aidibe:

ok thanks

nicholi shen
1874
nicholi shen  
Buy("EURUSD",0.01) * 10;
Abdul Salam
2906
Abdul Salam  
nicholi shen:

that's also correct 

Satyajaya
5
Satyajaya  

Hi,

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

Icham Aidibe
11287
Icham Aidibe  
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. 

Abdul Salam
2906
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++;

Icham Aidibe
11287
Icham Aidibe  
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
Abdul Salam
2906
Abdul Salam  
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

Matthew Colter
1274
Matthew Colter  
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.
}

12
To add comments, please log in or register