I suspect you are on an ECN broker which won't allow SL and TP to be sent with an instant execution... you need to immediately modify the ticket... search the site, as there are solutions to this... I don't have any links handy.
V
Viffer:
I suspect you are on an ECN broker which won't allow SL and TP to be sent with an instant execution... you need to immediately modify the ticket... search the site, as there are solutions to this... I don't have any links handy.
V
Thank you! I add this code and see if it helps.
I make code like this. It works but just for first open order.
if(adx>ADX_more_than && adxplus<adxminus && !Close_at_ADX_change ){ ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3*places,0,0, "EA",MagicNumber,0,Red); OrderSelect(SELECT_BY_POS, MODE_TRADES); if(OrderType()==OP_SELL && OrderSymbol()== Symbol() && OrderComment()== "EA"){ OrderModify(OrderTicket(),8*places,OrderOpenPrice()+((SL*places)*Point),OrderOpenPrice()-((TP*places)*Point),0,CLR_NONE); } }Any idea what is wrong?
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
Hello!
This code works ok. Order has no TP and no SL it closes when adxplus and adxminus cross.
But when I don't want it to close at adxplus and adxminus cross I set Close_at_ADX_change=false and put this code, but it does not open any orders. If I replace StopLoss and TakeProfit place with 0 it opens orders.
Anyone knows where is the probel?