工作已完成
指定
EA trades on Bollinger Bands, in general executing orders is fine. However, I need some optimization of my EA. Two request are adding code, while two requests are more reviewing the code.
1. Major Optimization: Close open and pending orders Symbol when hit TakeProfit
My EA will open one buy/sell order and 8 pending buylimit/selllimit at the same time when it opens. I want the EA to close the open orders and delete the pending orders of that particular symbol once one of the open order hit Takeprofit.
As described in below table when Order 4, (Buy order, 0.08 size) hit the TP it will close the two order buy orders and delete the BuyLimit pending orders. So only the Sell orders and SellLimit pending orders remain afterwards.
Open | |||||||
Order | Ordertype | lotsize | Symbol | Price | S/L | TP | Price (closed) |
1 | Buy | 0.02 | EURUSD | 1.1055 | 1.03 | 1.106 | Close |
2 | Sell | 0.02 | EURGBP | 1.3 | 1 | 1.31 | No change |
3 | Buy | 0.04 | EURUSD | 1.1054 | 1.03 | 1.1055 | Close |
4 | Buy | 0.08 | EURUSD | 1.1053 | 1.03 | 1.1054 | 1.1054 |
5 | Sell | 0.04 | EURGBP | 1.29 | 1 | 1.31 | No change |
Pending | |||||||
1 | BuyLimit | 0.16 | EURUSD | 1.28 | 1.03 | 1.1053 | Delete |
2 | BuyLimit | 0.32 | EURUSD | 1.27 | 1.03 | 1.1052 | Delete |
3 | BuyLimit | 0.64 | EURUSD | 1.26 | 1.03 | 1.1051 | Delete |
4 | BuyLimit | 1.28 | EURUSD | 1.25 | 1.03 | 1.105 | Delete |
5 | BuyLimit | 2.56 | EURUSD | 1.24 | 1.03 | 1.104 | Delete |
6 | BuyLimit | 5.12 | EURUSD | 1.23 | 1.03 | 1.103 | Delete |
7 | SellLimit | 0.08 | EURGBP | 1.28 | 1 | 1.31 | No change |
8 | SellLimit | 0.16 | EURGBP | 1.27 | 1 | 1.31 | No change |
9 | SellLimit | 0.32 | EURGBP | 1.26 | 1 | 1.31 | No change |
10 | SellLimit | 0.64 | EURGBP | 1.25 | 1 | 1.31 | No change |
11 | SellLimit | 1.28 | EURGBP | 1.24 | 1 | 1.31 | No change |
12 | SellLimit | 2.56 | EURGBP | 1.23 | 1 | 1.31 | No change |
13 | SellLimit | 5.12 | EURGBP | 1.22 | 1 | 1.31 | No change |
2. Check: Not all OrderSend are send to server
I encountered that in a few cases some of my predefined OrderSends are not triggered, a few times it was the 0.04 Lotsize. I cannot find the order back in the history or trade information.That could be fault of server or it could be that my code is written incorrectly. Please check the OrderSend for Buy and Sell.
3. Check: Sometimes buy/sell order are closed way too early
Sometimes my orders are triggered but after a few seconds it closes by itself again without hitting the TP or SL. I am not sure what triggered this.
4. Add: Maximum one set of buy/sell orders per bar chart
I want to limit the set of buy order/buylimits to one set per bar. Sometimes the orders are triggered again since my buy condition is still valid. This should be as well for the sell orders/sell limits
For your information; I included a file in the MQ4 but I believe I won't use it . Though I added in case you need it