-
orderID = OrderSend(...............)
Always post all relevant code (using Code button) or attach the file.
We can't know what type orderID is, or whether it is globally declared or static. If not, you've lost the ticket number and your OrderSelect will never work.
-
if(OrderSelect(orderID,SELECT_BY_TICKET)==true); // I take my current order
You select by ticket and check if it is a buy, but never check if the order has already closed. - ThomasBrd51: then there is a hundred OrderModify and in a few secondsERR_NO_RESULT
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 Insanity: doing the same thing over and over again and expecting different results.
UnknownCompute the new value, then check that you are moving the existing value at least a tick.
-
Check your return codes, and report your errors (including market prices and your variables). Don't look at GLE/LE unless you have an error. Don't just silence the compiler (MT5/MT4+strict), it is trying to help you.
What are Function return values ? How do I use them ? - MQL4 programming forum (2012)
Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles (2014)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello everyone,
I hope you are doing well this morning.
You have helped me a lot before, I really appreciate this community :)
So!
I have a little problem with my Trailing Stop Loss
When I start this code in the backtest, when the Bid - OrderOpenPrice is much higher than my traillingStart (15 pips) then there is a hundred OrderModify and in a few seconds my SL this teleports to -15 pips below my current Bid .. the SL is able to decrease and increase but it does not go below the OrderOpenPrice ..
Here are the errors:
1. The price must not be teleported but before step by step with TraillingStep
2. The SL must not be able to grow (go down in buy)
I tried a lot of manipulation but nothing works .. And so as usual when I'm up against the wall I come here because I know you will surely see what is wrong with my code ..
thanks a lot for your help
Information in case ...
I would like a TraillingStop Break Event (I think its called that)
If the current market price is above my TraillingStart (15 pips) then I would like my StopLoss to decrease (go up in buy) and be 15 pips below the current market price. but if the market drops then the StopLoss should not move .. it will only re-cap if the current market price is above 15 pips of the new StopLoss ..
Thank you