
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
Rounding can be wrong if the number to be rounded is tailed, in this case you should normalize to the right accuracy before rounding.
I'm sure normalisation is necessary, who's to say I haven't done it :-)
And, of course, the data was tailed, so Mathfloor was "going the wrong way".
I'm sure normalisation is necessary, who's to say I haven't done it :-)
And, of course, the data was tailed, so Mathfloor was "going the wrong way".
your code has no normalization before rounding)
It's there everywhere, but at the end you round off an un-normalized number.
you have no normalisation before rounding)
There is everywhere, but at the end you' re rounding an un-normalized number.
I tried hundreds of variants of the code, I threw one of the variants here, but as it turned out, the problem was not in the rounding - but in the output of data in the print and comment.
It's understandable that normalisation is necessary.
Normalize is an expensive operation and for this task NormalizeDouble and MathFloor are not needed at all.
are needed, and I think a recommendation for MathFloor and MathCeil should be added to the Handbook - "recommend normalising values before performing rounding".
ps. I came across this feature once myself.
are needed, and I think a recommendation for MathFloor and MathCeil should be added to the Handbook - "recommend normalising values before performing rounding".
ps. I came across this feature myself once.
I stumbled upon it long time ago.
But even normalization does not give the result you expect.
Forum on trading, automated trading systems and trading strategy testing
Double vs FLOAT - unclear MathFloor error
fxsaber, 2017.02.26 08:53
int DoubleToInt( const double Num )
{
return((int)(Num + ALPHA));
}
void OnStart()
{
double NewPrice = DoubleToInt((Ask + Bid) / (2 * Point)) * Point;
Print(NewPrice);
}
Then why does it work without normalisation and MathFloor?
After all, I used MathFloor for exactly that.
Does it meet the requirement that if the spread is odd, the price should be closer to the bid?