
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
In the OP's code
you could simply change it to something like
if you are trying to replicate the error
I hear you. I was asking for more code simply because he says " The code works absolutely fine and does its job of break even at the correct point " so I was curious if he get's the errors before or after the OrderModify was successful .
I hear you. I was asking for more code simply because he says " The code works absolutely fine and does its job of break even at the correct point " so I was curious if he get's the errors before or after the OrderModify was successful .
I had a similar problem and the first OrderModify worked fine, subsequent OrderModifies were called because of the failure of comparing 2 doubles.
I started this thread
https://forum.mql4.com/56943
when I was just starting to learn to code.
It's beyond me why prices aren't automatically normalised to Digits, but they obviously aren't.
I had a similar problem and the first OrderModify worked fine, subsequent OrderModifies were called because of the failure of comparing 2 doubles.
I started this thread
https://forum.mql4.com/56943
when I was just starting to learn to code.
It's beyond me why prices aren't automatically normalised to Digits, but they obviously aren't.
Bits me too, but they do mention the need to normalize calculated stops.
Does it get done automatically in mt5?
Bits me too, but they do mention the need to normalize calculated stops.
Does it get done automatically in mt5?
Fot those that think that the OrderOpenPrice should already be a normalised double
Put this in a script
ALL the trades were placed using Ask or Bid
The result from the above script
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51606602 GBPUSDm 1.6686300000000002
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51606532 GBPUSDm 1.6684500000000000
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51584597 GBPJPYm 170.3480000000000132
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51582545 EURUSDm 1.3729800000000001
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51582536 EURUSDm 1.3729800000000001
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51579753 GBPUSDm 1.6668800000000000
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51579209 GBPJPYm 170.3480000000000132
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51578931 GBPJPYm 170.3009999999999877
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51578298 GBPJPYm 170.3750000000000000
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51575675 GBPUSDm 1.6463400000000000
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51575673 GBPUSDm 1.6478400000000000
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51575671 GBPUSDm 1.6493400000000000
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51575670 GBPUSDm 1.6508400000000002
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51575669 GBPUSDm 1.6523400000000000
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51575668 GBPUSDm 1.6538400000000000
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51575665 GBPUSDm 1.6553400000000000
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51575662 GBPUSDm 1.6568400000000002
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51575660 GBPUSDm 1.6583400000000000
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51575659 GBPUSDm 1.6598400000000000
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51575657 GBPUSDm 1.6613400000000000
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51575656 GBPUSDm 1.6628400000000002
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51575655 GBPUSDm 1.6643400000000000
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51575131 GBPUSDm 1.6658400000000000
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51491427 GBPJPYm 169.9809999999999946
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51482028 XAUUSDm 1339.8089999999999692
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51481726 GBPJPYm 169.9809999999999946
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51481205 GBPJPYm 169.8350000000000080
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51478860 GBPJPYm 170.1320000000000050
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51474409 GBPJPYm 169.9470000000000028
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51472676 GBPJPYm 169.9470000000000028
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51457057 XAUUSDm 1339.8089999999999692
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51457055 GBPJPYm 169.7709999999999866
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51424359 GBPJPYm 169.5730000000000076
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51424350 GBPJPYm 169.5970000000000084
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51423533 GBPJPYm 169.5490000000000066
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51421850 GBPJPYm 169.5869999999999892
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51421774 GBPJPYm 169.5459999999999924
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51421734 GBPJPYm 169.5800000000000126
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51421471 GBPJPYm 169.5459999999999924
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51420693 GBPJPYm 169.5749999999999886
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51420280 GBPJPYm 169.5060000000000002
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51419784 GBPJPYm 169.6109999999999900
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51415332 GBPJPYm 169.4329999999999927
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51401644 GBPJPYm 169.4900000000000092
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51398071 GBPJPYm 169.4900000000000092
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51378377 GBPJPYm 169.4900000000000092
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51377134 GBPJPYm 169.6140000000000044
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51357246 GBPJPYm 169.7810000000000060
Fot those that think that the OrderOpenPrice should already be a normalised double
What is a "normalised double" ?
Can you try this on your data for comparison . . .
Fot those that think that the OrderOpenPrice should already be a normalised double
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51606602 GBPUSDm 1.6686300000000002
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51606532 GBPUSDm 1.6684500000000000
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51584597 GBPJPYm 170.3480000000000132
19:14:43 OrderOpenPriceTest GBPUSDm,H1: 51582545 EURUSDm 1.3729800000000001
Fot those that think that the OrderOpenPrice should already be a normalised double
Put this in a script
ALL the trades were placed using Ask or Bid
...What is a "normalised double" ?
Can you try this on your data for comparison . . .
A double is always a double, normalized or not. It means that there is not necessarily an exact representation (power of 2) of the value.
However NormalizeDouble() function can be used to compare double. If we are talking about price there is no point to use 16 digits, but only _Digits :
Calculated values of StopLoss, TakeProfit, and values of open prices for pending orders must be normalized with the accuracy, the value of which can be obtained by Digits().
I made some tests :
Results (rounding change on 12th digit):
2014.03.05 15:07:58.104 _quick_tests_ EURUSD,M5: Normalized value1=1.37586000 Normalized value 2=1.37586000
2014.03.05 15:07:58.104 _quick_tests_ EURUSD,M5: Normalized value1= Normalized value ? true
2014.03.05 15:07:58.104 _quick_tests_ EURUSD,M5: value1=1.3758649999980000 value2=1.3758549999990000
2014.03.05 15:07:58.104 _quick_tests_ EURUSD,M5: value1=value ? false
Sure, it can. But then
Sure, it can, but I recommend never use it for any reason.
Sure, it can. But then
Sure, it can, but I recommend never use it for any reason.
Yes I know your recommendation, that makes sense. But if people knows and understands the limitations, it can be used.
About your point 4, do you check it effectively ? Just curious.