WIN$20 has a tick size of 5, you need to normalize all your prices according to it. Market price is moving by step of 5 so prices like 97216 or 97217 are
invalid.
Lot size must also be adjusted to a multiple of LotStep and check against min and max.
If that is not a power of 1/10 then NormalizeDouble is wrong. Do
it right.
Lot size must also be adjusted to a multiple of LotStep and check against min and max.
If that is not a power of 1/10 then NormalizeDouble is wrong. Do
it right.
Thank you guys for the help!! I came with a similar solution to NormalizeDouble but
loved to read about what William
Roeder wrote and understand a bit more of the problem we are facing here..
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Of course it is market info and i am the Who advised you to use it.
OK, this is really strange!!!
When i try to move my stop 50 points down, to 97250, I receive:
When i try to move my stop 83 points down, to 97217, I receive:
When i try to move my stop 84 points down, to 96216
When i try to move my stop 85 points down, to 97215 I receive:
When i try to move my stop 100 points down, to 97200 I receive:
All of this happens in the same candle at the same time. the code is:
And the same occurs if i just input the price in PositionModify function.
edit:It seems that If the price of SL is multiple of 5, PositionModify works very well
WIN$20 has a tick size of 5, you need to normalize all your prices according to it. Market price is moving by step of 5 so prices like 97216 or 97217 are invalid.
Forum on trading, automated trading systems and testing trading strategies
Need help to round order last digit to 0 or 5
Alain Verleyen, 2016.10.23 18:47
Normalize your price like that :
//| Normalize price according to tick size |
//+------------------------------------------------------------------+
double normalizePrice(double price)
{
double tickSize=SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_SIZE);
return(MathRound(price/tickSize)*tickSize);
}
Double-precision floating-point format - Wikipedia, the free encyclopedia
See also The == operand. - MQL4 programming forum
MT4:NormalizeDouble - MQL5 programming forum
How to Normalize - Expert Advisors and Automated Trading - MQL5 programming forum
What is a TICK? - MQL4 programming forum
NormalizeDouble, It's use is usually wrong, as it is might be in your case.
Double-precision floating-point format - Wikipedia, the free encyclopedia
See also The == operand. - MQL4 programming forum
MT4:NormalizeDouble - MQL5 programming forum
How to Normalize - Expert Advisors and Automated Trading - MQL5 programming forum
What is a TICK? - MQL4 programming forum
You come late
and he didn't even use NormalizeDouble().
You come late
and he didn't even use NormalizeDouble().
Thank you guys for the help!!
I came with a similar solution to NormalizeDouble but loved to read about what William Roeder wrote and understand a bit more of the problem we are facing here..
Really really thank you everyone!
See ya!