Hi Murtaza and AW10.
See the chart below and give your comments. The actual chart portion does not differ from the earlier image posted. But in the title at the top, the label xNRy (or XIDNRy etc. as the case may be) is displayed. I think this is what you wanted. I have posted the AFL Code also. Those who have AmiBroker can run it on their charts and experiment with it. If any errors are there please report. After that I will add Exploration code also so that a report can be generated.
Murtaza Bhai, in the chart below You can see the cursor (vertical line) parked on a 4NR7 bar. Is it 'Sone pe Suhaga' or better than that?
One observation I made when testing this AFL on several charts:
I could not find a Inside Day bar immediately following a NRx Bar whereas the reverse is seen in many places. I feel an Inside Day following a NRx is either not possible or it is extremely rare. I am bringing this to your notice because it may be of use to you in interpreting the charts.
The Chart is attached here:
The AFL Code is here:
/**********************************************
R = H - L;
NR7 = False;
NR4 = False;
m7 = m4 = idm7 = idm4 = idm = 0;
for(i = 7; i < BarCount; i++)
{
if( R
< R[i - 1] AND R < R[i -2] AND R < R[i - 3] AND R < R[i - 4] AND R < R[i - 5] AND R < R[i - 6])
{
NR7 = True;
m7 = 1;
}
}
for(i = 4; i < BarCount; i++)
{
if((R < R[i - 1] AND R < R[i -2] AND R < R[i - 3] ) AND NOT NR7)
{
NR4 = True;
m4 = 1;
}
}
IDNR7 = Inside() * NR7;
IDNR4 = Inside() * NR4;
ID = Inside();
idm7 = IIf(IDNR7, 1, 0);
idm4 = IIf(IDNR4, 1, 0);
idm = IIf(id, 1, 0);
for(i = 1; i < BarCount; i++)
{
if(IDNR7 == IDNR7[i - 1]) idm7 = idm7 + idm7[i - 1];
if(IDNR4 == IDNR4[i - 1]) idm4 = idm4 + idm4[i - 1];
if(NR7 == NR7[i - 1]) m7 = m7 + m7[i - 1];
if(NR4 == NR4[i - 1]) m4 = m4 + m4[i - 1];
if(ID == ID[i - 1]) idm = idm + idm[i - 1];
}
MarkerIDNR7 = MarkerIDNR4 = shapeStar ;
Marker7 = shapeDigit7;
NR7Color = colorBrightGreen;
Marker4 = shapeDigit4;
NR4Color = colorLightOrange;
MarkerID = shapeHollowCircle;
IDColor = colorYellow;
IDNR7Color = colorBrightGreen;
IDNR4Color = colorLightOrange;
MarkerDist = L * 0.995;
IDNRDist = H * 1.03;
_N(Title = StrFormat("{{NAME}}, {{DATE}} ({{INTERVAL}}): {{VALUES}}") + ", Range=" + Prec(R + 0.00001, 2) + ","
+ WriteIf(IDNR7, EncodeColor(colorBrightGreen) + WriteIf(idm7 > 1, StrLeft(NumToStr(idm7), 4), "") + " IDNR7 ", "")
+ WriteIf(IDNR4, EncodeColor(colorLightOrange) + WriteIf(idm4 > 1, StrLeft(NumToStr(idm4), 4), "") + " IDNR4 ", "")
+ WriteIf(NR7 AND NOT ID, EncodeColor(colorBrightGreen) + WriteIf(m7 > 1, StrLeft(NumToStr(m7), 4), "") + " NR7 ", "")
+ WriteIf(NR4 AND NOT ID, EncodeColor(colorLightOrange) + WriteIf(m4 > 1, StrLeft(NumToStr(m4), 4), "") + " NR4 ", "")
+ WriteIf(ID AND NOT NR7 AND NOT NR4, EncodeColor(colorTurquoise) + WriteIf(idm > 1, StrLeft(NumToStr(idm), 4), "") + " Inside Day ", ""));
PlotOHLC(O, H, L, C, "Close", colorLightGrey, styleBar);
PlotShapes(IIf(IDNR7, MarkerIDNR7, shapeNone), IDNR7Color, 0, IDNRDist);
PlotShapes(IIf(IDNR4 AND NOT IDNR7, MarkerIDNR4, shapeNone), IDNR4Color, 0, IDNRDist);
PlotShapes(IIf(NR7 AND NOT ID, Marker7, shapeNone), NR7Color, 0, MarkerDist);
PlotShapes(IIf(NR4 AND NOT NR7 AND NOT ID, Marker4, shapeNone), NR4Color, 0, MarkerDist);
PlotShapes(IIf(ID AND NOT NR7 AND NOT NR4, MarkerID, shapeNone), IDColor, 0, IDNRDist);
********************************************************/
Waiting for your feedback
Regards
-Anant