AFL for Positive/Negative reversal

#1
Hi All,
I am looking out for AFL for positive & negative reversal. Below mentioned conditions are not created by me, got it from someone else. But looking forward to convert it in AFL :).

Here are my conditions as follows:
Positive reversal has sub classification like this:
1. Positive Reversal:
When a stock breaches the low of the previous day and closes above the previous day close and current day open, then it is called Positive reversal.
2. Key Positive Reversal:
When a stock breaches the previous day low and crosses previous day high and closes above previous day close and current day open then it is a Key Positive Reversal.
3. Perfect Key Positive Reversal:
When a stock breaches previous day low and crosses previous day high and closes above previous day close and previous day open and current day open, then it is a perfect Key positive reversal.

Negative reversal has sub classification like this:
1. Negative Reversal:
When a stock crosses the previous day high and closes below the current day open and previous day close, then it is a negative reversal.
2. Key Negative Reversal:
When a stock crosses previous day high and breaches the low of previous day also and closes below current day open and previous day close, then it is a key negative reversal.
3. Perfect Key Negative Reversal:
When a stock crosses previous day high and breaches the low of previous day and close below current day open, previous day open and previous day close, then it becomes a perfect key negative reversal.

Someone please crate AFL, preferably exploration, which will give us an exact output.

Regards,
TT
 

hitesh

Active Member
#2
Hi All,
I am looking out for AFL for positive & negative reversal. Below mentioned conditions are not created by me, got it from someone else. But looking forward to convert it in AFL :).

Here are my conditions as follows:
Positive reversal has sub classification like this:
1. Positive Reversal:
When a stock breaches the low of the previous day and closes above the previous day close and current day open, then it is called Positive reversal.
2. Key Positive Reversal:
When a stock breaches the previous day low and crosses previous day high and closes above previous day close and current day open then it is a Key Positive Reversal.
3. Perfect Key Positive Reversal:
When a stock breaches previous day low and crosses previous day high and closes above previous day close and previous day open and current day open, then it is a perfect Key positive reversal.

Negative reversal has sub classification like this:
1. Negative Reversal:
When a stock crosses the previous day high and closes below the current day open and previous day close, then it is a negative reversal.
2. Key Negative Reversal:
When a stock crosses previous day high and breaches the low of previous day also and closes below current day open and previous day close, then it is a key negative reversal.
3. Perfect Key Negative Reversal:
When a stock crosses previous day high and breaches the low of previous day and close below current day open, previous day open and previous day close, then it becomes a perfect key negative reversal.

Someone please crate AFL, preferably exploration, which will give us an exact output.

Regards,
TT
Dear TT,

Please find below mentioned AFL and exploration desired by you.

Kindly check the conditions used in AFL for reversal before using.


// http://www.traderji.com/amibroker/42302-afl-positive-negative-reversal.html
// by TT

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("Panel color ",colorWhite));

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
if( ParamToggle("Tooltip shows", "All Values|Only Prices" ) )
{
ToolTip=StrFormat("Open: %g\nHigh: %g\nLow: %g\nClose: %g (%.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 )));
}


grid_day = IIf(Day()!=Ref(Day(),-1),1,0);
Plot(grid_day,"",colorDarkGrey,styleHistogram|styleDashed|styleNoLabel|styleOwnScale);

_SECTION_END();

_SECTION_BEGIN("Volume");
Plot( Volume, _DEFAULT_NAME(), ParamColor("Color", colorLavender ), styleNoTitle | ParamStyle( "Style", styleHistogram | styleOwnScale | styleThick | styleNoLabel, maskHistogram ), 2 );
_SECTION_END();

///////////// Conditions //////////////////
/////////// PR ////////////////
pr = L < Ref(L,-1) AND C > Ref(C,-1) AND C > O; // 1
KPR = L < Ref(L,-1) AND H > Ref(H,-1) AND C > Ref(C,-1) AND C > O;
PKPR = L < Ref(L,-1) AND H > Ref(H,-1) AND C > Ref(C,-1) AND C > O AND C > Ref(O,-1);

PlotShapes( PR*shapeUpArrow,colorWhite,0,L,Offset=-5 );
PlotShapes( KPR*shapeUpArrow,colorBlue,0,L,Offset=-15 );
PlotShapes( PKPR*shapeUpArrow,colorYellow,0,L,Offset=-25 );

///////////// NR //////////////////
NRL = H > Ref(H,-1) AND C < O AND C < Ref(C,-1);
KNR = H > Ref(H,-1) AND L < Ref(L,-1) AND C < O AND C < Ref(C,-1);
PKNR = H > Ref(H,-1) AND L < Ref(L,-1) AND C < O AND C < Ref(O,-1) AND C < Ref(C,-1);

PlotShapes( NRL*shapeDownArrow,colorWhite,0,H,Offset=-5 );
PlotShapes( KNR*shapeDownArrow,colorBlue,0,H,Offset=-15 );
PlotShapes( PKNR*shapeDownArrow,colorYellow,0,H,Offset=-25 );

//////////////////// Exploration starts from here ////////////////////////
Filter = PR OR KPR OR PKPR OR NRL OR KNR OR PKNR;

/////////// General Columns ////////////////////////
AddTextColumn( FullName( ), "Name" );
AddColumn(C,"Close");
AddTextColumn( MarketID( 1 ), "Market name" );

AddColumn(PR,"Positive Reversal",1.0,colorWhite,colorGreen);
AddColumn(KPR,"Key Position Reversal",1.0,colorWhite,colorBlue,-1);
AddColumn(PKPR,"Perfect KPR",1.0,colorWhite,colorRed);
AddColumn(NRL,"Negative Reversal",1.0,colorWhite,colorPink);
AddColumn(KNR,"Key Negative Reversal",1.0,colorWhite,colorPink);

AddColumn(PKNR,"Perfect Key NR",1.0,colorWhite,colorPink);
 
#3
Hi Hitesh,

Again thanks a lot for creating AFL for reversal, but here also getting an error as follows:

grid_day = IIf(Day()!=Ref(Day(),-1),1,0);

Plot(grid_day,"",colorDarkGrey,styleHistogram|styl e
---------------------------------------------------^

Error 31.
Syntax error, expecting ')' or ','

Request you to look into the issue.


Regards,
TT
 

asnavale

Well-Known Member
#4
Hi Hitesh,

Again thanks a lot for creating AFL for reversal, but here also getting an error as follows:

grid_day = IIf(Day()!=Ref(Day(),-1),1,0);

Plot(grid_day,"",colorDarkGrey,styleHistogram|styl e
---------------------------------------------------^

Error 31.
Syntax error, expecting ')' or ','

Request you to look into the issue.


Regards,
TT

You have added a space between 'styl' and 'e'. Remove it. The correct syntax is:
Plot(grid_day."".colorDarkGrey,styleHistogram | styleDashed| ....);

-Anant
 

Similar threads