SYMBOL_TRADE_TICK_VALUE returns 0.0 on first run, then the correct value on next run
This is absolutely normal. The advisor must handle SymbolInfoDouble errors and not trade if SymbolInfoDouble fails. In the case of a script, just run it again.
I'm using a script I found here to calculate volume for my trades and it works great on the second run, but always fails on the first run.
On the first run of this script after I open MT5, the Print statement shows this:
FN_BUY_STOP (XAUUSD.a,H4) tick_size : 0.01 tick_value: 0.0 volume_step: 0.01 SL Dist: 8.769999999999527 money step: 0.0
Which returns an invalid number of Lots
But the second time I run it it shows the actual values.
FN_BUY_STOP (XAUUSD.a,H4) tick_size : 0.01 tick_value: 1.5056839569374387 volume_step: 0.01 SL Dist: 8.769999999999527 money step: 13.204848302340627
I can't work out what's wrong with this code.