void TechnicalAnalysis8() { for (int i=OrdersTotal()-1; i >= 0; i--) if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 1 && Ask - OrderOpenPrice() > BuyTakeprofit3*PipValue*Point) { DeletePendingOrder9(); } } void DeletePendingOrder9() { for (int i=OrdersTotal()-1; i >= 0; i--) if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (OrderType() == OP_SELLSTOP && OrderSymbol() == Symbol() && OrderMagicNumber() == 2) { bool ret = OrderDelete(OrderTicket(), Red); if (ret == false) { Print("OrderDelete() error - ", ErrorDescription(GetLastError())); } } } }
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
An example, if I buy in the market to 0.6400 and put Take Profit at 0.6500, well this is the first order (1).
Well the same time I place a pending order, in 6400, ok this is the second order (2).
My question is very simple how can I eliminate the second order (2), when the first (1) has reached the Take Profit?
I tried several times but have never managed to get what I wanted, one below is an example.
I hope someone help me possas.