Well, you could add a Print("sar= ", sar, " OrderSL=", OrderStopLoss); inside your loop to see which values are there. You might also want to check the result code for OrderModify() to see if that says anything meaningful.
Markus
Thanks Markus, just tried Print and both seem to equal each other. That is why I added DoubleToStr(sar,4); to make sure both were 4 decimal places...
I have tried many different combo's for the OrderModify() code but this one has really got me stumped.
Try printing
OrderStopLoss()-sar
inside the if command and check what you get there.
Or use MathRound() on the result (difference).
Markus
OrderStopLoss()-sar
inside the if command and check what you get there.
Or use MathRound() on the result (difference).
Markus
Try printing
OrderStopLoss()-sar
inside the if command and check what you get there.
Or use MathRound() on the result (difference).
Markus
Thank again Markus but still no good, talk about doing my head in
If someone from MT could just test this code and tell me if it is a bug or not would be a great help..
Thanks :)
Checking decimal values for equality is sometimes troublesome on all languages, so I'm not sure if they will be able to fix it.
Last try as a workaround.
Last try as a workaround.
If (MathAbs(OrderStopLoss()-sar)>Point) { Print("Modifying SL from ", OrderStopLoss(), " to ", sar); }
Make sure to check the print output.
Cheers
Markus
Thanks Markus but it prints nothing to the experts journal thus I am asuming that there is no difference between the two. AHHHHHHHHHHHH.
I just wish I knew weather it was a bug or in the code, all my other experts with trailing stops work fine....
Anyway thanks again and gt.........
I just wish I knew weather it was a bug or in the code, all my other experts with trailing stops work fine....
Anyway thanks again and gt.........
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
Below is a code for a basic SAR indicator expert.
It works perfectly except it continually tries to modify the trailing stop after it has already been modified.
Here is what it looks like in my journal
2005.10.18 15:27:43 '130470': modify order #2204816 sell 10.40 EURUSD at 1.1994 sl: 1.2052 tp: 0.0000 -> sl: 1.2052 tp: 0.0000
2005.10.18 15:27:43 '130470': modify order #2204816 sell 10.40 EURUSD at 1.1994 sl: 1.2052 tp: 0.0000 -> sl: 1.2052 tp: 0.0000
2005.10.18 15:27:39 '130470': modify order #2204816 sell 10.40 EURUSD at 1.1994 sl: 1.2052 tp: 0.0000 -> sl: 1.2052 tp: 0.0000
2005.10.18 15:27:39 '130470': modify order #2204816 sell 10.40 EURUSD at 1.1994 sl: 1.2052 tp: 0.0000 -> sl: 1.2052 tp: 0.0000
2005.10.18 15:27:39 '130470': modify order #2204816 sell 10.40 EURUSD at 1.1994 sl: 1.2052 tp: 0.0000 -> sl: 1.2052 tp: 0.0000
2005.10.18 15:27:38 '130470': modify order #2204816 sell 10.40 EURUSD at 1.1994 sl: 1.2052 tp: 0.0000 -> sl: 1.2052 tp: 0.0000
2005.10.18 15:27:28 '130470': modify order #2204816 sell 10.40 EURUSD at 1.1994 sl: 1.2052 tp: 0.0000 -> sl: 1.2052 tp: 0.0000
2005.10.18 15:27:27 '130470': modify order #2204816 sell 10.40 EURUSD at 1.1994 sl: 1.2052 tp: 0.0000 -> sl: 1.2052 tp: 0.0000
and so on.....................
I can live with this but it uses mega memory, the meter in the botttom right corner of mt ticks over faster than most crosses do...
Any help appreciated.......