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
I change the order condition
from
if(OrderStopLoss() < SupertrendUpTrend() && SupertrendDirection() == 1.0000)
to
now there's no error code 1 but it doesn't even do order modify at all
A simple check is
You can use point in this case as the symbol is the chart symbol. Otherwise you would need to get the point value for the symbol.
already adding the condition but still error occurred.
Show the code that you have used.
Show the code that you have used.
I don't know if it's going to be helpful or not but I put the code for buy and sell plus the indicator func. Error code 1 is no longer occurred but the stoploss won't modified. it still use the initial stoploss even though OrderStopLoss is less or has more value than the Supertrend line. I noticed that the supertrend indicator has only 4 digits after decimal and my broker is 5 digits after decimal, don't know if this is related or not.
A simple check is
You can use point in this case as the symbol is the chart symbol. Otherwise you would need to get the point value for the symbol.
Use Ticksize not point. Code fails on metals.
Use Ticksize not point. Code fails on metals.
I don't know if it's going to be helpful or not but I put the code for buy and sell plus the indicator func. Error code 1 is no longer occurred but the stoploss won't modified. it still use the initial stoploss even though OrderStopLoss is less or has more value than the Supertrend line. I noticed that the supertrend indicator has only 4 digits after decimal and my broker is 5 digits after decimal, don't know if this is related or not.
I have no idea what the highlighted text means!
First fix the obvious mistakes in your code.
You cannot get values for an order until the order has been selected.
You call the same function 3 times, it may be possible that the value is not the same for an indicator every call.
This way, you know that the value remains the same.
Why do you multiply by Point??
I have no idea what the highlighted text means!
it is for the structure of the code, maybe the problem is not on the code but on the structure of the code.
First fix the obvious mistakes in your code.
Before the lots variable there's an else statement. My EA works by selecting the magic number first rather than ticket number.
This way, you know that the value remains the same.
I put it under the if statement because I use the code for BUY and SELL trailing stop. I never know that there's a possibility that the value can change. I will put it before if statement and change the variable name respectively.
The indicator is 4 digits after decimal and my broker is 5 digits. Just thinking maybe that was the case with error 1 and order modify fail to modify at all. but I think that's not the case.
So I'm adding a print statement before and after if statement. If I use this code below
if(SupertrendDirection() == -1 && MathAbs(trailingStopSell-OrderStopLoss()>Point*0.5))
the print statement inside the if statement fail to be print. I don't know if this what WH Roeder mention by fail.
Meanwhile, if I use the code below. the error code 1 occur but never truly close the order when the price hit the indicator.
if(SupertrendDirection() == -1 && OrderStopLoss() != trailingStopSell;
Since the error 1 still occur but stoploss is changing, I try to let it run. I found out that even the stoploss is changing but there isn't any real stoploss, there is no stoploss line in backtesting visual mode. I never met with this kind of problem before.
The title of this thread is “How to avoid error 1 in order modify.” “The point of this was to compare whether the 2 numbers” were different enough to send.
The two numbers will compare as not equal, but will result will still be error 1 or error 129/130 since the change is not at least a tick.
The title of this thread is “How to avoid error 1 in order modify.” “The point of this was to compare whether the 2 numbers” were different enough to send.
The two numbers will compare as not equal, but will result will still be error 1 or error 129/130 since the change is not at least a tick.
Yes, I got the title of the thread. It is about error 1. It is not about error 129 or 130.
I do also put OrderStopLoss() != SupertrendUpTrend() this syntax but it gives me the same error
A simple check is
You can use point in this case as the symbol is the chart symbol. Otherwise you would need to get the point value for the symbol.
My post was simply about making sure that the New SL would not be considered equal to the old SL.
already debugging every section of the EA and still the error exist. Found out it is not the code that I used or any of you guys wrote, using point and ticksize has the same ability of solving the problem. The root of it is the indicator itself. I'm debugged it from the start using print statement and found out the value that the data window showed for the supertrend indicator is different with the data that I got from the print statement. I'm still trying to figure it out why the value is different between the data window and the print statement.
this is the screen capture of the chart using the supertrend indicator. The data showed on the data window is different from the alert and supertrend downtrend value should have been around 1.19100 and the value which the alert showed is 1.2000 which is almost 1000 pips away.