Here's a more generic version with 2 atc symbols generated. I'll 
eventually want to have more than 2 options. The plot code doesn't 
work, though, and i can't think of another way to approach it except 
with the ParamList attempt i have made below.

Suggestions appreciated.

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

Filter=1;
Buy=Sell=Short=Cover=0;

BpctPeriods1 = Param("ATC B%Periods1", 26, 1, 252, 1);
BpctPeriods2 = Param("ATC B%Periods2", 53, 1, 252, 1);

Count1 = IIf(C > MA(C, BpctPeriods1), 1, 0);
Count2 = IIf(C > MA(C, BpctPeriods2), 1, 0);

sym1 = "~" + SectorID(1) + " B%-" + NumToStr(BpctPeriods1, 1.0);
AddToComposite(Count1, sym1,"C");
AddToComposite(1, sym1,"I");

sym2 = "~" + SectorID(1) + " B%-" + NumToStr(BpctPeriods2, 1.0);
AddToComposite(Count2, sym2,"C");
AddToComposite(1, sym2,"I");

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

/*the following 3 lines get the bullish % symbol generated from the 
atc depending on the sector composite which is being displayed*/

TickerLength = StrLen( Name() );
BpctTicker1 = "~" + StrRight(Name(), TickerLength-1) + " B%-" + 
NumToStr(BpctPeriods1, 1.0);
BpctTicker2 = "~" + StrRight(Name(), TickerLength-1) + " B%-" + 
NumToStr(BpctPeriods2, 1.0);

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

// this is the part that isn't working - HEP ME, Please!

PlotOption = ParamList("Which B% Plot?", "BpctTicker1,BpctTicker2", 
1);

Bpct = (Foreign(BpctTicker1, "C") / Foreign(BpctTicker1, "I"))*100 ; 

MAPeriods = Param("Smoothing Period", 19, 1, 19);

Plot(EMA(Bpct, MAPeriods), "Bullish %", colorBlack, styleLine);

--- In [EMAIL PROTECTED] <mailto:amibroker%40yahoogroups.com> ps.com,
"timgadd" <[EMAIL PROTECTED]> wrote:
>
> Graham,
> 
> Thanks for the response.
> 
> So are you saying to calculate a sym1, sym2, ... with the different 
> moving averages and then what? Use something like ParamList in the 
> plot code to enable selection of which sym to display?
> 
> Tim
> 
> --- In [EMAIL PROTECTED] <mailto:amibroker%40yahoogroups.com> ps.com,
Graham <kavemanperth@> wrote:
> >
> > Just add to the code you already ahve, basically duplicating it 
with
> > different MA length and composite details
> > 
> > -- 
> > Cheers
> > Graham
> > AB-Write >< Professional AFL Writing Service
> > Yes, I write AFL code to your requirements
> > http://www.aflwriti <http://www.aflwriting.com> ng.com
> > 
> > 
> > 
> > On 16/03/07, timgadd <timgadd@> wrote:
> > > I have an atc scan and associated plot (afl below) that 
calculates
> > > the % of stocks in a group which are above a moving average. 
The 
> ma
> > > periods can be changed prior to running the atc scan using 
Param. 
> I
> > > assume that the closest i can get to having an interactively-
> changing
> > > plot is to run a scan for each ma period that i want to 
> investigate.
> > > Is this correct?
> > >
> > > In other words, if i want to plot the % of stocks in a group 
which
> > > are above a 26 period ma instead of a 50 period ma, i need to 
run
> > > another atc scan, right?
> > >
> > > tia,
> > >
> > > Tim
> > >
> > > ////////////////////////////////////////
> > >
> > > Filter=1;
> > > Buy=Sell=Short=Cover=0;
> > >
> > > MAPeriods = Param("Bars for B% MA", 50, 1, 252, 1);
> > >
> > > Count = IIf(C > MA(C, MAPeriods), 1, 0);
> > >
> > > sym = "~" + SectorID(1) + " Above MA";
> > > AddToComposite(Count, sym,"C");
> > > AddToComposite(1, sym,"I");
> > >
> > > Bpct= (Foreign("~REAL ESTATE Above MA", "C") / Foreign("~REAL 
> ESTATE
> > > Above MA", "I"))*100 ;
> > > // I'll eventually attempt to change the line above to use the
> > > currently-displayed composite instead of a specific one
> > >
> > > Plot(Bpct, "Bullish %", colorBlack, styleLine);
> > >
> > >
> > >
> > >
> > > Please note that this group is for discussion between users 
only.
> > >
> > > To get support from AmiBroker please send an e-mail directly to
> > > SUPPORT {at} amibroker.com
> > >
> > > For NEW RELEASE ANNOUNCEMENTS and other news always check 
DEVLOG:
> > > http://www.amibroke <http://www.amibroker.com/devlog/> r.com/devlog/
> > >
> > > For other support material please check also:
> > > http://www.amibroke <http://www.amibroker.com/support.html>
r.com/support.html
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> >
>



 

Reply via email to