Australian (ASX) Stock Market Forum

Amibroker - Scanning for Trading Ideas

CanOz

Home runs feel good, but base hits pay bills!
Joined
11 July 2006
Posts
11,543
Reactions
519
Dan was looking for ideas for scans a while back. I found an old Pull Back Scan that i got somewhere...

I then combined it visually with an ADX and Simple Momentum Indicators and presto, you have a nice little scan.

What i do is scan first, then transfer a portion to a watch-list.

Then eyeball them, but using the ADX and the momentum indicator. Then i look for patterns in stocks with strong trends.

Hope this helps anyone looking for a simple way to scan. Those with coding skills might want to scan for the whole thing at one time. I actually like eyeballing charts, its quite exciting to look through lots of charts with the view of finding opportunities.

CanOz

Code:
 //======================= Variables ==================================================================================================================

// PullBack Parameters
DLL1 = Ref(H,-1) > Ref(HHV(H,20),-2) AND H < Ref(H,-1);
DLL2 = Ref(H,-2) > Ref(HHV(H,20),-3) AND H < Ref(H,-2);
DLL3 = Ref(H,-3) > Ref(HHV(H,20),-4) AND H < Ref(H,-3);
DLL4 = Ref(H,-4) > Ref(HHV(H,20),-5) AND H < Ref(H,-4);
DLL5 = Ref(H,-5) > Ref(HHV(H,20),-6) AND H < Ref(H,-5);
DLL6 = Ref(H,-6) > Ref(HHV(H,20),-7) AND H < Ref(H,-6);
DLL7 = Ref(H,-7) > Ref(HHV(H,20),-8) AND H < Ref(H,-7);
DLL8 = Ref(H,-8) > Ref(HHV(H,20),-9) AND H < Ref(H,-8);  
DLL= H < Ref(HHV(H,20),-1);
DLS1 = Ref(L,-1) < Ref(LLV(L,20),-2) AND L > Ref(L,-1);
DLS2 = Ref(L,-2) < Ref(LLV(L,20),-3) AND L > Ref(L,-2);
DLS3 = Ref(L,-3) < Ref(LLV(L,20),-4) AND L > Ref(L,-3);
DLS4 = Ref(L,-4) < Ref(LLV(L,20),-5) AND L > Ref(L,-4);
DLS5 = Ref(L,-5) < Ref(LLV(L,20),-6) AND L > Ref(L,-5);
DLS6 = Ref(L,-6) < Ref(LLV(L,20),-7) AND L > Ref(L,-6);
DLS7 = Ref(L,-7) < Ref(LLV(L,20),-8) AND L > Ref(L,-7);
DLS8 = Ref(L,-8) < Ref(LLV(L,20),-9) AND L > Ref(L,-8);
DLS = L > Ref(LLV(L,20),-1);

// Price and Volume 
PVFilter = (C>15) AND Ref(MA(V,50),-1)>100000;

// Dave Landry PullBack Scan
DLPBS = ((DLL AND (DLL1 OR DLL2 OR DLL3 OR DLL4 OR DLL5 OR DLL6 OR DLL7 OR DLL8)) OR (DLS AND (DLS1 OR DLS2 OR DLS3 OR DLS4 OR DLS5 OR DLS6 OR DLS7 OR DLS8))) AND PVFilter;  

// Moving Average Proper Order
MAProperOrder = (MA(C,10) > EMA(C,20) AND EMA(C,20) > EMA(C,30)) OR (MA(C,10) < EMA(C,20) AND EMA(C,20) < EMA(C,30));

// How far the stock has moved in the past month (preferable at least 10 pts in the past 20 days)
TenTwentyFilter = HHV(H,20)-LLV(L,20);

// 50 Day Historical Volatility
FiftyDayHVFilter = round(StDev(log(C/Ref(C,-1)),50)*100*sqrt(256));

// 6/100 Historical Volatility
HVSixOneHundred = (StDev(log(C/Ref(C,-1)),6)*100*sqrt(256)) / (StDev(log(C/Ref(C,-1)),100)*100*sqrt(256));

//=================== End Variables =================================================================================================================

//=================== Columns =======================================================================================================================

NumColumns = 6;

Column0 = FullName();     
Column0Name = "Ticker name";
           
Column1	  = DLL AND (DLL1 OR DLL2 OR DLL3 OR DLL4 OR DLL5 OR DLL6 OR DLL7 OR DLL8);
Column1Name = "Buy Signal";

Column2     = DLS AND (DLS1 OR DLS2 OR DLS3 OR DLS4 OR DLS5 OR DLS6 OR DLS7 OR DLS8);
Column2Name = "Sell Signal"; 

Column3	  = HVSixOneHundred;
Column3Name  = "HV6/100 Value";

Column4		= FiftyDayHVFilter;
Column4Name	="HV50 Value";

Column5     = TenTwentyFilter;
Column5Name = "10/20 Value";

AddTextColumn( IndustryID(1), "Industry" );

AddTextColumn( MarketID(1), "Market" );

//==================== End Columns ===================================================================================================================

//==================== Filter and Buy/Sell criteria ==================================================================================================

// Filter based on 20 day hi/lo pullback, price and volume criteria.
Filter = DLPBS; // Delete this line and use the next line if you desire the moving averages to be scanned in "proper order".
//Filter = DLPBS AND MAProperOrder; 
Buy  = Column1;
Sell = Column2;

//====================  End Filter and Buy/Sell criteria =============================================================================================

//======================= Chart Layout  ==============================================================================================================

// OHLC bar graph with headings
_SECTION_BEGIN("Price"); 
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorYellow ), styleBar | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();

// 20 period linear regression line
x = Cum(1); //
lastx = LastValue( x ); Daysback = 20; aa = LastValue( LinRegIntercept( Close, Daysback) );
bb = LastValue( LinRegSlope( Close, Daysback ) );
y = Aa + bb * ( x - (Lastx - DaysBack) ); 
Plot( IIf( x >= (lastx - Daysback), y, -1e10 ), "LinReg", colorCustom11 );

PlotForeign(GetBaseIndex(),IndustryID(1),colorWhite,styleLine|styleLeftAxisScale);

// 10 period SMA
_SECTION_BEGIN("MA");
P = ParamField("Price field",-1);
Periods = Param("Periods",10 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorBlue ), ParamStyle("Style") ); 
_SECTION_END();

// 20 period EMA
_SECTION_BEGIN("EMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 20 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorRed ), ParamStyle("Style") ); 
_SECTION_END();

// 30 period EMA
_SECTION_BEGIN("EMA1");
P = ParamField("Price field",-1);
Periods = Param("Periods", 30);
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCustom12 ), ParamStyle("Style") ); 
_SECTION_END();

// Add the 10-20 filter, 50 Day HV and 6/100 Day HV as a different screen, just cut and paste each one to a separate Formula Editor Sceen and save them under
// Custom Indicators...then drop them into the main screen.

// 10-20 filter
// _SECTION_BEGIN("TenTwentyValue");
// TenTwentyValue = HHV(H,20)-LLV(L,20);
// Plot(TenTwentyValue,"10/20 Value",colorCustom11,styleLine);
// _SECTION_END();

// 50 day historical volotility
// _SECTION_BEGIN("HV50");
// HV50 = round(StDev(log(C/Ref(C,-1)),50)*100*sqrt(256));
// Plot(HV50,"HV50",colorBrightGreen,styleLine);
// _SECTION_END();

// 6/100 day historical volotility
// _SECTION_BEGIN("HVSixOneHundred");
// HVSixOneHundred = (StDev(log(C/Ref(C,-1)),6)*100*sqrt(256)) / (StDev(log(C/Ref(C,-1)),100)*100*sqrt(256));
// Plot(HVSixOneHundred,"HV 6/100",colorOrange,styleLine);
// _SECTION_END();

//======================= End Chart Layout  ============================================================

IT might be nice for others to post some scanning ideas here...:xyxthumbs
 

Attachments

  • AME Daily.png
    AME Daily.png
    35.9 KB · Views: 45
Looks interesting mate! Thanks for that!!
I'll have to try move similar criteria into a free screener until I the full version of AB and PD

Thanks again
 
A couple of people are still wondering how to look for trading ideas. Here is how i do it.

1.) Sign into The Chartist and check the Power Setups. These are the ones i normally always take, then i scan for my own as well, only taking ones that are really good patterns in strong trends. Quite often I'll find a few of the same same stocks as The Chartist.

2.) Open Amibroker
a.) Run my Pull back Scan on the Russel 3000
b.) Isolate the sell signals and move them to my watch list "US Stocks - Shorts
c.) Got to watch list and load my Grail charts template.
d.) Look, i.e. Eyeball, for bearish continuation patterns, flags, pennants, ledges. Once the euities are in the list, you just down arrow through them, stopping to examine the more obvious patterns. If its not obvious, its not there.
e.) Keep the good patterns and move out the remainder.
f.) Repeat with the longs.
 

Attachments

  • scans.PNG
    scans.PNG
    30.8 KB · Views: 39
I just found this one, i like these well defined trend lines...lots of people watching it...usually a good chance to get some nice liquidation.
 

Attachments

  • JBH.png
    JBH.png
    31.2 KB · Views: 41
I had a thought of scanning for a daily ROC that is higher than any previous given day.

This is the line I took but it doesn't do the job. First I think the ROC for a particular day has to be known and then the present day ROC compared to any of those past days. In this case any of the past 21 days. Any fix appreciated muchly.


Code:
// Percent change higher than any previous day

Day1 = Ref(ROC(C,1),-1); // Percentage Rate Of Change 1 day ago 
Day2 = Ref(ROC(C,1),-2); // Percentage Rate Of Change 2 days ago
Day3 = Ref(ROC(C,1),-3);
Day4 = Ref(ROC(C,1),-4);
Day5 = Ref(ROC(C,1),-5);
Day6 = Ref(ROC(C,1),-6);
Day7 = Ref(ROC(C,1),-7);
Day8 = Ref(ROC(C,1),-8);
Day9 = Ref(ROC(C,1),-9);
Day10 = Ref(ROC(C,1),-10);
Day11 = Ref(ROC(C,1),-11);
Day12 = Ref(ROC(C,1),-12);
Day13 = Ref(ROC(C,1),-13);
Day14 = Ref(ROC(C,1),-14);
Day15 = Ref(ROC(C,1),-15);
Day16 = Ref(ROC(C,1),-16);
Day17 = Ref(ROC(C,1),-17);
Day18 = Ref(ROC(C,1),-18);
Day19 = Ref(ROC(C,1),-19);
Day20 = Ref(ROC(C,1),-20);
Day21 = Ref(ROC(C,1),-21);

Filter = ROC(C,1) > Highest(Day1 OR Day2 OR Day3 OR Day4 OR Day5 OR Day6 OR Day7 OR Day8 OR Day9 OR Day10 OR Day11 OR Day12 
OR Day13 OR Day14 OR Day15 OR Day16 OR Day17 OR Day18 OR Day19 OR Day20 OR Day21);

AddColumn(C, "% Higher", 1.3, colorBlue, colorSeaGreen);
 
Code:
// Percent change higher than any previous day

ROCcheck = ROC(C, 1);
Filter = ROCcheck > Ref(HHV(ROCcheck, Param("ROC Lookback", 21, 1, 250, 1)),-1);
AddColumn(C, "ROC Higher", 1.3, colorBlue, colorSeaGreen);
 
Nice and simple. Thank you rest n recuperation.

Perhaps relevant to the current season....the alternative would be along the lines of risk-n-reward.

You could also scan for an increase in momentum!

Code:
MomPrd = 1;
MomChange = 12;
Filter = ROC(C,MomPrd)>MomChange;
Filter;


Cheers
Rob
 
Top