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

RE: [amibroker] Re: Help with AD Ratio



PureBytes Links

Trading Reference Links

Kyle,

Take a look at the code below that I have been working on with another member. It’s a bit different approach from yours, based on Volume.  It does a plot of the ADRatio of Volume. You might be able to get some ideas from it.

 

Enjoy,

 

Donald F Lindberg

------------------------ Begin Code -------------------------------

UpVol = ValueWhen(C > Ref(C,-1), V);

DownVol = ValueWhen(C < Ref(C,-1), V);

UPV=Sum(UpVol,1);

DNV=Sum(DownVol,1);

TOTVOL = (UPV+DNV);

Period = Param("Period",3,2,10,1);

UpVolAvg = EMA( UPV, Period ) ;

DownVolAvg = EMA( DNV, Period ) ;

ADRatio= IIf(DNV>UPV,(DNV*-1)/UPV, UPV/DNV);

Plot(UPV,"UpVolume", colorGreen,styleHistogram);

Plot(UpVolAvg,"UpVolume Avg", colorBlue,styleHistogram);

Plot(DNV, "DownVolume", colorDarkRed,styleHistogram);

Plot(DownVolAvg, "DownVolume Avg", colorBrown,styleHistogram);

Plot(ADRatio,"Advance Decline Ratio",colorBlack,styleLine|styleOwnScale|styleThick);

Buy = C;

AddToComposite(UPV, "~UPV", "X" );

AddToComposite(DNV, "~DNV", "X" );

AddToComposite(TOTVol, "~TOTVol", "X" );

 

---------------------------- End Code -------------------------------------------


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of smithkt9675
Sent: Monday, October 08, 2007 8:10 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Help with AD Ratio

 

Yes it did help very much, thank you Don. It looks much better and I
like the adjusted title. I think the source I was replicating
normalizes their data, and I'm inquiring as to their process.

Would you know how to plot this same style histogram for an up/down
volume ratio? I'm sure it just involves and extra step and I'm
working on getting the order of operations correct. Thank you very
much.

Kyle

--- In amibroker@xxxxxxxxxps.com, "Don Lindberg" <dlindber@xx.> wrote:
>
> Glad to help. Did you get my modification of your code? Did that
help any?
>
>
>
> Enjoy,
>
>
>
> Donald F Lindberg
>
> _____
>
> From: amibroker@xxxxxxxxxps.com [mailto:amibroker@xxxxxxxxxps.com]
On Behalf
> Of smithkt9675
> Sent: Sunday, October 07, 2007 8:00 PM
> To: amibroker@xxxxxxxxxps.com
> Subject: [amibroker] Re: Help with AD Ratio
>
>
>
> Thank you very much Don. I am running this against all the
> constituents of the NYSE and the source I'm trying to replicate is
an
> institutional research firm that issues a daily technical analysis
> piece. They use the NYSE as well, but their numbers and the degree
> of movements up and down look different. Perhaps, if my formula
does
> look OK, I'll inquire as to why their numbers look different.
Thanks
> again for your help and please let me know if there is anything
that
> looks off. Kind Regards.
>
> --- In amibroker@xxxxxxxxx <mailto:amibroker%40yahoogroups.com>
ps.com, "Don
> Lindberg" <dlindber@> wrote:
> >
> > Ok, a couple of questions so that we can compare apples to apples.
> >
> > First what stocks are you running this against? All of the stocks
> in your
> > database, or only stocks in a certain market, or some other
limiting
> > criteria ?
> >
> > Secondly, you mentioned it did not match a source you are trying
to
> > replicate. What is the source, and again what stock universe are
> they
> > running against?
> >
> >
> >
> > I have run your formula against watch lists I use for figuring AD
> and it
> > appears to be OK.
> >
> >
> >
> >
> >
> > Donald F Lindberg
> >
> > _____
> >
> > From: amibroker@xxxxxxxxx <mailto:amibroker%40yahoogroups.com>
ps.com
> [mailto:amibroker@yahoogrou <mailto:amibroker%40yahoogroups.com>
ps.com]
> On Behalf
> > Of smithkt9675
> > Sent: Saturday, October 06, 2007 8:04 PM
> > To: amibroker@xxxxxxxxx <mailto:amibroker%40yahoogroups.com>
ps.com
> > Subject: [amibroker] Help with AD Ratio
> >
> >
> >
> > Hello, I'm trying to plot the Advance/Decline Ratio so that
> advancers
> > show up 3:1 for example, and decliners show up as -3:1, so that
> > declining days appears as a negative breadth thrust and advancers
> > positive...all along a zero line in histogram form. The formula
> > looks right, but when compared to a source I'm trying to
replicate
> > the figures look off. Please advise if I should tweak the
formula.
> > I'm using Yahoo data. Thank you very much.
> >
> > symz="~Advancers";
> > symy="~Decliners";
> > Advance=Close>Ref(Close,-1);
> > Advance1=Advance>0;
> > Decline=Close<Ref(Close,-1);
> > Decline1=Decline>0;
> > IIf(Advance1>0,AddToComposite(Advance1,symz,"C"),0);
> > IIf(Decline1>0,AddToComposite(Decline1,symy,"C"),0);
> >
> > AD1=Foreign("~Advancers","C");
> > DC1=Foreign("~Decliners","C");
> >
> > ADRatio= IIf(DC1>AD1,(DC1*-1)/AD1, AD1/DC1);
> >
> > Buy=0;
> > Filter = 1;
> >
> > GraphXSpace = 2;
> > Plot(ADRatio,"AdvanceDeclineRatio",colorDarkBlue,styleHistogram);
> >
> > Plot(0,"",colorBlack);
> > Plot(3,"",colorGreen);
> > Plot(-3,"",colorRed);
> >
> > Title="Advance/Decline Ratio";
> >
>

__._,_.___

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.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___