Page 1 of 1

Posted: 30 Apr 2009
by flipflopper
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?

VWAP reset

Posted: 08 May 2009
by Rick628
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);