PureBytes Links
Trading Reference Links
|
Thank you Tomasz (and everyone else who responded)!
I added trend lines (use the "parameter" setting to test various
trendlines) and also moving averages to the OBV --
// OBV with Trendlines (use "Param") and 10/50 Moving Averages
rawOBV = Cum( Volume * sign( C - Ref( C, -1 ) ) ) + Volume[ 0 ];
// Buy Support Line
x = Cum(1);
VarPerc = Param("VarPerc",0.3,0.01,2.0,0.01); // default 0.3
perchg = VarPerc*LastValue( Highest( ROC( rawOBV, 50 ) ));
startvalue = LastValue( Trough( rawOBV, perchg, 1 ) );
endvalue1 = LastValue( Trough( rawOBV, perchg, 2 ) );
startbar = LastValue( ValueWhen( rawOBV== startvalue, x, 1 ) );
endbar = LastValue( ValueWhen( rawOBV== endvalue1, x, 1 ) );
Aa = (endvalue1-startvalue)/(endbar-startbar);
b = startvalue;
trendline = Aa * ( x - startbar ) + b;
// Short Resistance Line
y = Cum(1);
Bperchg = VarPerc*LastValue( Highest( ROC( rawOBV, 50 ) ));
Bstartvalue = LastValue( Peak( rawOBV, Bperchg, 1 ) );
Bendvalue1 = LastValue( Peak( rawOBV, Bperchg, 2 ) );
Bstartbar = LastValue( ValueWhen( rawOBV== Bstartvalue, y, 1 ) );
Bendbar = LastValue( ValueWhen( rawOBV== Bendvalue1, y, 1 ) );
BAa = (Bendvalue1-Bstartvalue)/(Bendbar-Bstartbar);
Bb = Bstartvalue;
Btrendline = BAa * ( y - Bstartbar ) + Bb;
// Plot Colored Lines
Plot(rawOBV, "rawOBV",colorBlack,styleThick);
Plot( IIf( x >= endbar, trendline, Null ), "Trendline", colorYellow,
styleDots );
Plot( IIf( y >= Bendbar, Btrendline, Null ), "Trendline", colorBlue,
styleDots );
Plot(MA(rawOBV,10),"MA10",colorRed,styleLine);
Plot(MA(rawOBV,50),"MA50",colorBlue,styleLine);
Enjoy Vancouver, Tomasz -- GREAT CITY!!! Make sure to check out the
west coast of Vancouver Island... beautiful.
~Bman
--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx>
wrote:
>
> Plot( OBV(), "OBV built-in", colorRed );
>
> rawOBV = Cum( Volume * sign( C - Ref( C, -1 ) ) ) + Volume[ 0 ];
>
> Plot( rawOBV, "rawOBV", colorBlue );
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: "Diane" <brianrichard99@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Wednesday, October 05, 2005 4:49 AM
> Subject: [amibroker] On Balance Volume (need raw code)
>
>
> >I know AB includes OBV within it, but I'm looking for the base
code
> > written in AFL, so I can tweak it and add trend lines.
> >
> > Anyone have anything they can throw at me?
> >
> > Thanks in advance!
> >
> > Bman
> >
> >
> >
> >
> >
> >
> >
> > 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 other support material please check also:
> > http://www.amibroker.com/support.html
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
> >
------------------------ Yahoo! Groups Sponsor --------------------~-->
Try Online Currency Trading with GFT. Free 50K Demo. Trade
24 Hours. Commission-Free.
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~->
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 other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|