Please edit your post.
![](https://c.mql5.com/mql4/forum/2013/05/mql4_src_button_mql4__2_1.gif)
agulerer:
Do what you said you want, buy when the MA's cross. Currently you're buying when ma(5)>ma(12)
I am new to using mql and I am using generator to create codes. I want to open position when MA Exp. 5 crosses up MA Exp. 12 = BUY , MA Exp. 5 crosses down MA Exp. 12 = SELL. But the problem is, I want to open only one position but when I check ea, it seems that when position closes, ea opens position agian because MA Exp. 5 value is more than MA Exp. 12 or less. How can I solve this problem?
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
I am new to using mql and I am using generator to create codes. I want to open position when MA Exp. 5 crosses up MA Exp. 12 = BUY , MA Exp. 5 crosses down MA Exp. 12 = SELL. But the problem is, I want to open only one position but when I check ea, it seems that when position closes, ea opens position agian because MA Exp. 5 value is more than MA Exp. 12 or less. How can I solve this problem?
extern int MagicNumber=10001;