Please edit your post and use the code button (Alt+S) when pasting code.
EDIT your original post, please do not just post the code correctly in a new post.
And I find an important thing - when I do back test, this EA was working right!
In back test, this EA executed well according to its code - open positions when MA20 upcrosses MA35 and close positions when MA20 downcross MA35.
But when I put this EA into my demo account to do real data demo trading, this EA did odd.
Who can tell me why?

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
Today my first EA sent its first order, which was at the place of the blue arrow, Buy order EURUSD @1.08420.
What I confused is, why my EA sent this two order?
The design logic of this EA is, when MA35 crossed MA20, the buy order can be send.
But as I can see from picture, there is no any MA cross happened near EURUSD1.08420 in period_M5 time_frame chart.
Who can help me to tell me why the system post the buy order?
By the way, the red arrow is set by myself. I finally closed these two odd positions manually.