# Amibroker AFL

#### pra1968

##### Member
Dear Alls,
can anybody converts this indicator for amibroker.

//Inverse chart
study("Inverse chart", shorttitle="Inverse chart", overlay=false)
inverse_open = -1*open
inverse_high = -1*high
inverse_low = -1*low
inverse_close = -1*close
plotcandle(inverse_open, inverse_low, inverse_high, inverse_close, color=inverse_close >= inverse_open ? green : red, wickcolor=black)

#### rake26

##### New Member
_SECTION_BEGIN("Invert");

if( ParamToggle( "Upside-down ?", "No|Yes" ) ) GraphXSpace =-100;

-drag drop, chart
-parameter : yes/no

#### kaly422000

##### Well-Known Member
need nr7, nr4 scanning AFL,ANY BODY HELP

##### Well-Known Member
need nr7, nr4 scanning AFL,ANY BODY HELP
Try this
Code:
``````_SECTION_BEGIN("NR Chart");
bgTop = ParamColor("BgTop", colorBlack);
bgBot = ParamColor("BgBottom", colorBlack);
bgTitle = ParamColor("Title", colorBlack);

Plot( C, "Close", ParamColor("Color", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_N(Title = StrFormat("{{NAME}}- {{INTERVAL}} {{DATE}} O= %g, H= %g, L= %g, C= %g (%.1f%%) V= " +WriteVal( V, 1.0 ) +"\n{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));

//-- Function Declaration --------------------
function NR(n)
{
R=H-L;
NRx=False;

for(i=n; i<BarCount; i++)
{
iSum=0;
for(j=1; j<n; j++)
if (R[i]<R[i-j]) iSum++;
if (iSum== (n-1))
NRx[i] = True;

}
return (NRx);
}

/************************************************** *******/
//TimeFrameSet( inDaily );
/************************************************** ********/

R=H-L;

NR4=NR(4);
NR7=NR(7);
ID=Inside();

//Mixed of ID & NR7
ID_NR7 = Inside() * NR7;
ID_NR4 = Inside() * NR4;

Pure_NR7 = (NR7 AND NOT ID);
Pure_NR7_Count=0;

Pure_NR4 = (NR4 AND NOT NR7 AND NOT ID);
Pure_NR4_Count=0;

Pure_ID = (ID AND NOT NR7 AND NOT NR4);
Pure_ID_Count=0;

Mix_ID_NR7 = ID_NR7;
Mix_ID_NR7_Count=0;

Mix_ID_NR4 = ID_NR4 AND NOT ID_NR7;
Mix_ID_NR4_Count=0;

for(i=1; i<BarCount; i++)
{
Count=0;
for(j=0; Pure_NR7[i-j]; j++) Count++;
if (Count>0) Pure_NR7_Count[i]=Count;

Count=0;
for(j=0; Pure_NR4[i-j]; j++) Count++;
if (Count>0) Pure_NR4_Count[i]=Count;

Count=0;
for(j=0; Pure_ID[i-j]; j++) Count++;
if (Count>0) Pure_ID_Count[i]=Count;

Count=0;
for(j=0; Mix_ID_NR7[i-j]; j++) Count++;
if (Count>0) Mix_ID_NR7_Count[i]=Count;

Count=0;
for(j=0; ID_NR4[i-j]; j++) Count++;
if (Count>0) Mix_ID_NR4_Count[i]=Count;

}

/************************************************** *******/
//TimeFrameRestore(); // restore time frame to original
/************************************************** ********/

Pure_NR7_Color = colorBrightGreen;
Pure_NR4_Color = colorLightOrange;
Pure_ID_Color = colorYellow;
Mix_ID_NR7_Color = colorGreen;
Mix_ID_NR4_Color = colorGold;

switch(Status("action"))
{
case actionIndicator:

_N(Title = Title +
WriteIf(Mix_ID_NR7, EncodeColor(Mix_ID_NR7_Color) + WriteIf(Mix_ID_NR7_Count>1, StrLeft(NumToStr(Mix_ID_NR7_Count), 4), "") + " IDNR7 ",
WriteIf(Mix_ID_NR4, EncodeColor(Mix_ID_NR4_Color) + WriteIf(Mix_ID_NR4_Count>1, StrLeft(NumToStr(Mix_ID_NR4_Count), 4), "") + " IDNR4 ",
WriteIf(Pure_NR7, EncodeColor(Pure_NR7_Color) + WriteIf(Pure_NR7_Count > 1, StrLeft(NumToStr(Pure_NR7_Count), 4), "") + " NR7 ",
WriteIf(Pure_NR4, EncodeColor(Pure_NR4_Color) + WriteIf(Pure_NR4_Count > 1, StrLeft(NumToStr(Pure_NR4_Count), 4), "") + " NR4 ",
WriteIf(Pure_ID, EncodeColor(Pure_ID_Color) + WriteIf(Pure_ID_Count > 1, StrLeft(NumToStr(Pure_ID_Count), 4), "") + " InsideDay ", "")))))
);

/****
Plot Shapes
****/

//-- Plot NR4 & NR7 --
Dist = L ;

//-- Plot Pure NR7
PlotShapes(Pure_NR7*shapeDigit7,
Pure_NR7_Color,
0,
Dist);

//-- Plot Pure NR4
PlotShapes(Pure_NR4*shapeDigit4,
Pure_NR4_Color,
0,
Dist);

//-- Plot ID & Mix ID --
Dist = H ;

//-- Plot Pure ID
PlotShapes(Pure_ID*shapeHollowCircle,
Pure_ID_Color,
0,
Dist);

// -- Plot Mix NR7 & ID
PlotShapes(Mix_ID_NR7*shapeStar,
Mix_ID_NR7_Color,
0,
Dist);

// -- Plot Mix NR4 & ID
PlotShapes(Mix_ID_NR4*shapeStar,
Mix_ID_NR4_Color,
0,
Dist);

break;

case actionExplore:
Buy = Mix_ID_NR7 OR Pure_NR7 AND Volume > 50000 AND Close > 50;
Sell = Mix_ID_NR4 OR Pure_NR4 AND Volume > 50000 AND Close > 50;
Filter = (Pure_NR7_Count > 0) OR (Pure_NR4_Count > 0) OR (Pure_ID_Count > 0);

SetOption("NoDefaultColumns", True);

AddColumn(IIf(Pure_ID_Count, 48 + Pure_ID_Count, 32), "INSIDE", formatChar, colorYellow, IIf(Pure_ID_Count, colorLightBlue, colorDefault));
AddColumn(IIf(Pure_NR4_Count, 48 + Pure_NR4_Count, 32), "NR4", formatChar, colorYellow, IIf(Pure_NR4_Count, colorBlue, colorDefault));
AddColumn(IIf(Pure_NR7_Count, 48 + Pure_NR7_Count, 32), "NR7", formatChar, colorYellow, IIf(Pure_NR7_Count, colorGreen, colorDefault));

AddColumn(R, "Range", 6.2, colorDefault, colorDefault, 84);
AddColumn(High, "High", 6.2, colorDefault, colorDefault, 120);
AddColumn(Low, "Low", 6.2, colorDefault, colorDefault, 120);
break;

}

_SECTION_END();``````

#### kaly422000

##### Well-Known Member
Try this
Code:
``````_SECTION_BEGIN("NR Chart");
bgTop = ParamColor("BgTop", colorBlack);
bgBot = ParamColor("BgBottom", colorBlack);
bgTitle = ParamColor("Title", colorBlack);

Plot( C, "Close", ParamColor("Color", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_N(Title = StrFormat("{{NAME}}- {{INTERVAL}} {{DATE}} O= %g, H= %g, L= %g, C= %g (%.1f%%) V= " +WriteVal( V, 1.0 ) +"\n{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));

//-- Function Declaration --------------------
function NR(n)
{
R=H-L;
NRx=False;

for(i=n; i<BarCount; i++)
{
iSum=0;
for(j=1; j<n; j++)
if (R[i]<R[i-j]) iSum++;
if (iSum== (n-1))
NRx[i] = True;

}
return (NRx);
}

/************************************************** *******/
//TimeFrameSet( inDaily );
/************************************************** ********/

R=H-L;

NR4=NR(4);
NR7=NR(7);
ID=Inside();

//Mixed of ID & NR7
ID_NR7 = Inside() * NR7;
ID_NR4 = Inside() * NR4;

Pure_NR7 = (NR7 AND NOT ID);
Pure_NR7_Count=0;

Pure_NR4 = (NR4 AND NOT NR7 AND NOT ID);
Pure_NR4_Count=0;

Pure_ID = (ID AND NOT NR7 AND NOT NR4);
Pure_ID_Count=0;

Mix_ID_NR7 = ID_NR7;
Mix_ID_NR7_Count=0;

Mix_ID_NR4 = ID_NR4 AND NOT ID_NR7;
Mix_ID_NR4_Count=0;

for(i=1; i<BarCount; i++)
{
Count=0;
for(j=0; Pure_NR7[i-j]; j++) Count++;
if (Count>0) Pure_NR7_Count[i]=Count;

Count=0;
for(j=0; Pure_NR4[i-j]; j++) Count++;
if (Count>0) Pure_NR4_Count[i]=Count;

Count=0;
for(j=0; Pure_ID[i-j]; j++) Count++;
if (Count>0) Pure_ID_Count[i]=Count;

Count=0;
for(j=0; Mix_ID_NR7[i-j]; j++) Count++;
if (Count>0) Mix_ID_NR7_Count[i]=Count;

Count=0;
for(j=0; ID_NR4[i-j]; j++) Count++;
if (Count>0) Mix_ID_NR4_Count[i]=Count;

}

/************************************************** *******/
//TimeFrameRestore(); // restore time frame to original
/************************************************** ********/

Pure_NR7_Color = colorBrightGreen;
Pure_NR4_Color = colorLightOrange;
Pure_ID_Color = colorYellow;
Mix_ID_NR7_Color = colorGreen;
Mix_ID_NR4_Color = colorGold;

switch(Status("action"))
{
case actionIndicator:

_N(Title = Title +
WriteIf(Mix_ID_NR7, EncodeColor(Mix_ID_NR7_Color) + WriteIf(Mix_ID_NR7_Count>1, StrLeft(NumToStr(Mix_ID_NR7_Count), 4), "") + " IDNR7 ",
WriteIf(Mix_ID_NR4, EncodeColor(Mix_ID_NR4_Color) + WriteIf(Mix_ID_NR4_Count>1, StrLeft(NumToStr(Mix_ID_NR4_Count), 4), "") + " IDNR4 ",
WriteIf(Pure_NR7, EncodeColor(Pure_NR7_Color) + WriteIf(Pure_NR7_Count > 1, StrLeft(NumToStr(Pure_NR7_Count), 4), "") + " NR7 ",
WriteIf(Pure_NR4, EncodeColor(Pure_NR4_Color) + WriteIf(Pure_NR4_Count > 1, StrLeft(NumToStr(Pure_NR4_Count), 4), "") + " NR4 ",
WriteIf(Pure_ID, EncodeColor(Pure_ID_Color) + WriteIf(Pure_ID_Count > 1, StrLeft(NumToStr(Pure_ID_Count), 4), "") + " InsideDay ", "")))))
);

/****
Plot Shapes
****/

//-- Plot NR4 & NR7 --
Dist = L ;

//-- Plot Pure NR7
PlotShapes(Pure_NR7*shapeDigit7,
Pure_NR7_Color,
0,
Dist);

//-- Plot Pure NR4
PlotShapes(Pure_NR4*shapeDigit4,
Pure_NR4_Color,
0,
Dist);

//-- Plot ID & Mix ID --
Dist = H ;

//-- Plot Pure ID
PlotShapes(Pure_ID*shapeHollowCircle,
Pure_ID_Color,
0,
Dist);

// -- Plot Mix NR7 & ID
PlotShapes(Mix_ID_NR7*shapeStar,
Mix_ID_NR7_Color,
0,
Dist);

// -- Plot Mix NR4 & ID
PlotShapes(Mix_ID_NR4*shapeStar,
Mix_ID_NR4_Color,
0,
Dist);

break;

case actionExplore:
Buy = Mix_ID_NR7 OR Pure_NR7 AND Volume > 50000 AND Close > 50;
Sell = Mix_ID_NR4 OR Pure_NR4 AND Volume > 50000 AND Close > 50;
Filter = (Pure_NR7_Count > 0) OR (Pure_NR4_Count > 0) OR (Pure_ID_Count > 0);

SetOption("NoDefaultColumns", True);

AddColumn(IIf(Pure_ID_Count, 48 + Pure_ID_Count, 32), "INSIDE", formatChar, colorYellow, IIf(Pure_ID_Count, colorLightBlue, colorDefault));
AddColumn(IIf(Pure_NR4_Count, 48 + Pure_NR4_Count, 32), "NR4", formatChar, colorYellow, IIf(Pure_NR4_Count, colorBlue, colorDefault));
AddColumn(IIf(Pure_NR7_Count, 48 + Pure_NR7_Count, 32), "NR7", formatChar, colorYellow, IIf(Pure_NR7_Count, colorGreen, colorDefault));

AddColumn(R, "Range", 6.2, colorDefault, colorDefault, 84);
AddColumn(High, "High", 6.2, colorDefault, colorDefault, 120);
AddColumn(Low, "Low", 6.2, colorDefault, colorDefault, 120);
break;

}

_SECTION_END();``````
thanx a lot sir,grt help. one more thing can i scan from eod database for specified date