This is not enough code to understand your problem!
But I suggest you to use the example EA in your expert folder for: 1) when to open 2) when to close and 3) how to close your positions: Moving Average.mq4 and MACD Sample.mq4.
What extra code is necessary?
If there are no open positions, function goes to CheckForOpen, where it is looking for Overbought/Oversold RSI. If criterias matches, position is opened.
On next bar as the position is opened and CalculateCurrentOrders>0 function goes to Checkfor Close if it matches closing criterias. So the problem is how to have multiple opened positions( which are closed each separately if criteria of closing for them matches) and not only 1 at the time
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
So there is a problem. I open an order, and while order close parameters do not trigger, EA does not open another order. If i put orderclose lines in the same text as orderopen, i get all orders closed at the same date when back test ends. If i put more than 0 in calculate current orders function, then if there are only one order opened EA waits while another opens and then closes them together at the same point. How to avoid that and get proper orderclose function whenever it triggers and in the same time orderopen function works and looks for possible entry?
Thank you