Amin0xy:
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
MQL4 Reference
- docs.mql4.com
MetaQuotes Language 4 (MQL4) is a built-in language for programming trading strategies. This language is developed by MetaQuotes Software Corp. based on their long experience in the creation of online trading platforms. Using this language, you can create your own Expert Advisors that make trading management automated and are perfectly suitable...
The problem is not in the loop.
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.
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.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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