How to code to open 10 possitions

 

Maybe it is too much primitive but can somebody help me to code,.. how to open 10 positions in expert advisor in one direction with just one signal ?


thx a lot ......V

 

Use OrderSend() ten times.

 
sry to ask such stupidity but you meat 10x the same function ? or just OrderSend(10),... ? thx a lot ...V
 

Execute the command OrderSend() with appropriate parameters one time for each position you want to create.

 
Im writing an expert advisor and i need it for correct functioning,... the code is not complete yet but i hope i will finish it with other functions,... pls will you be so kind and show me how to do that ? Im just a beginner and im coding 2 weeks,... Thank you very much for your help,... V
Files:
 
Vendetta:
Im writing an expert advisor and i need it for correct functioning,... the code is not complete yet but i hope i will finish it with other functions,... pls will you be so kind and show me how to do that ? Im just a beginner and im coding 2 weeks,... Thank you very much for your help,... V

in your EA are some standard errors, which I have marked / / *****

---------------

best regards.

Files:
 

if you disregard the ticket number of each order and all the parameters are the same then just use a for loop with an order send function inside. I am sure if you are coding in MQL that you will know what a for loop is, but for other peoples reference I will show an example:

for(int i=0; i<10; i++)
{
   int ticket = 0;
   ticket = OrderSend(Your parameters); //Change these to your parameters
   
   if(ticket<0)
   {
      Print("OrderSend failed with error #",GetLastError()); 
   }
}

Obviously, the above is very basic. If you plan to take your EA live then you need sufficient error handling.

If you work using ticket numbers like I do after following the advice that Derk Wheler gave in the comments of his LibOrderReliable library file, then it will be easier to just use order send 10 times and store the ticket number of each as a variable.

Chris

 
Thx all of you guys,... i have learned again sth new new. Thx a lot ... V
 
Another rebus for me,... (not for you ) is how to code these beast to open positions after 5 ticks,... thx a lot for help ...V
Reason: