Step by step tutorial for beginner EA for moving average and ADX indicator
I complete coding the step-by-steo EA of moving average for beginner (url:https://www.mql5.com/en/articles/100) and compiled, show Ok.
But when testing in on my Demo account, it inccurs following error. Please anyone can help.
The whole situation took place like below:
After using debug I found that when the code run up to the following place(line 261), it jumps to error line and showing the following error message.
"The Sell Order request could not be completed -error:4752." I would be much appreciated if anybody can help, thank.
My EA Error at Line 261 OrderSend(mrequest,mresult);
// get the result code
if(mresult.retcode==10009 || mresult.retcode==10008) //Request is completed or placed
Alert("A Sell Order has been successfully placed with Ticket#:",mresult.order,"!!");
Alert("The Sell Order request could not be completed -error:",GetLastError());
The Sell Order request could not be completed -error:4752, after checking the MQL5 Reference I notice that
4752 ERR_TRADE_DISABLED Wrong trade property ID and
4756 ERR_TRADE_SEND_FAILED Trade Request Sending Failed (sometime it shows error 4756)
When I rebug, Code run upto above area, it runs into "Alert("The Sell Order request could not be completed -error:",GetLastError());
and activate alert message "The Sell Order request could not be completed code 4756" (meaning 4756 ERR_TRADE_SEND_FAILED Trade Request Sending Failed
according to MQL5 Reference. Please help, thank.
Step-By-Step Guide to writing an Expert Advisor in MQL5 for Beginners
This article is aimed at beginners who wish to learn how to write simple Expert Advisors in the new MQL5 language. We will begin first by defining what we want our EA (Expert advisor) to do, and then move on to how we want the EA to do it. 1. Trading Strategy It will monitor a particular indicator, and when a certain condition is met (or...
- Discussion of article "Step-by-Step Guide to Writing an Expert Advisor in MQL5 for Beginners"
- TRADE_RETCODE_REJECT error by server
- Closing a position
You are missing trading opportunities:
- Free trading apps
- Free Forex VPS for 24 hours
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration Log in
If you do not have an account, please register