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

[amibroker] Batman use with sector analysis - questions



PureBytes Links

Trading Reference Links

Batman and sector analysis gurus,

I am using two sector analysis scripts in Batman. I would like to 
use the Weekly periodicity for my analysis, although I am have a 
feeling these two scripts will only work using the daily periodicity 
in Batman. I have saved the appropriate .ABS files for both the 
daily and weekly periodicities, and have tested these scripts 
together, but the results just don't seems to come out at all using 
a Weekly periodicity. 

I run the first script as a batch job in Batman. Then Batman 
automatically runs the second script (see below). The second script 
uses the LineRepSlope to determine the relative strength of each 
market sector. The sector analysis uses sector composites that are 
create in the first script, drawing from TC2005 EOD stock data.

How do I work with these scripts to get Weekly results that make 
sense?

/* WEEKLY (OR DAILY) SECTOR CREATION - SCAN */
/*
STEP 1: 
Select all stocks available, or Group 1 or Watchlist 3. Set n=1. 
SCAN the watch list to create the composites. Settings should be 
set to Weekly or Daily, as needed.

Sector creation must occur every day, since stocks used to create
the sector composites will be updated daily with new price 
information.
*/

SetBarsRequired(540,540);
Buy=0;
newhigh=H>Ref(HHV(H,10),-1); //stocks making new high
newlow=L<Ref(LLV(L,10),-1); //Stocks making new low
up=C>Ref(C,-1);
dn=C<Ref(C,-1);
upvol=IIf(up,V/C,0);
dnvol=IIf(dn,V/C,0);
//x=SectorID(0);
sym="~"+SectorID(1);
isym="~i"+SectorID(1);
Ad="~AD"+SectorID(1);
AddToComposite(C,sym ,"C"); //adds Close data to sector
AddToComposite(V/1000,sym,"V"); // adj vol overflow
AddToComposite(1,sym,"O"); //counts stocks
AddToComposite(IIf(newhigh,1,0),sym,"H");//counts new highs
AddToComposite(IIf(newlow,1,0),sym,"L");//Counts new Lows
//creates a master index of stocks under study
AddToComposite(C,"~Universe" ,"c"); 
AddToComposite(V/1000,"~Universe" ,"v"); 
AddToComposite(1,"~Universe" ,"O"); //counts stocks 
AddToComposite(newhigh,"~Universe","H");
AddToComposite(Newlow,"~Universe","L");
//creates master index of OHLC data 
AddToComposite(C,"~Index","C");
AddToComposite(O,"~Index","O");
AddToComposite(H,"~Index","H");
AddToComposite(L,"~Index","l");
AddToComposite(1,"~index","V");//counts stocks in index
//creates index by sector
AddToComposite(C,isym,"C");
AddToComposite(O,isym,"O");
AddToComposite(H,isym,"H");
AddToComposite(L,isym,"L");
AddToComposite(1,isym,"V"); 
//creates advance /decline by sector composite
AddToComposite(up,Ad,"C");
AddToComposite(dn,Ad,"O");
AddToComposite(upvol,Ad,"H");
AddToComposite(dnvol,Ad,"L");


/* WEEKLY (OR DAILY) SECTOR RANKING - EXPLORATION */
/*
STEP 2:
Select n=1. Select the SECTOR COMPOSITES watchlist 5 from Step 2. 
Click Explore.

Click on the "NOW" field, to sort the data. Those sectors above the 
Index ticker (a blue line in the result window) are outperforming 
the group as a whole, those below the Index ticker are lagging. 
The colors make it easy to see the trend. The numbers in the 
cross column indicate when the sector crossed the index. By 
clicking on a previous day columns you can quickly see how the 
position of a given sector is moving. You can adjust the look 
back by adjusting the number in the RSC line. Settings should be 
set to Weekly or Daily, as needed.
*/

Filter=C>0;
x=RelStrength("~index");
RSC=LinRegSlope(x,7);
AddColumn(IIf(rsc>0,BarsSince(rsc<=0),BarsSince
(rsc>=0)),"Cross",1.0);
AddColumn(RSC,"NOW",1.2,colorDefault,IIf(RSC==0,colorBlue,IIf(rsc>Ref
(rsc,-1),colorBrightGreen,colorPink)));
AddColumn(Ref(RSC,-1),"-1 bar",1.2,colorDefault,IIf
(RSC==0,colorBlue,IIf(Ref(rsc,-1)>=Ref(rsc,-
2),colorBrightGreen,colorPink)));
AddColumn(Ref(RSC,-2),"-2 bars",1.2,colorDefault,IIf
(RSC==0,colorBlue,IIf(Ref(rsc,-2)>=Ref(rsc,-
3),colorBrightGreen,colorPink)));
AddColumn(Ref(rsc,-3),"-3 bars",1.2,colorDefault,IIf
(RSC==0,colorBlue,IIf(Ref(rsc,-3)>=Ref(rsc,-
4),colorBrightGreen,colorPink)));
AddColumn(Ref(rsc,-4),"-4 bars",1.2,colorDefault,IIf
(RSC==0,colorBlue,IIf(Ref(rsc,-4)>=Ref(rsc,-
5),colorBrightGreen,colorPink)));
AddColumn(Ref(rsc,-5),"-5 bars",1.2,colorDefault,IIf
(RSC==0,colorBlue,IIf(Ref(rsc,-5)>=Ref(rsc,-
6),colorBrightGreen,colorPink)));
AddColumn(Ref(rsc,-6),"-6 bars",1.2,colorDefault,IIf
(RSC==0,colorBlue,IIf(Ref(rsc,-6)>=Ref(rsc,-
7),colorBrightGreen,colorPink)));
AddColumn(Ref(rsc,-7),"-7 bars",1.2,colorDefault,IIf
(RSC==0,colorBlue,IIf(Ref(rsc,-7)>=Ref(rsc,-
8),colorBrightGreen,colorPink)));
AddColumn(Ref(rsc,-8),"-8 bars",1.2,colorDefault,IIf
(RSC==0,colorBlue,IIf(Ref(rsc,-8)>=Ref(rsc,-
9),colorBrightGreen,colorPink)));
AddColumn(Ref(rsc,-9),"-9 bars",1.2,colorDefault,IIf
(RSC==0,colorBlue,IIf(Ref(rsc,-9)>=Ref(rsc,-
10),colorBrightGreen,colorPink)));
AddColumn(Ref(rsc,-10),"-10 bars",1.2,colorDefault,IIf
(RSC==0,colorBlue,IIf(Ref(rsc,-10)>=Ref(rsc,-
11),colorBrightGreen,colorPink)));


Thanks in advance!!

Brian