AFL Request : Help Needed

singhboy

Active Member
#2
can any1 pls write afl to scan for stocks which r higher than last 4 days highest price ?
 

pkgmtnl

Well-Known Member
#3
Buy=C>Ref(C,-1) AND Ref(C,-1)>Ref(C,-2) AND Ref(C,-2)>Ref(C,-3) AND Ref(C,-3)>Ref(C,-4);

Filter = Buy ;
AddColumn( Ref(C,-4), "D4" );
AddColumn( Ref(C,-3), "D3" );
AddColumn( Ref(C,-2), "D4" );
AddColumn( Ref(C,-1), "YESTERDAY " );
AddColumn( Close, "Close" );
 

asnavale

Well-Known Member
#4
Kindly Provide AFL for " No. of Bars formed so far from the Selected Bar ".
Hi Boss,

Here is the AFL you needed:

X = SelectedValue(BarIndex());
Y = LastValue(BarIndex());
Z = Y - X;

_N(Title = StrFormat("{{NAME}}, {{DATE}} - {{INTERVAL}} : {{OHLCX}}, V=%1.0f\nSelectedBar=%1.0f, Bars formed since SelectedBar=%1.0f, Total Bars=%1.0f", V, X, Z, Y));

Plot(C, "", colorGrey50, styleBar);


Copy this AFL in "Formulas\Custom" folder in AmiBroker directory. Double Click to plot it. As you move the Selector Line in the chart, the information appears in the title.


-Anant
 

asnavale

Well-Known Member
#5
Buy=C>Ref(C,-1) AND Ref(C,-1)>Ref(C,-2) AND Ref(C,-2)>Ref(C,-3) AND Ref(C,-3)>Ref(C,-4);

Filter = Buy ;
AddColumn( Ref(C,-4), "D4" );
AddColumn( Ref(C,-3), "D3" );
AddColumn( Ref(C,-2), "D4" );
AddColumn( Ref(C,-1), "YESTERDAY " );
AddColumn( Close, "Close" );
Hi PKG,

the 4th line should be:

AddColumn(Ref(C, -2), "D2");

-Anant
 

asnavale

Well-Known Member
#7
can any1 pls write afl to scan for stocks which r higher than last 4 days highest price ?
Hi Singhboy,

Here is the AFL you wanted:


H4 = HHV(H, 5) == H;

Filter = H4;

SetOption("NoDefaultColumns", True);

AddTextColumn(Name(), "Symbol");
AddColumn(DateTime(), "Date", formatDateTime);
AddColumn(C, "CMP", 1.2);


Run it in Automatic Analysis and Explore.

-Anant
 

Mangafreakz

Well-Known Member
#8
Is this AFL possible ? I want to view the number of 3 , 4 , 5 , 6 green/red bars in a row out of the last 240 bars.
 

singhboy

Active Member
#10
thanks for afls guys, can u write one more to scan for stocks in which 14 period RSI cross its exponential moving avg of 9 periods? im attaching an image for better understnding. In the image u can see green line is 14 period RSI and red line is 9 period exp mov avg of RSI. Now can u pls write afl to scan buy n sell signals on this condition? Thnx
 
Last edited:

Similar threads