It doesn't appear to be able to detect when there is a change in direction. From the image included you can see that the send entry (short) should have been a long entry because at the time of entry the longer term rsi(150) was pointing up (thick grey line). instead I got a short. How can i make this strategy more responsive to current conditions without constant signal oscillations?
important parts of the code shown below:
protected override void Initialize()
{
Add(PeriodType.Minute, chartOne); //BarsArray[1] - chart 1
Add(PeriodType.Minute, chartTwo);
SetStopLoss("", CalculationMode.Ticks, 40, true);
SetProfitTarget("", CalculationMode.Ticks, 80);
CalculateOnBarClose = true;
}
protected override void OnBarUpdate()
{
if (CurrentBars[0] < BarsRequired || CurrentBars[1] < BarsRequired)
return;
// Condition set 1
if (Position.MarketPosition == MarketPosition.Flat &&
CUMRSI(BarsArray[1],2,3)[0] < CUMRSI(BarsArray[1],2,3)[1] &&
CUMRSI(BarsArray[2],2,3)[0] < CUMRSI(BarsArray[2],2,3)[1] &&
CUMRSI(BarsArray[2],2,3)[0] > upper &&
CUMRSI(BarsArray[0],2,3)[0] > upper)
{
EnterShort();
}
// Condition set 2
if (Position.MarketPosition == MarketPosition.Flat &&
CUMRSI(BarsArray[1],2,3)[0] > CUMRSI(BarsArray[1],2,3)[1] &&
CUMRSI(BarsArray[2],2,3)[0] > CUMRSI(BarsArray[2],2,3)[1] &&
CUMRSI(BarsArray[2],2,3)[0] < lower &&
CUMRSI(BarsArray[0],2,3)[0] < lower)
{
EnterLong();
}
// Condition set 3
if (Position.MarketPosition == MarketPosition.Long
&& CUMRSI(BarsArray[2],PeriodRsi, 3).Plot0[0] > upper)
{
ExitLong();
EnterShort();
}
// Condition set 4
if (Position.MarketPosition == MarketPosition.Short
&& CUMRSI(BarsArray[2],PeriodRsi, 3).Plot0[0] < lower)
{
ExitShort();
EnterLong();
}
}

Comment