MQL4 - automated forex trading   /  

Forum

How to code to open 10 possitions

Back to topics list To post a new topic, please log in or register

avatar
16
Vendetta 2010.08.24 10:02 

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

Secrets of MetaTrader 4 Client Terminal

Secrets of MetaTrader 4 Client Terminal

21 way to ease the life: Latent features in MetaTrader 4 Client Terminal. Full screen; hot keys; Fast Navigation bar; minimizing windows; favorites; traffic reduction; disabling of news; symbol sets; Market Watch; templates for testing and independent charts; profiles; crosshair; electronic ruler; barwise chart paging; account history in the chart; types of pending orders; modifying of StopLoss and TakeProfit; undo deletion; chart print.


avatar
2646
phy 2010.08.24 10:42 

Use OrderSend() ten times.


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

avatar
2646
phy 2010.08.24 11:04 

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


avatar
16
Vendetta 2010.08.24 11:26 
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
Attached files:
  Vendetta_mod.mq4 (4.07 KB)

avatar
335
hansH 2010.08.24 17:43 
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.

Attached files:
  Vendetta_V1.mq4 (4.61 KB)

avatar
44
chrisbenjy 2010.08.24 18:59 

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


avatar
16
Vendetta 2010.08.24 23:21 
Thx all of you guys,... i have learned again sth new new. Thx a lot ... V

avatar
16
Vendetta 2010.08.24 23:55 
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
Back to topics list  

To add comments, please log in or register