how to set ea to open multiple orders at once and allow open another order again when condition meet again even though the previous order still open on the same pair

 

hi all,

i am newbie here and also not really good in programming but i have developed an ea using free online ea generator. the ea work well and meet my expectation in term of opening buy and sell entries based on my condition. however i figured it out that the ea will open only one order at one time per pair when condition meet either buy or sell and it will not open another order again even though condition is meet until the previous order is closed. 

i need help or guide on modifying the ea so that it can:

  1. open 5 orders at once when condition is met either buy or sell.
  2. open another 5 orders when the next condition is met again regardless buy or sell on the same pair (since my broker allow hedging)
  3. keep opening 5 orders  at once every time condition is meet again regardless buy or sell or the previous order has been closed or still open.

 attached is my ea file.

Files:
RSI_EA.mq4  5 kb
 
Hello norazira ...

Please try my modified code ... It is not tested ... if there are any problems, just let me know ...

What I did ...

- Repeated the OrderSend( ) 5 times (once condition is met) ...

- I added 2 check functions for both Buy and Sell orders on same opened bar ... so, max possible orders to open on any bar are (5 + 5) ... ExistPositionsBuy( ) and  ExistPositionsSell( ) ...

- Removed all possible compiler warnings ...

- Removed TotalOrdersCount( ) as it is not needed any more ...

- Added EA_Name in the EA external settings to make it possible to name the EA in the Comments column the name you want ...

Please let me know how things went with you ...

Best wishes ...

O. Shaban
Files:
RSI_EA.mq4  8 kb
 
Osama Shaban:
Hello norazira ...

Please try my modified code ... It is not tested ... if there are any problems, just let me know ...

What I did ...

- Repeated the OrderSend( ) 5 times (once condition is met) ...

- I added 2 check functions for both Buy and Sell orders on same opened bar ... so, max possible orders to open on any bar are (5 + 5) ... ExistPositionsBuy( ) and  ExistPositionsSell( ) ...

- Removed all possible compiler warnings ...

- Removed TotalOrdersCount( ) as it is not needed any more ...

- Added EA_Name in the EA external settings to make it possible to name the EA in the Comments column the name you want ...

Please let me know how things went with you ...

Best wishes ...

O. Shaban


thanks o. shaban,

appreciate your time and assistance. let me try it and let you know the outcome.

 
norazira:


thanks o. shaban,

appreciate your time and assistance. let me try it and let you know the outcome.

hi o. shaban,

i just tried it out but it did not open any order due to OrderSend error 131.

could help to check on this.

thanks again.

Reason: