if(!OrderClose(tiket,OrderLots(),ask,3,Green))Comment("ERROR");} if (ask<partialclose_1a&&osl>oop)//1 livello di taglio {Print("PRIMO LIVELLO DI TALGIO VERO"+osl+"-"+newsl+"-"+partialclose_1a+olotnew);// primo livello ti taglio if (OrderModify(tiket,oop,newslshort,otp,0)); if(!OrderClose(tiket,olotnew,ask,3,Green))Comment("ERROR");}You closed tiket. You can't close it again.
Fernando Carreiro #:
When you do a partial close, the remaining open order will have a different ticket number.
When you do a partial close, the remaining open order will have a different ticket number.
yes but with loop the tiket is recaculated, so he know the new tiket. in backtest work. You think that i change this ? I need to select order every time a partial order is closed ?
Thans in advance
Thomas Bolognesi #: yes but with loop the tiket is recaculated, so he know the new tiket. in backtest work. You think that i change this ? I need to select order every time a partial order is closed ?
Yes, obviously! When the ticket is closed and the remaining order has a different ticket, you can only modify the new ticket, not the old one.
Fernando Carreiro #:
Yes, obviously! When the ticket is closed and the remaining order has a different ticket, you can only modify the new ticket, not the old one.Ok thank you i correct the code but the error 131 remain but now no more error in orderclose in logs
code correct :
//normalize lot olotnew=NormalizeDouble(olotnew,2); olotnew2=NormalizeDouble(olotnew2,2); olotnew3=NormalizeDouble(olotnew3,2); if (t==OP_BUY) // if position buy {Print("Operazione buy"); if (changetrandbuy()) {Print("il trand cambia puoi chiudere"+changetrandbuy()); if(!OrderClose(tiket,OrderLots(),bid,3,Green))Comment("Error");} //1 LIVEL TO CUT if (bid>partialclose_1a&&osl<oop) {Print("PRIMO LIVELLO DI TALGIO VERO"+osl+"-"+newsl+"-"+partialclose_1a+olotnew);// primo livello ti taglio if (OrderModify(tiket,oop,newsl,otp,0))//move stop loss if(!OrderClose(tiket,olotnew,bid,3,Green))Comment("Error");} //partial close //2 LIVEL TO CUT if(OrderSelect(PositionIndex, SELECT_BY_POS,MODE_TRADES)) if (OrderSymbol()==Symbol()&&OrderMagicNumber() == MagicNumber) { int tiket1 = OrderTicket(); if (bid>partialclose_2a&&osl<newsl1) { Print("Condizione secondo parziale vera"); if (OrderModify(tiket1,oop,newsl1,otp,0)) //2 move stop loss if(!OrderClose(tiket1,olotnew2,bid,3,Green))Comment("Error");} //2 cut partial close } //3 LIVEL TO CUT if(OrderSelect(PositionIndex, SELECT_BY_POS,MODE_TRADES)) if (OrderSymbol()==Symbol()&&OrderMagicNumber() == MagicNumber) { int tiket3 = OrderTicket(); if (bid>partialclose_3a&&osl<newsl2) // 3 livello di taglio {Print("Condizione TERZO parziale vera"); Print("livello to move be"+testbreakb+tpbuy3); if (OrderModify(tiket3,oop,testbreakb,tpbuy3,0))//3 move stop loss if(!OrderClose(tiket3,olotnew3,bid,3,Green))Comment("Error"); //3 cut partial ObjectDelete("hline1"); ObjectDelete("hline2"); ObjectDelete("hline3");} } } else if (t==OP_SELL) // se la posizione è a ribasso {Print("Operazione SHORT"); if (changetrandshort()) {Print("il trand cambia puoi chiudere"+changetrandshort()); if(!OrderClose(tiket,OrderLots(),ask,3,Green))Comment("ERROR");} //1 LIVEL TO CUT if (ask<partialclose_1a&&osl>oop)//1 livello di taglio {Print("PRIMO LIVELLO DI TALGIO VERO"+osl+"-"+newsl+"-"+partialclose_1a+olotnew);// primo livello ti taglio if (OrderModify(tiket,oop,newslshort,otp,0)); if(!OrderClose(tiket,olotnew,ask,3,Green))Comment("ERROR");} //2 LIVEL TO CUT if(OrderSelect(PositionIndex, SELECT_BY_POS,MODE_TRADES)) if (OrderSymbol()==Symbol()&&OrderMagicNumber() == MagicNumber) { int tiket1 = OrderTicket(); if (ask<partialclose_2a&&osl>newsl1short) // 2 livello di taglio { Print("Condizione secondo parziale vera"); if (OrderModify(tiket1,oop,newsl1short,otp,0)); if(!OrderClose(tiket1,olotnew2,ask,3,Green))Comment("ERROR");} } //3 LIVEL TO CUT if(OrderSelect(PositionIndex, SELECT_BY_POS,MODE_TRADES)) if (OrderSymbol()==Symbol()&&OrderMagicNumber() == MagicNumber) { int tiket3 = OrderTicket(); if (ask<partialclose_3a&&osl>newsl2sdhort) // 3 livello di taglio {Print("Condizione TERZO parziale vera"); Print("livello to move be"+testbreaks); if (OrderModify(tiket3,oop,testbreaks,tpshort3,0)); if(!OrderClose(tiket3,olotnew3,ask,3,Green))Comment("ERROR"); ObjectDelete("hline1"); ObjectDelete("hline2"); ObjectDelete("hline3");} } } } RefreshRates(); return; } // end intial loop }
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
For pass the seller phase i have this error also if i put the controlled required. Can you help me what i wrong ?