[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Re: Systems for indices



PureBytes Links

Trading Reference Links

Um,
 
Try this for the bollinger Band Pattern for both the Upper Band and Lower
Band..load into AA..
select Apply to : all stocks, current stock , filter ...etc....
Range=n last quotation and n=1
Click explore

 
//Bollinger Band Bottom crossing Pattern

//Pattern description ( 3 bar pattern )

/*The close 2 days ago ( ref(c,-2) ) is above the Lower Bollinger Band
and the Close yesterday ( Ref(C,-1)) is below the Lower bollinger Band
and the Close yesterday ( ref(c,-1)) is less than the close 2 days ago (
ref(c,-2)) and Todays Close is ** either ** Greater than yesterdays close
(ref(c,-1)) or Todays Close is Less than Yesterdays close ( ref(c,-1)).*/

BandRange=15;
BandWidth=2;

patUP = C > Ref(C,-1) AND Ref(C,-1) < BBandBot(C,BandRange,BandWidth)AND
Ref(C,-1) < Ref(C,-2) AND Ref(C,-2) > BBandBot(C,BandRange,BandWidth);

patDown = C < Ref(C,-1) AND Ref(C,-1) < BBandBot(C,BandRange,BandWidth)AND
Ref(C,-1) < Ref(C,-2) AND Ref(C,-2) > BBandBot(C,BandRange,BandWidth);

totpatUP = LastValue( Cum(patUP) );
totpatDown = LastValue( Cum( patDown ) );

totpercent = (( totpatUP/(totpatUP + totpatDown)))*100;

//% Pattern 
CondPatup=(Cum(patUP)/Cum(1))*100;
CondPatDown=(Cum(patDown)/Cum(1))*100;

/****************************************************************/
//Bollinger Band Top crossing Pattern

//Pattern description ( 3 bar pattern )

/*The close 2 days ago ( ref(c,-2) ) is below the upper Bollinger Band
and the Close yesterday ( Ref(C,-1)) is above the upper bollinger Band
and the Close yesterday ( ref(c,-1)) is Greater than the close 2 days ago (
ref(c,-2)) and Todays Close is ** either ** Greater than yesterdays close
(ref(c,-1)) or Todays Close is Less than Yesterdays close ( ref(c,-1)).*/

patUP2 = C > Ref(C,-1) AND Ref(C,-1) > BBandTop(C,BandRange,BandWidth)AND
Ref(C,-1) > Ref(C,-2) AND Ref(C,-2) < BBandTop(C,BandRange,BandWidth);

patDown2 = C < Ref(C,-1) AND Ref(C,-1) > BBandTop(C,BandRange,BandWidth)AND
Ref(C,-1) > Ref(C,-2) AND Ref(C,-2) < BBandTop(C,BandRange,BandWidth);
 
totpatUP2 = LastValue( Cum( patUP2 ) );
totpatDown2 = LastValue( Cum( patDown2 ) );

totpercent2 = ((totpatDown2/( totpatUP2 + totpatDown2)))*100;

bars=Cum(1);

//% Pattern2
CondPatup2=(Cum(patUP2)/Cum(1))*100;
CondPatDown2=(Cum(patDown2)/Cum(1))*100;

Filter = 1;//totpatUP > 0;

//Columns for Lower Bollinger Band pattern

AddColumn(totpatUP,"# L_BolPatUP",1);
AddColumn(totpatDown,"# L_BolPatDown",1);
AddColumn(totpercent,"% win",1.2);
AddColumn(bars,"barsInTest",1); 
AddColumn(CondpatUp,"% L_BolPatUP",1.2);
//AddColumn(CondPatDown,"% Pat_DOWN",1.2);

/****************************************************************/
//Columns for Upper Bollinger Band pattern

AddColumn(totpatUP2,"# U_BolPatUP",1);
AddColumn(totpatDown2,"# U_BolPatDown",1);
AddColumn(totpercent2,"% win" , 1.2);
//AddColumn(CondpatUp2,"% Pat_UP2",1.2);
AddColumn(CondPatDown2,"% Pat_DOWN2",1.2);

/********************************************************************/

Anthony
 
 

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get Home Early - Access Your work PC
http://us.click.yahoo.com/usvdqB/Yq8FAA/uetFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/