I attached a chart of one of the trades returned to show what I mean. My code is below. Any ideas, gurus? Thanks in advance...
protected override void OnBarUpdate()
{
if(CurrentBars[0] <= BarsRequired || CurrentBars[1] <= BarsRequired){return;}
else
{
int countOf20EmaOver50Ema=0;
int countOfClosesOver50Ema=0;
int countOfLowsUnder50Ema=0;
for(int i=0;i<=29;i++)
{
if(EMA(Closes[1],20)[i]>EMA(Closes[1],50)[i]){countOf20EmaOver50Ema++;}
if(Closes[1][i]>=EMA(Closes[1],50)[i]){countOfClosesOver50Ema++;}
if(Lows[1][i]<EMA(Closes[1],50)[i]){countOfLowsUnder50Ema++;}
}
if(countOf20EmaOver50Ema==30 && countOfClosesOver50Ema>=27 &&
(countOfLowsUnder50Ema>=1 && countOfLowsUnder50Ema <= 5) &&
(Lows[1][0]<EMA(Closes[1],50)[0] && Closes[1][0]>=EMA(Closes[1],50)[0])&&
(Bars.FirstBarOfSession)&&
(Close[0]>Lows[1][1]))
{
EnterLong();
}
//Exit if:
if(BarsInProgress==1)
{
if(BarsSinceEntry(1,"",0)>=2&&Closes[1][0]<EMA(Closes[1],50)[0])
{
ExitLong();
}
}
}
}


Comment