VWAP reset code

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
flipflopper
Posts: 261
Joined: 28 Feb 2008
Has thanked: 2 times
Been thanked: 1 time

Postby flipflopper » 30 Apr 2009

Anyone have the original VWAP reset code?

I was trying to modify it so that it would paint my bars green if the last close is above the VWAP and red if the last close was below the VWAP.

I've searched the web to no avail.

On another note... where does Multicharts store all the code for the indicators?

Rick628
Posts: 1
Joined: 15 Apr 2008
Location: Ohio

VWAP reset

Postby Rick628 » 08 May 2009

Here's function and indicator code:

Code: Select all

// Function:VWAPResettable
input:
PriceValue(NumericSeries),
LocalHrsOffset(NumericSimple),
time1(NumericSimple),
time2(NumericSimple),
time3(NumericSimple),
time4(NumericSimple),
time5(NumericSimple);

vars:
var0(0),
var1(0),
var2(0),
var3(0);

var3 = MinutesToTime(TimeToMinutes(time)+LocalHrsOffset*60);

if date<>date[1]
or var3=time1
or var3=time2
or var3=time3
or var3=time4
or var3=time5 then begin
var0 = 0;
var1 = 0;
end;

var0 = var0 + (PriceValue * Ticks);
var1 = var1 + Ticks;

if var1 > 0 then
var2 = var0 / var1
else
var2 = PriceValue;

VWAPResettable = var2;

Code: Select all

// VWAP reset indicator:

input:
Price(AvgPrice),
LocalHrsOffset(0),
time1(0900),
time2(0930),
time3(1129),
time4(1315),
time5(1415),
upColor(Cyan),
dnColor(Magenta);

var:
var0(0);
var0 = VWAPResettable(Price,LocalHrsOffset,time1,time2,time3,time4,time5);
plot1(var0,"vwap_reset");

var: var1(yellow);
if var0 > var0[1] then var1 = upColor;
if var0 < var0[1] then var1 = dnColor;
SetPlotColor(1,var1);


Return to “User Contributed Studies and Indicator Library”