PureBytes Links
Trading Reference Links
|
Rick,
I tried the counter and it didn't work.
Then I moved the counter to the end and modified as follows.
Now it works fine.
Charles
//Triple MA
counter = 0;
Shortma=MA(C,10);
MediumMA=MA(C,20);
LongerMA=MA(C,30);
Filter = ShortMA>MediumMA;// AND MediumMA>LongerMA AND
Ref(shortma,-1)<mediumMa AND C>50;
AddColumn(C,"Close");
AddColumn(Shortma,"Short");
AddColumn(MediumMA,"Medium");
AddColumn(LongerMA,"Longer");
Plot(Shortma,"10-day MA",colorRed,styleThick);
Plot(MediumMA,"20-day MA", colorBlue,styleThick);
Plot(LongerMA,"30-day MA",colorIndigo,styleThick);
//Hit counter and column
if(Status("stocknum") == 0)
StaticVarSet("string",0);
counter = StaticVarGet("string");
if(LastValue(Filter))
{
counter++;
StaticVarSet("string",counter);
}
AddColumn(counter, "counter",1.2,colorBlue);
_____
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of Rick Osborn
Sent: Saturday, January 06, 2007 11:28 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Re: adding a counting column
Tried that but didn't work either.
Anyway, thanks for trying
Rick
--- Yuki Taga <yukitaga@xxxx <mailto:yukitaga%40tkh.att.ne.jp> att.ne.jp>
wrote:
> Hi Rick,
>
> Try removing the Buy=Filter=1 statement, and
> replacing it with your
> own filter. Either that or just Filter = 1 might
> work.
>
> Yuki
>
> Sunday, January 7, 2007, 12:52:27 PM, you wrote:
>
> RO> Ran it on the NAS 100 stocks in AA and still
> blank.
>
> RO> Her is the code again - in case I got it wrong
> RO> counter = 0;
> RO> if(Status("stocknum ") == 0)
> RO> StaticVarSet( "string", 0);
>
> RO> Buy=Filter= 1;
>
> RO> counter = StaticVarGet( "string") ;
> RO>
> RO> if(LastValue( Filter))
> RO> {
> RO> counter++;
> RO> StaticVarSet( "string", counter);
> RO> }
> RO>
> RO> AddColumn(counter, "counter",1.2,colorBlue) ;
>
> RO> Rick
>
> RO> --- trb0428 <tombrowne34@ <mailto:tombrowne34%40comcast.net>
comcast.net> wrote:
>
> >> Rick,
> >>
> >> Make sure you are running this over a group of
> >> symbols as an
> >> exploration from the AA window and it will
> work.....
> >>
> >> regards,
> >> Tom
> >>
> >> --- In amibroker@xxxxxxxxx <mailto:amibroker%40yahoogroups.com> ps.com,
Rick Osborn
> >> <ricko@xxx> wrote:
> >> >
> >> > When I run the code I get blanks in the
> "counter"
> >> > column.
> >> >
> >> > Is there a setting I need to change perhaps?
> >> >
> >> > Rick
> >> >
> >> > --- Yuki Taga <yukitaga@xxx> wrote:
> >> >
> >> > > Hi Tom,
> >> > >
> >> > > This works very nicely, as long as I take out
> >> the
> >> > >
> >> > > Buy=Filter=1 statement,
> >> > >
> >> > > and use my own exclusionary filter. It
> returns
> >> just
> >> > > what I want, and
> >> > > consecutively numbers the rows.
> >> > >
> >> > > Many thanks,
> >> > >
> >> > > Yuki
> >> > >
> >> > > Friday, January 5, 2007, 4:27:00 PM, you
> wrote:
> >> > >
> >> > > t> Yuki,
> >> > >
> >> > > t> Try this:
> >> > > t>
> >> > >
> >>
> ---------------------------------------------------
> >> > > t> counter = 0;
> >> > > t> if(Status("stocknum") == 0)
> >> > > t> StaticVarSet("string",0);
> >> > >
> >> > > t> Buy=Filter= 1;
> >> > >
> >> > > t> counter = StaticVarGet("string");
> >> > >
> >> > > t> if(LastValue(Filter))
> >> > > t> {
> >> > > t> counter++;
> >> > > t> StaticVarSet("string",counter);
> >> > > t> }
> >> > >
> >> > > t> AddColumn(counter,
> "counter",1.2,colorBlue);
> >> > >
> >> > > t> regards,
> >> > > t> Tom
> >> > >
> >> > >
> >> > >
> >> > > t> --- In amibroker@xxxxxxxxx <mailto:amibroker%40yahoogroups.com>
ps.com, Yuki
> Taga
> >> > > <yukitaga@> wrote:
> >> > > >>
> >> > > >> This is probably very simple for all you
> >> > > natural-born coders out
> >> > > >> there, but not for me.
> >> > > >>
> >> > > >> I want to add a column to an exploration
> >> (that
> >> > > part is easy enough),
> >> > > >> but I want to have that column simply
> return
> >> a
> >> > > '1' on the first row,
> >> > > >> then increment by 1 for each additional
> row.
> >> > > >>
> >> > > >> AA output gives me the total number of
> rows
> >> of
> >> > > course, but sometimes
> >> > > >> I want to know where, say, the middle of
> the
> >> pack
> >> > > is, or the
> >> > > >> upper-third, or lower-third -- without
> having
> >> to
> >> > > count from the first
> >> > > >> row or the last row.
> >> > > >>
> >> > > >> Anyone?
> >> > > >>
>
>
>
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.7/618 - Release Date: 1/6/2007 7:47 PM
|