You
Server Change the SL to X It is at X! Change the SL to X It is at X! Change the SL to X You are insane
Print your values and find out.(Ask-(STOPLOSSPIPS*Point))>OrderStopLoss() newSL=Ask-(STOPLOSSPIPS*Point);
What if Ask - STOPLOSSPIPS*Point > OrderStopLoss() by less than one Point. Your modify fails because newSL-StopLoss() < Point, i.e. the same value. The == operand. - MQL4 forum- On a 5 digit broker Point is NOT a pip.
- You open a buy at the ask, your TP/SL is relative to the bid.
You
Server Change the SL to X It is at X! Change the SL to X It is at X! Change the SL to X You are insane
Print your values and find out.-
What if Ask - STOPLOSSPIPS*Point > OrderStopLoss() by less than one Point. Your modify fails because newSL-StopLoss() < Point, i.e. the same value. The == operand. - MQL4 forum
- On a 5 digit broker Point is NOT a pip.
- You open a buy at the ask, your TP/SL is relative to the bid.
3. I have a 5 digit broker,but this is surely not the problem i have all my formulas counted in fractional pips ✔
4. Buy is opened in ask sell is opened in bid, thaks fine too ✔
1 & 2 I suspected that it was the problem with the same value,since the code basically what it does, that it tests if a price moves in my favor and moves the stoploss in paralel with the price.If the price doesnt move then it should not move the stop loss since i have this on
if((Ask-(STOPLOSSPIPS*Point))>OrderStopLoss()) ...
Why it still modifies the order even if the price didnt changed if i stated out with an > that it should only change it if the current stop loss is bigger (in the buy case) than the previous?
And how to correct it?
Thank you!
3. I have a 5 digit broker,but this is surely not the problem i have all my formulas counted in fractional pips ✔
4. Buy is opened in ask sell is opened in bid, thaks fine too ✔
1 & 2 I suspected that it was the problem with the same value,since the code basically what it does, that it tests if a price moves in my favor and moves the stoploss in paralel with the price.If the price doesnt move then it should not move the stop loss since i have this on
Why it still modifies the order even if the price didnt changed if i stated out with an > that it should only change it if the current stop loss is bigger (in the buy case) than the previous?
And how to correct it?
Thank you!
Do you know Ask at start() is also Ask moment you modify ??
Simply don't modify every Point wait until the diffence is more then a Point
why not modify if it is atleast a pip difference
that way you avoid also a lot of tradecontext to busy errors...
Why it still modifies the order even if the price didnt changed if i stated out with an > that it should only change it if the current stop loss is bigger (in the buy case) than the previous?
Read the thread at the link given to you and spend some time understanding . . . then fix your code. This is a link --> --> --> The == operand. - MQL4 forum
1.54321000000001 is > 1.543210000000001 but in terms of a GBPUSD price they are equal . . .
Read the thread at the link given to you and spend some time understanding . . . then fix your code. This is a link --> --> --> The == operand. - MQL4 forum
1.54321000000001 is > 1.543210000000001 but in terms of a GBPUSD price they are equal . . .
I've fixed it using devries idea, now it has a full 1 pip difference between testings and seems to work fine now.
I've fixed it using devries idea, now it has a full 1 pip difference between testings and seems to work fine now.
if((TRAILSTOP > STOPLOSSPIPS) && ((Bid+(STOPLOSSPIPS*Point))<OrderStopLoss())){OrderModify(OrderTicket(),OrderOpenPrice(),Bid+(STOPLOSSPIPS*Point),OrderTakeProfit(),0,White); } } /// }
where is it you get errorreturn when your modify fails ???
if you keep on programming this way then it is hard to believe you understand your own code
there are more issues why it can be a modify is failing
If it happens then you like to know the reason....
And next time when you have a similar problem and 1 pip difference is too much what then ? read, learn, understand and you can resolve your issues rather than trying to work around them . . . they will usually come back to bite you otherwise.
where is it you get errorreturn when your modify fails ???
if you keep on programming this way then it is hard to believe you understand your own code
there are more issues why it can be a modify is failing
If it happens then you like to know the reason....
Nah 1 pip is ok anyway its a trailing stop, which are used on min 5 pips step.If i use it on 1 pip its acceptable and more accurate,and also not to overload the EA,a crash is the worst thing you can get when trading.
Nah 1 pip is ok anyway its a trailing stop, which are used on min 5 pips step.If i use it on 1 pip its acceptable and more accurate,and also not to overload the EA,a crash is the worst thing you can get when trading.
i wrote there are more issues why it can be a modify is failing
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi i`m trying to build a trailing stop, and it's working fine but sometimes i get a nasty order modify error 1.I don't know if it's harmful i've read the documentation it is when the value is unchanged i guess,but the question is how to resolve it :D .Hew is my code: