[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 1114
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
1. We need to remove &&OrderSymbol()==Symbol() from the code.
2. Need to normalise the bid and aska.
3. It's better not to set the slippage at 10 points, but calculate it dynamically. For example, if an order for gold and this instrument transits 50 points per tick, then 10 points of slippage will cause requotes. Therefore it's better to calculate the minimum tick size and multiply it by this 10.
4. You must insert error handling into your code. Otherwise, in case of a failure you will not understand the reasons why orders were not closed.
1. You should remove &&OrderSymbol()==Symbol() from the code
2. Need to normalise the bid and ask.
3. Slippage is better to calculate dynamically rather than 10 pips. For example, if an order on gold and this instrument moves 50 points per tick, then 10 points of slippage will cause you a lot of requotes. Therefore it's better to calculate the minimum tick size and multiply it by this 10.
4. You must insert error handling into your code. Otherwise, in the case of a failure you will not understand the reasons why orders have not closed
Thank you very much, I will try it in the tester, but about the modification of orders do you have any advice?
Where does return send to?
Clearly, to line 0 and wait for a tick
it's clear here too - stop
And here?
The value of the number of orders is ko, so should the next function be written using ko? What does return do here?return() does not send anyone anywhere.
The return operator terminates the current function and returns control to the calling program. The use of return(expression); terminates the current function and sends the result. The operator expression is enclosed in parentheses and must not contain an assignment operator.
return() does not send anyone anywhere.
The return operator terminates the current function and returns control to the calling program. The use of return(expression); terminates the current function and sends the result. The operator expression is enclosed in parentheses and must not contain an assignment operator.
How, then, is it correct to stop the EA from working if the conditions are not met? Not to put it to sleep, but to stop it altogether.
What do you mean by "put it to sleep" and what do you mean by "stop"?
What do you mean by "put to sleep" and what do you mean by "stop"?
Put to sleep - put sleep, then it will try to start again.
Stop - completely, so that the Expert Advisor stops working (changes its "face").
For example, the Expert Advisor is under Eurobucks, but it was thrown on the EuroJPY. It checks the symbol and in case of a mismatch, it throws the alert and does not try to work anymore before the manual restart.
Put to sleep - put sleep, then it will try to start again.
Stop - completely, so that the Expert Advisor stops working (changes its "face").
For example, the Expert Advisor is under Eurobucks, but it was thrown on the EuroJPY. It checks the symbol and in case of a mismatch, it throws an alert and does not try to work again before the manual restart.
Why so complicated?
It's enough to provide condition handling in start() function
In this case, if you put the EA on the wrong instrument, you will be flooded with Alerts, until you disable it (the EA) yourselfYou can also add a siren sound, then you can turn it off for sure