MQL4 - automated forex trading   /  

Forum

Multiple pending orders

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

avatar
6
zoubeir 2006.07.14 20:28 
I WANT TO WRITE AN EA that will place 5 buy pending orders above the present price at 5 pips interval and 5 sell orders at same interval below the present price. Anyone can help with the code please.
Tester in the Terminal MetaTrader 4: It Should Be Known

Tester in the Terminal MetaTrader 4: It Should Be Known

The elaborate interface of the terminal MetaTrader 4 is a forefront, but beside this the terminal includes a deep-laid tester of strategies. And while the worth of MetaTrader 4 as a trading terminal is obvious, the quality of the tester's strategy testing can be assessed only in practice. This article shows the advantages and conveniences of testing in MetaTrader 4.


avatar
1272
RickD 2006.07.22 00:44 
double price, sl, tp;
 
price = Ask + 5*Point;
sl = ...
tp = ...
 
OrderSend(Symbol(), OP_BUYSTOP, ...
 
price = Ask + 10*Point;
sl = ...
tp = ...
 
OrderSend(Symbol(), OP_BUYSTOP, ...
 
...



avatar
17
Maratha 2006.07.24 01:18 
I guess, the regular EA template should do this...when you say 5 orders, would they have different S/L and profit targets? 'Cause if not, then you can just change the number of lots instead..

But, if you want to have multiple orders...then in the EA, change the line that checks for openorders...

total=OrdersTotal();
   if(total<1)
Change 1 to 10 or whatever number of orders you wish to open...

avatar
6
zoubeir 2006.07.25 18:08 
RICKD and MarathaThanks you very much for your answers, i have implemented this and it is working. Now, if one of the orders is opened it has to cancel others in the opposite directions. For example if the first buy order is open , then all sell orders must be cancelled. Please tell me how to do that please.
Back to topics list  

To add comments, please log in or register