Hi, im trying to figure out why someone from spain who is using Tickmill ECN broker cant get the following code to place stoploss or takeprofit
when execution buy order is placed. When it works okay on the UK Tickmill broker?
// Input variablesexternstring SECTION_A = "*** Trade Management Settings ***";
inputint StopLoss = 100; // Stop Lossinputint TakeProfit = 100; // Take Profit // Event handlervoidOnTick()
{
// Stop Loss, Take Profit & Break Evenfor(int order = 0; order <= OrdersTotal() - 1; order++)
{
bool select = OrderSelect(order,SELECT_BY_POS); // Order must be selected before it can be processed. Not sure why it cant be in buy or sell each section?// Adds Buy Stop Loss Take Profit To Buy Order if(OrderType() == OP_BUY && OrderStopLoss() == 0 && (StopLoss > 0 || TakeProfit > 0))
{
// Calculate stop loss & take profit double stopLoss = 0, takeProfit = 0;
if(StopLoss > 0) stopLoss = OrderOpenPrice() - (StopLoss * _Point);
if(TakeProfit > 0) takeProfit = OrderOpenPrice() + (TakeProfit * _Point);
// Modify Order bool modifySLTP = OrderModify(OrderTicket(),0,stopLoss,takeProfit,0);
}
}
}
Hi, im trying to figure out why someone from spain who is using Tickmill ECN broker cant get the following code to place stoploss or takeprofit when execution buy order is placed. When it works okay on the UK Tickmill broker?