Volume Weighted Moving Average crossing over Moving Average


0
0

Hi Pete,   I use VWMA (vol weighted moving average) with the following code:

input length = 30;

def vwma = Sum(volume * close, length) / Sum(volume, length);

plot Value = vwma;

 

I am getting an error on this line below: input averageType2 = Type.VWMA

I have tried to fix it but I can’t figure it out.    The input on my charts for VWMA is 30.

I hope you can help. Thank you so very much

#wizard text: -period
#wizard input: averageType1
#wizard text: crosses
#wizard input: crossingType
#wizard input: length2
#wizard text: -period
#wizard input: averageType2
#wizard text: Price:
#wizard input: price

input price = close;
input length1 = 8;
input length2 = 30;
input averageType1 = AverageType.EXPONENTIAL;
input averageType2 = Type.VWMA

input crossingType = {default above, below};

def avg1 = MovingAverage(averageType1, price, length1);

def vwma = Sum(volume * close, length2) / Sum(volume, length2);
plot signal = Crosses(avg1, vwma
, crossingType == crossingType.above);

signal.DefineColor(“Above”, GetColor(6));
signal.DefineColor(“Below”, GetColor(7));
signal.AssignValueColor(if crossingType == crossingType.above then signal.Color(“Above”) else signal.Color(“Below”));

signal.SetPaintingStrategy(if crossingType == crossingType.above
then PaintingStrategy.BOOLEAN_ARROW_UP
else PaintingStrategy.BOOLEAN_ARROW_DOWN);

 

 

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on January 23, 2019 10:11 pm
182 views
0
Private answer

Pretty simple. There is no such thing as “Type” and no such thing as “VWMA”.

More to the point, that input is not being used anywhere in your code. So just delete that line and the errors clear up.

Marked as spam
Posted by (Questions: 37, Answers: 4087)
Answered on January 27, 2019 10:51 am