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
Result:
Either I'm doing something wrong (please correct), or MetaDriver made a mistake in theory (when designing the algorithm).
:)
Well, considering the fact that algorithm "design" took about 3 minutes (and 7 minutes of implementation), I did pretty well :) The aim was to show working idea and to clarify the problem statement.
And all this turned out to be useful - the developers had a real opportunity to improve MathFloor() function - obviously it is not entirely cleanly implemented.
In the end they had to tinker with it. It was fun. I managed to get a stable function (I mean CountSignedDigits(double x)) only after almost an hour of experiments.
And even now I'm not sure it will work correctly with all the input values. I haven't developed an automated stress-test, I've made a manual one. Please test it.
I expect stable operation up to 10 decimal places after floating point.
Stress-test attached. // I did not remove some intermediate realizations from the code. I left it in comments for you to try/think. Including the developers.1. you don't need to define dig for a lot, just normalize it to the right step:
2. even if there is some rubbish in the lot variable when sending a trade request (in the decimal place), it should be discarded by the terminal itself.
At least, I haven't had any problems during several years of using such a construct.
4. If you want to insure, you can normalize it to 8 decimal places (with a margin) - if there's rubbish after "correct" normalization, it will be much farther.
The first idea is correct, the others are suspect. :)
The implementation is workable for practice, but for artificial conditions defined by "problem-starter" (c) is inaccurate. For discrete steps generates not relative to lot_min, but relative to zero. :)
However, it is easy to fix, if you notice it.
// Please do not take all these pearls too seriously. Clarifications are purely theoretical, for brain training, because in practice I've never seen lot_step equal to, say, 0.0231....
;)
variant is correct. Correctly accounted for by lot_min as in my NL().
My variant is also available. Note that for some instruments the price change step is larger than the point.
If we assume as an axiom that the steps "go" not from zero, but from the minimum lot, the correct algorithm is as follows:
In the Composter version, the steps "go" from zero. Which does not seem right to me.
In the MetaDriver variant, the code skips a negative value. =Р
...
In the MetaDriver variant, the code skips a negative value. =Р
:)) ..... Oh so! You won't work at all! ;-R ;-b ;-R
Well, if anything, the shortest and at the same time "sort of accurate" variant is this:
And that's without checking for nullity and negativity of lot_step, lot_min and lot_max!!......
:))))
Uh... hit a nerve. :)) The last line was hand-corrected in a forum post, so forgive me. =)
By the way, your code didn't compile either (I forgot to put a closing parenthesis in the last line). :-Р
Besides it's 2-3 times slower (now I've checked it on script), but quality of check is the same. :-Р
Anyway, as long as there's no proper code to determine the significant integer, I'll take Composter's advice: normalize volume to 8 decimal places.
Hopefully there will be no pitfalls.
Thank you all for your help.
you guys are funny I see.
in your first post gave NL() what you only got to two pages later ;)
There is another question for the gurus. When I test the multicurrency, I get errors (screenshot attached).
I am trying to make a trade operation, but I get an answer: No price. According to the tester it can be seen that quotes for this pair start coming in 2011.01.0301:00:00, while EURUSD is also quoted from 2011.01.0300:00:00 Is there any way to find out the time of the start of quotes to bypass this error?
There is another question for the gurus. When I test the multicurrency, I get errors (screenshot attached).
I am trying to make a trade operation, but I get an answer: No price. According to the tester it can be seen that quotes for this pair start coming in 2011.01.0301:00:00, while EURUSD is also quoted from 2011.01.0300:00:00Is there any way to find out the time of the start of quotes to avoid this error?