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

Re: [amibroker] VWAP with SD1 bands and SD2 bands code



PureBytes Links

Trading Reference Links

Check the library
 
 
----- Original Message -----
From: "chomper777" <amibrokerfan@xxxxxxxxx>
Sent: Sunday, January 06, 2008 4:32 PM
Subject: [amibroker] VWAP with SD1 bands and SD2 bands code

> Hi,
>
> Here is a tradestation code for VWAP with Standard Deviation bands. 
> Wonder if someone is able to translate it into Amibroker code.
>
> I found the code from..
>
http://www.traderslaboratory.com/forums/f46/vwap-indicator-with-1sd-
> and-2sd-2175.html
>
>
> {*********************************************************************
> **************************
>
> Coded by dbntina/boxmeister 8/2/2007
>
> Used the VWAP_H code provided by Tradestation on 02/07/2003 Topic ID
> = 6735 Thanks Guys!
>
> Added the computation for variance and the Standard Deviation to
> combine into one indicator
> plot and this indicator plots the VWAP, SD1 bands and SD2 bands
>
> **********************************************************************
> *************************}
>
>
>
> [LegacyColorValue = true];
>
> vars:
> PriceW(0),
> ShareW(0),
> Count(0),
> VolWAPValue(0),
> VolWAPVariance(0),
> VolWAPSD(0);
>
>
> if date > date[1] then begin
> PriceW = 0;
> ShareW = 0;
> Count = -1;
> Value1 = 0;
> Value2 = 0;
> VolWAPValue = 0;
> end;
>
> PriceW = PriceW + (AvgPrice * (UpTicks+DownTicks));
> ShareW = ShareW + (UpTicks+DownTicks);
> Count = Count + 1;
> Value3 = 0;
>
> if ShareW > 0 then VolWAPValue = PriceW / ShareW;
>
> {Calculate the individual variance terms for each intraday
> bar starting with the current
> bar and looping back through each bar to the start bar.  The
> terms are each normalized
> according to the Variance formula for each level of volume at
> each price bar }
>
>  For Value1 = 0 To Count Begin
> Value2 = ((UpTicks[Value1]+DownTicks[Value1])/ShareW)
> * (Square(AvgPrice[Value1]-VolWAPValue));
> Value3 = Value3 + Value2;
> End;
>
> VolWAPVariance = Value3;
> VolWAPSD = SquareRoot(VolWAPVariance);
>
>
> Plot1(VolWAPValue, "VWAP");
> Plot2(VolWAPValue + VolWAPSD, "VWAP1SDUp");
>    Plot3(VolWAPValue - VolWAPSD, "VWAP1SDDown");
> Plot4(VolWAPValue + (2*VolWAPSD), "VWAP2SDUp");
>    Plot5(VolWAPValue - (2*VolWAPSD), "VWAP2SDDown");
> // added by request
http://www.traderslaboratory.com/forums/f46/vwap-
> indicator-with-1sd-and-2sd-2175.html#post27273
> input : trdSD (2.5);
>    Plot6(VolWAPValue + (trdSD*VolWAPSD), "VWAP3SDUp");
>    Plot7(VolWAPValue - (trdSD*VolWAPSD), "VWAP3SDDown");
>
>
>
> 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

> Yahoo! Groups Links
>
> <*> To visit your group on the web, go to:
>   
http://groups.yahoo.com/group/amibroker/
>
> <*> Your email settings:
>    Individual Email | Traditional
>
> <*> To change settings online go to:
>   
http://groups.yahoo.com/group/amibroker/join
>    (Yahoo! ID required)
>
> <*> To change settings via email:
>   
mailto:amibroker-digest@xxxxxxxxxxxxxxx
>   
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
>
> <*> 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/

>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.17.13/1210 - Release Date: 1/5/2008 11:46 AM
>
>
__._,_.___

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

__,_._,___