Help with a Loop
hej guys ,,i need little help with my EA
the idea is to open a new order when an exciting order hits TP
so my question is : what kind of parameters should i fill in the "for loop " so it will do the job ,,thanks in advance
Documentation
Book & Tutorial
Suggestion
If you want a new ticket to be opened when the previous is closed via the takeprofit, then you will need to reference the trade history and evaluate why the ticket closed.
Take a look at the OrderSelect() and MODE_HISTORY. The following page provides an example of how to properly select tickets.
https://docs.mql4.com/trading/orderselect
- Jack
- docs.mql4.com
If order B hits its Take Profit, then it will no longer appear in the list of open orders (MODE_TRADES), but in the list of historical orders (closed) (MODE_HISTORY). For the loop you will have to use OrdersHistoryTotal () instead of OrdersTotal ().
On the other hand, you should not compare doubles in this way (if (tp == cl)), and also you have to take into account that the order will not always be closed at the exact price established in the Take Profit (if it is a buy order, it will be closed at that price or above and if it is a sell order it will be closed at that price or below).
You can start with this.
hej guys ,,i need little help with my EA
the idea is to open a new order when an exciting order hits TP
so my question is : what kind of parameters should i fill in the "for loop " so it will do the job ,,thanks in advance