Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 832
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
This is because the Expert Advisor does not "drop" a fractional part before calculation, while the calculator "drops" everything exceeding its "solvability" by the total number of digits.
It does not matter how many digits after decimal point (by the way 16, more than enough for most problems outside of nuclear physics or quantum mechanics), it does not matter their meaning, after trimming whole part will be the same. And then the differences begin.
Yes, by the way, in some test runs initial lot values are correct - both in the calculator and in the Expert Advisor 0.04. But sometimes the Expert Advisor gives 0.05, although during the test it shows 0.04. Although initial funds are always 1000.
PS: the question is removed, I have set MarginRequired in lot calculation, check calculation has the same result as EA.
Can you create buttons on the chart? I want a closing cross to be dangling beside the price line
By the way, no matter how many digits after the decimal point (by the way 16, more than enough for most problems outside of nuclear physics or quantum mechanics), no matter their value, after trimming integer part will be the same. And then the differences begin.
Yes, by the way, in some test runs initial lot values are correct - both in the calculator and in the Expert Advisor 0.04. But sometimes the Expert Advisor gives 0.05, although during the test it shows 0.04. Although initial funds are always 1000.
PS: the question is removed, I have set MarginRequired in lot calculation, check calculation has the same result as EA.
It makes sense, because the calculator calculates step by step, so there are more "tilts" than the EA uses a formula!
the script is not suitable for the task of closing an order at the right price as quickly as possible.
And the councillor is not counting step by step, then? Are you sure?
The price may change before the script is called.
If a few pips are critical, it's time to rethink the strategy and switch from pipsing to normal trading.
Pips are effective only when automated, and it is very desirable to have a ping to the server of less than 1 ms and execution on demand.
What do you mean "not stepwise"? It calculates stepwise, but "discards" unnecessary things only at the end of the calculation chain, normalizing it according to given Digits()! Therefore, it has much less loss in accuracy than the calculator!
Boris, I'm surprised at you. It's not the normalization by Digits, it's the MathFloor and exactly when the calculator does (the calculator allows the whole equation to be entered, although it solves it step by step).
Expert Advisor: lots=MathFloor(AccountFreeMargin()*rsk*0.01/margin/lotstep)*lotstep=MathFloor(1000*1*0.01/275.88/0.01)*0.01=0.03 - as you see, there is no "normalization"
Calculator: Trunc(1000*0.01/275.88/0.01)*0.01=0.03 - just like that
The question is closed, the Expert Advisor calculates correctly, I checked it and pasted a wrong value of margin and got a wrong result.