Congrats for the article!
It's plain and simple for beginners! Just right to the point.
Thanks for your comment. I will look into your suggestion and if any update to the codes are necessary, it will be made available soon.
why output error code :10030 ?
help, Is anybody here ？
First of all thanks for the article, It's helping me with getting started on mql5 programming.
I've tried your code and there's a bit of code on the OnInit() that I don't understand the purpose of it:
//--- Let us handle currency pairs with 5 or 3 digit prices instead of 4
STP = StopLoss;
TKP = TakeProfit;
if(_Digits==5 || _Digits==3)
STP = STP*10;
TKP = TKP*10;
This part modifies the values of take profit and stop loss pibs causing a difference between your input values and the ones really being used.
However, if I remove the two lines inside the if, then I often receive error 10016 (invalid stops) when sending the order to the server. The first attempt to place an order goes well and I get the 10009, but then most of the following times I get a 10016. I've debugged the EA, and all stop loses and take profits seem to be alright with the difference of being stop loss 30 or 300 and take profit 100 or 1000 pibs above or below the current price.
I cannot find the reason why the server gives me an error 10016 when the STP and TKP are not multiplied by 10.
Anyone can explain me why the error happens or the purpose of multiplying by 10 when _Digits are 5 or 3?
Thanks for your help.
Can you let us know how you get the error?
First from your explanation, when you removed those lines of code, you get an error and when you did not multiply the stoploss/takeprofit values by 10, you get an error? This I believe has explained that those lines of code are very important.
Back to the article, it explained those lines of code are necessary if you are using a chart with 5 decimal digits (0.XXXXX) or 3 decimal digits (0.XXX) currency pairs.
So here we want to make sure that our EA works very well with all brokers. Digits or Digits() returns the number of decimal digits determining the accuracy of price of the current chart symbol. For a 5-digit or 3-digit price chart, we multiply both the Stop Loss and the Take Profit by 10.
See examples below:
5 - Decimal Digits price
3 - Decimal Digits price
I hope this has answered your question.
step 1: download your this sample code.
step 2: compile it in mql5 .
step 3:in mt5,open chart eurusd 1m, then ,click "auto trading"
step 4:set break symbol in code line 223,224 etc...
step 5:click start debugging button in mt5, then,show this error.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.