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
Here is the code attached!
For me, this code fails validation before the test on M1 is run.
Osmar Sandoval Espinosa #:
Here is the code attached!
There are two potential causes of the invalid stops error visible to the naked eye:
You should learn how to properly normalize the price and how to check the stop level before placing a SL/TP.
[edit] By stop level I mean SYMBOL_TRADE_STOPS_LEVEL
There are two potential causes of the invalid stops error visible to the naked eye:
- You do not normalize the price of SL/TP.
- You don't check the stop level.
You should learn how to properly normalize the price and how to check the stop level before placing a SL/TP.This version should have those corrections:
This version should have those corrections:
There is still no SYMBOL_TRADE_STOPS_LEVEL check and you should normalize the tp variable.
Furthermore, NormalizeDouble isn't the best way to normalize prices. Although it might even be sufficient for the validator (I haven't tested it), if you're committed to writing robust code, see the post below.
Forum on trading, automated trading systems and testing trading strategies
How To Manage 0.5 or 0.05 Price Steps (Tick Value, Tick Size) in order to avoid Error 130
Fernando Carreiro, 2018.01.04 12:13
You must NOT use NormalizeDouble(). You must use the Tick-Size to correctly set the price values. This has been discussed on the forum many times, so do a search but the most common post you will see goes something like this ...
In essence, make sure that your price quotes, are properly aligned to the Tick size (see following examples).
You may also benefit from reading this: https://www.mql5.com/en/forum/223705#comment_6279080