double PreviousFast = iMA(NULL,0,FastMA,0,0,0,1); double CurrentFast = iMA(NULL,0,FastMA,0,0,0,0); double PreviousSlow = iMA(NULL,0,SlowMA,0,0,0,1); double CurrentSlow = iMA(NULL,0,SlowMA,0,0,0,0);
You are looking at the forming candle, you will get multiple crosses as price fluxuates during the day. Look for the cross at end of the day.if(PreviousFast>PreviousSlow && CurrentFast<CurrentSlow && OrdersTotal()==0){
Using OrdersTotal directly and/or no Magic number filtering on your OrderSelect loop means your code is incompatible with every EA (including itself on other charts and manual trading.)
Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 and MetaTrader 4 - MQL4 programming forum
whroeder1:
- You are looking at the forming candle, you will get multiple crosses as price fluxuates during the day. Look for the cross at end of the day.
- Using OrdersTotal directly and/or no Magic number filtering on your OrderSelect loop means your code is incompatible with every EA (including itself on other charts and manual trading.)
Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 and MetaTrader 4 - MQL4 programming forum
1. Yes, I wanted to enter immediately as the ma crosses the price at the forming candle. To avoid getting multiple crosses, I limited the orders to be sent only once per candle. I did not intend to wait for the end of the day. Is it possible to do it this way and still prevent getting entered wrong sell positions?
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
Although it does it sometimes, it also enters positions where price is crossing 14 days MA from below.
Do you know what is wrong with it and how to fix it?