HELP Tranlling Stop Candle
OrderModify(OrderTicket(),0,Close[0],0,0,CLR_NONE);
At the open of a new bar Close[0] is the current price, you cannot usually modify a trade SL with current price. Did you mean Low[1] ?
if(isNewBar(new_time))Only call this once per tick, before looping through the orders. If you call it in a loop, the 2nd etc time will always return false.
Gumrai Tank very much to answer.
No understand you talked about false return.
is good thus?
static datetime Time0; bool newBar; newBar = Time[0] > Time0; static datetime new_time = 0; if (newBar){ Time0 = Time[0]; double barClosePrice = Close[1]; if(OrdersTotal()>0) { for(int i=0; i<=OrdersTotal(); i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) { if(OrderType() == OP_BUY) OrderModify(OrderTicket(),0,Low[1],0,CLR_NONE); } } } }
thank you for helping me
The stop was set after 25 candles.
Help me please :(
if(OrdersTotal()>0){ for(int i=0; i<=OrdersTotal(); i++)
Orders are positions 0 .. OrdersTotal -1. remove the equals sign and the if statement is unnecessary.OrderModify(OrderTicket(),0,Low[1],0,CLR_NONE);
- Check your return codes What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
- Avoid error #1
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
KeepMarcos: you can tell the error please?
| You can't modify the opening price of a open order.. |

Heey people!
I'm trying to set TrallingStop the next candle. But has no results.
Thank you.
Sorry English error.
The code is correct because if you take: Its ok