VWAP Oscillator (StDeV based)

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
Tresor
Posts: 1104
Joined: 29 Mar 2008
Has thanked: 12 times
Been thanked: 51 times

VWAP Oscillator (StDeV based)

Postby Tresor » 12 Oct 2008

Hello,

I recently encountered this VWAP Oscillator (screenshot attached). Would any of you happen to have the EL code of it?

Regards
Attachments
VWAP_Oscillator.png
VWAP_Oscillator.png (28.46 KiB) Viewed 2478 times

zukkaweb
Posts: 125
Joined: 08 Feb 2008

Postby zukkaweb » 12 Oct 2008

how does it works?

Tresor
Posts: 1104
Joined: 29 Mar 2008
Has thanked: 12 times
Been thanked: 51 times

Postby Tresor » 13 Oct 2008

how does it works?


Hi,

All I know is that the lines (4, 3,.., .., - 4) are standard deviations.

User avatar
TJ
Posts: 6521
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Re: VWAP Oscillator (StDeV based)

Postby TJ » 21 Dec 2008

Hello,
I recently encountered this VWAP Oscillator (screenshot attached). Would any of you happen to have the EL code of it?
Regards


it is already in MC.

Look for VWAP Reset in the indicator list.

Tresor
Posts: 1104
Joined: 29 Mar 2008
Has thanked: 12 times
Been thanked: 51 times

Postby Tresor » 22 Dec 2008

Hello TJ,

VWAP Reset is an indicator the values of which are similar to the values of an instrument (from zero to zillions), while VWAP Oscillator oscillates between -5 to 5 and crosses zero.

Regards

User avatar
TJ
Posts: 6521
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Postby TJ » 22 Dec 2008

does it oscillate against another VMAP, or against the close?

This can easily arranged.
Just get one value minus the other.

Tresor
Posts: 1104
Joined: 29 Mar 2008
Has thanked: 12 times
Been thanked: 51 times

Postby Tresor » 22 Dec 2008

does it oscillate against another VMAP, or against the close?


Hi TJ,

To be frank, I have no idea of how this oscillator is built.

Tresor
Posts: 1104
Joined: 29 Mar 2008
Has thanked: 12 times
Been thanked: 51 times

Postby Tresor » 22 Dec 2008

Hello TJ,

Thanks a lot:-) I will experiment with your code to see if crossing of this VWAP_Osc with another oscilator would bring promising signals. Please see the attached screenshot.

As far as I remember the original VWAP Oscillator's levels are standard deviations of the daily VWAP. It was inpired by this code:

Code: Select all



{***********************************************************************************************

Coded by dbntina/boxmeister 8/2/2007

Used the VWAP_H code provided by TS 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");


Thanks
Attachments
VWAP_OSC.jpg
VWAP_OSC.jpg (125.13 KiB) Viewed 1971 times

User avatar
TJ
Posts: 6521
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Postby TJ » 27 Dec 2008

T: Your Christmas present.

enjoy
:-)


Code: Select all

// Type : Function
// Name : VWAP_H

vars:
PriceW(0),
ShareW(0),
Answer(0);

if date > date[1] then begin
PriceW = 0;
ShareW = 0;
end;

PriceW = PriceW + (AvgPrice * (UpTicks+DownTicks));
ShareW = ShareW + (UpTicks+DownTicks);

if ShareW > 0 then
Answer = PriceW / ShareW;

VWAP_H = Answer;




Code: Select all

// VWAP Std Dev

vars: aa(0);

value1=
square(c-vwap_h)+
square(c[1]-vwap_h)+
square(c[2]-vwap_h)+
square(c[3]-vwap_h)+
square(c[4]-vwap_h)+
square(c[5]-vwap_h)+
square(c[6]-vwap_h)+
square(c[7]-vwap_h)+
square(c[8]-vwap_h)+
square(c[9]-vwap_h)+
square(c[10]-vwap_h)+
square(c[11]-vwap_h)+
square(c[12]-vwap_h)+
square(c[13]-vwap_h)+
square(c[14]-vwap_h)+
square(c[15]-vwap_h)+
square(c[16]-vwap_h)+
square(c[17]-vwap_h)+
square(c[18]-vwap_h)+
square(c[19]-vwap_h)+
square(c[20]-vwap_h)+
square(c[21]-vwap_h)+
square(c[22]-vwap_h)+
square(c[23]-vwap_h)+
square(c[24]-vwap_h)+
square(c[25]-vwap_h)+
square(c[26]-vwap_h)+
square(c[27]-vwap_h)+
square(c[28]-vwap_h)+
square(c[29]-vwap_h)+
square(c[30]-vwap_h)+
square(c[31]-vwap_h)+
square(c[32]-vwap_h)+
square(c[33]-vwap_h)+
square(c[34]-vwap_h)+
square(c[35]-vwap_h)+
square(c[36]-vwap_h)+
square(c[37]-vwap_h)+
square(c[38]-vwap_h)+
square(c[39]-vwap_h)+
square(c[40]-vwap_h)+
square(c[41]-vwap_h)+
square(c[42]-vwap_h)+
square(c[43]-vwap_h)+
square(c[44]-vwap_h);

value2=squareroot(value1/(45-1));
value3=vwap_h+value2;
value4=vwap_h-value2;
value5=vwap_h+(value2*2);
value6=vwap_h-(value2*2);
value7=vwap_h+2.50;
value8=vwap_h-2.50;


if time>930 and time<1615 then begin

   {Plot1(vwap_h, "VWAP" ) ;}
   Plot2(value7, "UpperBand" ) ;
   Plot3(value8, "UpperBand" ) ;
   Plot4(value5, "UpperBand" ) ;
   Plot5(value6, "LowerBand" ) ;

end;

User avatar
RobotMan
Posts: 375
Joined: 12 Jul 2006
Location: Los Altos, California, USA
Has thanked: 31 times
Been thanked: 12 times
Contact:

Postby RobotMan » 27 Dec 2008

I don't come in here too often, but I was going to post some code today and noticed this thread.
There is a pretty good discussion of VWAP and Std Dev on the TradersLaboratory site. I have read through it and I DO use VWAP as a Moving Average S/R point on the chart, but not all the other stuff he talks about.

01 Trading With Market Statistics I. Volume Histogram
http://www.traderslaboratory.com/forums ... -1962.html

02 Trading With Market Statistics.II The Volume Weighted Average Price (VWAP)
http://www.traderslaboratory.com/forums ... -1990.html

03 Trading with Market Statistics III. Basics of VWAP Trading
http://www.traderslaboratory.com/forums ... -2008.html

04 Trading with Market Statistics. IV Standard Deviation
http://www.traderslaboratory.com/forums ... -2101.html

05 Trading with Market Statistics V. Other Entry Points
http://www.traderslaboratory.com/forums ... -2130.html

06 Trading with Market Statistics VI. Scaling In and Risk Tolerance
http://www.traderslaboratory.com/forums ... -2189.html

07 Trading with Market Statistics VII. Breakout Trades at the PVP
http://www.traderslaboratory.com/forums ... -2232.html

08 Trading with Market Statistics VIII. Counter Trend Trades in Symmetric Distributions
http://www.traderslaboratory.com/forums ... -2285.html

09 Trading with Market Statistics IX. Scalping
http://www.traderslaboratory.com/forums ... -2322.html

10 Trading with Market Statistics X. Position Trading
http://www.traderslaboratory.com/forums ... -2423.html

11 Trading with Market Statistics XI. HUP
http://www.traderslaboratory.com/forums ... -2735.html

VWAP Indicator with 1SD and 2SD bands
http://www.traderslaboratory.com/forums ... -2175.html

Some useful explanation and code here (you might need to be registered to get into the forum - sorry):

TS Forum - VWAP Standard Deviation Since Open -- Question
https://www.TS.com/Discussion ... c_ID=66875

TS Forum - Volume At Price Histogram (Futures)
https://www.TS.com/Discussion ... c_ID=67207

TS Forum - gkMtkProfileTL
https://www.TS.com/Discussion ... c_ID=50398
Attachments
VWAP20081226.jpg
VWAP20081226.jpg (79.28 KiB) Viewed 1723 times

Tresor
Posts: 1104
Joined: 29 Mar 2008
Has thanked: 12 times
Been thanked: 51 times

Postby Tresor » 27 Dec 2008

Hello TJ,

Thank you very much for the present :mrgreen:

Is the VWAP_H function: a) Numeric / b) TrueFalse / c) String?

Regards

Tresor
Posts: 1104
Joined: 29 Mar 2008
Has thanked: 12 times
Been thanked: 51 times

Postby Tresor » 27 Dec 2008

There is a pretty good discussion of VWAP and Std Dev on the TradersLaboratory site. I have read through it and I DO use VWAP as a Moving Average S/R point on the chart, but not all the other stuff he talks about.


Hello RobotMan,

I agree the discussion there is pretty good. Unfortunately MC doesn't plot a daily histogram the way other charting programmes do. In fact MC doesn't plot daily volume histogram at all. So I was not able to benefit from this discussion :cry:

User avatar
TJ
Posts: 6521
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Postby TJ » 27 Dec 2008

Hello TJ,

Thank you very much for the present :mrgreen:

Is the VWAP_H function: a) Numeric / b) TrueFalse / c) String?

Regards


numeric.

you can see it by:

Code: Select all

vars:
Answer(0);  // <--numeric

VWAP_H = Answer;  // <--- the function returns this variable.

User avatar
TJ
Posts: 6521
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Postby TJ » 27 Dec 2008

...
Some useful explanation and code here (you might need to be registered to get into the forum - sorry):

TS Forum - VWAP Standard Deviation Since Open -- Question
https://www.TS.com/Discussion ... c_ID=66875

TS Forum - Volume At Price Histogram (Futures)
https://www.TS.com/Discussion ... c_ID=67207

TS Forum - gkMtkProfileTL
https://www.TS.com/Discussion ... c_ID=50398


too bad I can't get into the TS forum...

can someone make a precis?

;-)

User avatar
TJ
Posts: 6521
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Postby TJ » 27 Dec 2008

I don't come in here too often, but I was going to post some code today and noticed this thread.
There is a pretty good discussion of VWAP and Std Dev on the TradersLaboratory site. I have read through it and I DO use VWAP as a Moving Average S/R point on the chart, but not all the other stuff he talks about.


Roboman...

Thanks for the links... that's a wealth of information!

Tresor
Posts: 1104
Joined: 29 Mar 2008
Has thanked: 12 times
Been thanked: 51 times

Postby Tresor » 27 Dec 2008

Hello TJ,

Thank you very much for the present :mrgreen:

Is the VWAP_H function: a) Numeric / b) TrueFalse / c) String?

Regards


numeric.

you can see it by:

vars:
Answer(0); <--numeric

VWAP_H = Answer; <--- the function returns this variable.


Thanks TJ,

This indicator works like per attached screenshot (from zero to zillions). Do you think anything could be done to to make these lines oscillate (between 0 to 100 or between 20 to 80 or between -100 to 100 or between a similar range of values)?
Attachments
VWAP st dev osc.jpg
VWAP st dev osc.jpg (126.58 KiB) Viewed 1676 times

User avatar
TJ
Posts: 6521
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Postby TJ » 27 Dec 2008

Thanks TJ,

This indicator works like per attached screenshot (from zero to zillions). Do you think anything could be done to to make these lines oscillate (between 0 to 100 or between 20 to 80 or between -100 to 100 or between a similar range of values)?


mmm... this indicator is like a bollinger band.
I don't think it was meant to oscillate between 0-100.

I will take a look at other indicators in roboman's links.

Tresor
Posts: 1104
Joined: 29 Mar 2008
Has thanked: 12 times
Been thanked: 51 times

Postby Tresor » 14 Jan 2009

This is how the author explains how Vwap Osc is calculated:

http://www.traderslaboratory.com/forums ... #post56139

Regards

bomberone1
Posts: 145
Joined: 02 Nov 2010
Has thanked: 7 times
Been thanked: 9 times

Re: VWAP Oscillator (StDeV based)

Postby bomberone1 » 03 Jan 2011

Folks, anyone compare vwap by twap?

I have difficult coding twap indicator in easylanguage, anyone get it?

bomberone1
Posts: 145
Joined: 02 Nov 2010
Has thanked: 7 times
Been thanked: 9 times

Re: VWAP Oscillator (StDeV based)

Postby bomberone1 » 13 Jan 2011

TJ i don't understand the modification that u did at original code on Trsor , the code of dbtina vwap_H, could u exaplin please?

Twap are u able to code it?

User avatar
TJ
Posts: 6521
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Re: VWAP Oscillator (StDeV based)

Postby TJ » 13 Jan 2011

bomberone1 wrote:TJ i don't understand the modification that u did at original code on Trsor , the code of dbtina vwap_H, could u exaplin please?

you need to learn to walk before run.
I would suggest you to go through this ebook first:
Getting Started with EasyLanguage
https://www.multicharts.com/multicharts/ ... mentation/
this is the book you should read if you want to use EasyLanguage but don't know how.

bomberone1 wrote:Twap are u able to code it?

yes.
how much would you like to pay?

bomberone1
Posts: 145
Joined: 02 Nov 2010
Has thanked: 7 times
Been thanked: 9 times

Re: VWAP Oscillator (StDeV based)

Postby bomberone1 » 13 Jan 2011

TJ wrote:how much would you like to pay?


A cup of coffee???
:-)

User avatar
pivot
Posts: 29
Joined: 07 Dec 2009
Been thanked: 2 times

Re: VWAP Oscillator (StDeV based)

Postby pivot » 08 Apr 2011

Image

VWAP_SD.png
VWAP_SD.png (149.38 KiB) Viewed 1673 times



Here is the code

Code: Select all


{***********************************************************************************************

Coded by dbntina/boxmeister 8/2/2007

Used the VWAP_H code provided by TS 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");

   


User avatar
pivot
Posts: 29
Joined: 07 Dec 2009
Been thanked: 2 times

Re: VWAP Oscillator (StDeV based)

Postby pivot » 10 Apr 2011

Code: Select all

   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(Close of data1 - VolWAPValue, "Diff VWAP");
   Plot2(VolWAPSD, "VWAP1SDUp");
       Plot3( -1* VolWAPSD, "VWAP1SDDown");
   Plot4(2*VolWAPSD, "VWAP2SDUp");
      Plot5(-2*VolWAPSD, "VWAP2SDDown");
      Plot6(0, "zeroline");     

   
   {Plot2(VolWAPValue + VolWAPSD, "VWAP1SDUp");
       Plot3(VolWAPValue - VolWAPSD, "VWAP1SDDown");
   Plot4(VolWAPValue + (2*VolWAPSD), "VWAP2SDUp");
      Plot5(VolWAPValue - (2*VolWAPSD), "VWAP2SDDown");}
      

   



I have changed a few things on the original TS forum code. This is code for the Oscillator all it is, is the current price less the Vwap. Be sure to make the "Diff Vwap" into a Historgram with upper and lower SD bands.

The IRT version looks like the SD bands are normalized which some how I don't think a VWAP Standard deviation will be a straight line all day.
Attachments
VWAP_OSC.png
VWAP_OSC.png (48.55 KiB) Viewed 1665 times


Return to “User Contributed Studies and Indicator Library”