currently my "sl" is double and it needs to stay as a double. but how do i make sl so that stop loss will be on the reversal bar? If i simply do Close[0] < Open[0] its a bool data type and wont work..
Any ideas would be helpful
if (order.IsLong)
{
double tp = Instrument.MasterInstrument.RoundToTickSize(averageFillPrice + ProfitTarget * TickSize);
if (ProfitTarget > 0 && tp.ApproxCompare(ask) > 0)
{
targetOrder = SubmitOrderUnmanaged(0, OrderAction.Sell, OrderType.Limit, filled, tp, 0, oco, "PT");
}
double sl = Instrument.MasterInstrument.RoundToTickSize(averageFillPrice - StopLoss * TickSize);
if (StopLoss > 0 && sl.ApproxCompare(bid) < 0)
{
stopOrder = SubmitOrderUnmanaged(0, OrderAction.Sell, OrderType.StopMarket, filled, 0, sl, oco, "SL");
}
}

Comment