the code below is a simple one that enters with a Stop order on a breakout. Once entered, it places a Stop and a TP. Now, the problem I have is that once a position is open, the strategy does not enter the opposite direction if there is a signal. I was thinking that the problem is the multiple stop orders being open at the same time but I was not able to find the cause/workaround. Could anyone please point me to the right direction? Is this order related or am I missing something else?
}
else if (State == State.DataLoaded)
{
amaADX1 = amaADX(Close, 14, Convert.ToInt32(ADX_Length));
amaMAX1 = amaMAX(High, Convert.ToInt32(BO_p));
amaMIN1 = amaMIN(Low, Convert.ToInt32(BO_p));
SetStopLoss(CalculationMode.Currency, Stop);
SetProfitTarget(CalculationMode.Currency, Target);
}
}
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 1)
return;
// Long
if ((amaADX1.ADX[0] < ADX_Max))
{
EnterLongStopMarket(Convert.ToInt32(DefaultQuantit y), (amaMAX1[1] + (5 * TickSize)),@"LE");
}
// Short
if ((amaADX1.ADX[0] < ADX_Max))
{
EnterShortStopMarket(Convert.ToInt32(DefaultQuanti ty), (amaMIN1[1] - (5 * TickSize)),@"SE");
}

Comment