Hello All,
Could anyone please help in identifying number of bullish and bearish bars in last 10 bars? The below i got from net and it calculates for whole days. I tried for last 10 bars using barindex. But no success. could you please someone help?
BarsUp=0;
BarsDown=0;
PCount = 0;
NCount = 0;
NewDay = Day() != Ref(Day(), -1);
for(i=0;i<BarCount;i++)
{
if(NewDay==True)
{
BarsUp=0;
BarsDown=0;
PCount = 0;
NCount = 0;
}
//positive count
if(C-O>0)
{
PCount++;
BarsUp=PCount;
BarsDown=NCount;
}
//negative count
if(C-O<0)
{
NCount++;
BarsUp=PCount;
BarsDown=NCount;
}
}
Thanks
Bala
Could anyone please help in identifying number of bullish and bearish bars in last 10 bars? The below i got from net and it calculates for whole days. I tried for last 10 bars using barindex. But no success. could you please someone help?
BarsUp=0;
BarsDown=0;
PCount = 0;
NCount = 0;
NewDay = Day() != Ref(Day(), -1);
for(i=0;i<BarCount;i++)
{
if(NewDay==True)
{
BarsUp=0;
BarsDown=0;
PCount = 0;
NCount = 0;
}
//positive count
if(C-O>0)
{
PCount++;
BarsUp=PCount;
BarsDown=NCount;
}
//negative count
if(C-O<0)
{
NCount++;
BarsUp=PCount;
BarsDown=NCount;
}
}
Thanks
Bala