I got some problem to well-run my system. I just would like to have one trade per candle (if it meets a condition) with one stop loss and one take profit different for each trade. I use the unmanaged approach to do this but it doesn't work correctly with SL/TP, why ?
Thanks a lot !!
double Condition, Target, StopL;
private IOrder entryOrder = null;
private IOrder entryOrder2 = null;
/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
CalculateOnBarClose = true;
Unmanaged = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (Condition == 1) {
entryOrder = SubmitOrder(0, OrderAction.Buy, OrderType.Market, 1, Target, StopL, "", "Enter Long");
} else entryOrder2 = SubmitOrder(0, OrderAction.Buy, OrderType.Market, 1, Target, StopL, "", "Enter Sell");
}

Comment