I did give it a shot some while back, until I gave up since I couldn't match 
his results. I will post the code to get you started. As a warning, it is 
UNFINISHED WORK IN PROGRESS. 

You are welcome to check and make it work for you. If you do please let me know.
I am a begginer in amibroker so bear with me.... I actually tried a modified 
version of the following script to track recent Volume 
accumulation/Distribution but without  luck....

 Do not backtest this. The results are unrealistic (see bulkowski for 
explanation).

Two scripts: One to calculate the composite and one to plot the results.


First Script: Run as SCAN on watchlist of Companies (i.e. SP500)
////////////////////////////////////
_SECTION_BEGIN("CPI Calc");
range=H-L;
NR7=range<Ref(range,-1) AND range<Ref(range,-2) AND range<Ref(range,-3) AND 
range<Ref(range,-4) AND range<Ref(range,-5) AND range<Ref(range,-6);

lnr7=LLV(L,7);
lnr7bar=LLVBars( L, 7 );
Hnr7=HHV(H,7);
Hnr7bars=HHV(H,7);




bullbrkt=C>Ref(Hnr7,-1) AND BarsSince(nr7)<=7 ;
bullbrkt=ExRem(bullbrkt,nr7);


bearbrkt=C<Ref(lnr7,-1) AND BarsSince(nr7)<=7 ;
bearbrkt=ExRem(bearbrkt,nr7);

////////////////////
bullsignal=0;
bearsignal=0;
pendingbrkt=0;
for( i = 9; i < BarCount; i++ ) 
{
        if (bullbrkt[i]) ///if bull breakout
                {
                        bullsignal[i]=1; ///set bullsignal to 1 for //this bar
                        for( n = 0; n < 8; n++ ) //go back 7 bars and //find 
NR7 signal
                                {
                                if (nr7[i-n]==0) // go backwards and //keep 
setting bullsignal to 1 until NR7
                                        {
                                                bullsignal[i-n]=1; ///set 
bullsignal to all bars between Breakout bar and NR7 bar
                                                bullsignal[i-n-1]=1; //include 
NR7 bar
                                                pendingbrkt[i]=0;
                                        }
                                else
                                        n=9;  //
                                }
                        }
        else if (bearbrkt[i])
                {
                        bearsignal[i]=1; ///set bearsignal to 1 for //this bar
                        for( n = 0; n < 8; n++ ) //go back 7 bars and //find 
NR7 signal
                                {
                                if (nr7[i-n]==0) //
                                        {
                                                bearsignal[i-n]=1; ///set 
bullsignal to all bars between Breakout bar and NR7 bar
                                                bearsignal[i-n-1]=1; //include 
NR7 bar
                                                pendingbrkt[i]=0;
                                        }
                                else
                                        n=9;  //
                                }
                        }
        else
                {
                        bullsignal[i]=0;
                        bearsignal[i]=0;
                        pendingbrkt[i]=nr7[i];
                }
}

pendingbrkt=Flip(pendingbrkt,bullsignal OR bearsignal);

////////////////////
AddToComposite(bullsignal,"~nr7bull","V");
AddToComposite(bearsignal,"~nr7bear","V");
AddToComposite(pendingbrkt,"~nr7PendingBrkts","V");
AddToComposite(1,"~nr7count","V");
Buy=0;




Plot(Hnr7,"",colorBlack);

PlotShapes(IIf(NR7,shapeStar,shapeNone),colorRed,0,H);
PlotShapes(IIf(bullbrkt,shapeUpArrow,shapeNone),colorGreen,0,L);
PlotShapes(IIf(bearbrkt,shapeDownArrow,shapeNone),colorRed,0,H);

Plot(bullsignal,"",colorGreen,styleOwnScale+styleHistogram);
Plot(bearsignal,"",colorRed,styleOwnScale+styleHistogram);


//"pending bkrt" + pendingbrkt;
_SECTION_END();

_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", colorBlack ), styleNoTitle | 
ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();

/////////////////

Second Script: PLOT COMPOSITE & Stats:
/////////////////////////////////////////


_SECTION_BEGIN("CPI PLOT");
CPI= 100 * Foreign ("~nr7bull","V") / (Foreign ("~nr7bull","V")+ Foreign 
("~nr7bEAR","V"));

Plot(CPI,"CPI",colorBlack);
Plot(65,"BULLISH",colorGreen);
Plot(35,"BEARISH",colorRed);
/////////////////////////////////////////////////


Buy=Cross(CPI,65);
Short=Cross(35,CPI);


Sell=Short;
Cover=Buy;


shape = Buy * shapeUpArrow + Sell * shapeDownArrow;

PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, CPI, CPI) );
_SECTION_END();


Title =  "{{DATE}} - CPI= "
+"bullish Percent breakout="
+" "
+Cpi
+ "   Bullish Breakouts= "
+Foreign ("~nr7bull","V")
+""
+ "   Bearish Breakouts= "
+Foreign ("~nr7bear","V")
+""
+ "   Pending Breakouts= "
+Foreign ("~nr7PendingBrkts","V")
+""
+ "   % of companies Pending Signal= "
+100 * Foreign ("~nr7PendingBrkts","V") / Foreign ("~nr7count","V")
+"%";
/////////////////end of 2nd script///////////////////////////////

Good Luck,
Vangelis


--- In [email protected], "droskill" <drosk...@...> wrote:
>
> Appreciate the feedback - I was interest if anyone had programmed the core of 
> the CPI to check it on, say, the S&P500.
> 
> --- In [email protected], Jeff Henderson <jeffro861@> wrote:
> >
> > Bulkowski is a joke. CPI is a joke because hr doesn't update it till after 
> > the fact.  I've tried to duplicate his experiments with data only to 
> > realize after we communicated via email that he preselects his stock 
> > universe using subjective opinion!  This guy is every person in sales that 
> > I despise.  The majority of his results were obtained in a bull market. 
> > Your better off looking on ssrn.com for good research.
> >
>


Reply via email to