Here is my version of this indicator
trSum:= sum(ATR(1), N);
VtxP := if (trSum == 0 ,0 , sum(Abs(high - Ref(low,1)),N))/ trSum,ColorGreen;
VtxM := if (trSum == 0 ,0 , sum(Abs(low - Ref(high,1)),N))/ trSum,ColorRed;
OST:VtxP - VtxM,Colorstick;
Con1:= OST >= 0;
Con2:= OST < 0;
Con3:= OST > Ref(OST,1);
Con4:= OST < Ref(OST,1);
BullRise:If(Con1 & Con3,OST,0),ColorLime;
BullFall: If(Con1 & Con4,OST,0),ColorGreen;
BearFall: If(Con2 & Con4,OST,0),ColorRed;
BearRise: If(Con2 & Con3,OST,0),ColorDarkRed;
OSTAvg:MA(OST,Sig),width2,ColorBlue;
ZeroLine:0,ColorBlack;
UpperZone:MA(OST,34)+(1.3185*Std(OST,34)),width2,colorViolet;
LowerZone:MA(OST,34)-(1.3185*Std(OST,34)),width2,colorViolet;
FillRgn(1,BullRise,0),Brush#5000FF00;
FillRgn(1,BullFall,0),Brush#50006400;
FillRgn(1,BearRise,0),Brush#508B0000;
FillRgn(1,BearFall,0),Brush#50FF0000;
under the parameter tab
n double 10 3 100
Sig double 3 2 100
Vortex Indicator
Moderator: Chris White
Vortex Indicator
Last edited by henry1224 on Sun Jun 12, 2016 11:37 am, edited 1 time in total.
Re: Vortex Indicator
This is a combine version of 5 vortex indicators into 1
trSum1:= sum(ATR(1), N);
VtxP1 := if (trSum1 == 0 ,0 , sum(Abs(high - Ref(low,1)),N))/ trSum1;
VtxM1 := if (trSum1 == 0 ,0 , sum(Abs(low - Ref(high,1)),N))/ trSum1;
trSum2:= sum(ATR(1), N2);
VtxP2 := if (trSum2 == 0 ,0 , sum(Abs(high - Ref(low,1)),N2))/ trSum2;
VtxM2 := if (trSum2 == 0 ,0 , sum(Abs(low - Ref(high,1)),N2))/ trSum2;
trSum3:= sum(ATR(1), N3);
VtxP3 := if (trSum3 == 0 ,0 , sum(Abs(high - Ref(low,1)),N3))/ trSum3;
VtxM3 := if (trSum3 == 0 ,0 , sum(Abs(low - Ref(high,1)),N3))/ trSum3;
trSum4:= sum(ATR(1), N4);
VtxP4 := if (trSum4 == 0 ,0 , sum(Abs(high - Ref(low,1)),N4))/ trSum4;
VtxM4 := if (trSum4 == 0 ,0 , sum(Abs(low - Ref(high,1)),N4))/ trSum4;
trSum5:= sum(ATR(1), N5);
VtxP5 := if (trSum5 == 0 ,0 , sum(Abs(high - Ref(low,1)),N5))/ trSum5;
VtxM5 := if (trSum5 == 0 ,0 , sum(Abs(low - Ref(high,1)),N5))/ trSum5;
OST:((VtxP1 - VtxM1) + 2*(VtxP2 - VtxM2) +3*(VtxP3 - VtxM3) + 4*(VtxP4 - VtxM4) + 5*(VtxP5 - VtxM5))/15,Colorstick;
Con1:= OST >= 0;
Con2:= OST < 0;
Con3:= OST > Ref(OST,1);
Con4:= OST < Ref(OST,1);
BullRise:If(Con1 & Con3,OST,0),ColorLime;
BullFall: If(Con1 & Con4,OST,0),ColorGreen;
BearFall: If(Con2 & Con4,OST,0),ColorRed;
BearRise: If(Con2 & Con3,OST,0),ColorDarkRed;
OSTAvg:MA(OST,Sig),width2,ColorBlue;
ZeroLine:0,ColorBlack;
UpperZone:MA(OST,34)+(1.3185*Std(OST,34)),width2,colorViolet;
LowerZone:MA(OST,34)-(1.3185*Std(OST,34)),width2,colorViolet;
FillRgn(1,BullRise,0),Brush#5000FF00;
FillRgn(1,BullFall,0),Brush#50006400;
FillRgn(1,BearRise,0),Brush#508B0000;
FillRgn(1,BearFall,0),Brush#50FF0000;
Under the parameters tab
N double 3 2 100
N2 double 5 3 110
N3 double 8 4 120
N4 Double 13 5 130
N5 double 21 6 150
Sig double 3 2 100
trSum1:= sum(ATR(1), N);
VtxP1 := if (trSum1 == 0 ,0 , sum(Abs(high - Ref(low,1)),N))/ trSum1;
VtxM1 := if (trSum1 == 0 ,0 , sum(Abs(low - Ref(high,1)),N))/ trSum1;
trSum2:= sum(ATR(1), N2);
VtxP2 := if (trSum2 == 0 ,0 , sum(Abs(high - Ref(low,1)),N2))/ trSum2;
VtxM2 := if (trSum2 == 0 ,0 , sum(Abs(low - Ref(high,1)),N2))/ trSum2;
trSum3:= sum(ATR(1), N3);
VtxP3 := if (trSum3 == 0 ,0 , sum(Abs(high - Ref(low,1)),N3))/ trSum3;
VtxM3 := if (trSum3 == 0 ,0 , sum(Abs(low - Ref(high,1)),N3))/ trSum3;
trSum4:= sum(ATR(1), N4);
VtxP4 := if (trSum4 == 0 ,0 , sum(Abs(high - Ref(low,1)),N4))/ trSum4;
VtxM4 := if (trSum4 == 0 ,0 , sum(Abs(low - Ref(high,1)),N4))/ trSum4;
trSum5:= sum(ATR(1), N5);
VtxP5 := if (trSum5 == 0 ,0 , sum(Abs(high - Ref(low,1)),N5))/ trSum5;
VtxM5 := if (trSum5 == 0 ,0 , sum(Abs(low - Ref(high,1)),N5))/ trSum5;
OST:((VtxP1 - VtxM1) + 2*(VtxP2 - VtxM2) +3*(VtxP3 - VtxM3) + 4*(VtxP4 - VtxM4) + 5*(VtxP5 - VtxM5))/15,Colorstick;
Con1:= OST >= 0;
Con2:= OST < 0;
Con3:= OST > Ref(OST,1);
Con4:= OST < Ref(OST,1);
BullRise:If(Con1 & Con3,OST,0),ColorLime;
BullFall: If(Con1 & Con4,OST,0),ColorGreen;
BearFall: If(Con2 & Con4,OST,0),ColorRed;
BearRise: If(Con2 & Con3,OST,0),ColorDarkRed;
OSTAvg:MA(OST,Sig),width2,ColorBlue;
ZeroLine:0,ColorBlack;
UpperZone:MA(OST,34)+(1.3185*Std(OST,34)),width2,colorViolet;
LowerZone:MA(OST,34)-(1.3185*Std(OST,34)),width2,colorViolet;
FillRgn(1,BullRise,0),Brush#5000FF00;
FillRgn(1,BullFall,0),Brush#50006400;
FillRgn(1,BearRise,0),Brush#508B0000;
FillRgn(1,BearFall,0),Brush#50FF0000;
Under the parameters tab
N double 3 2 100
N2 double 5 3 110
N3 double 8 4 120
N4 Double 13 5 130
N5 double 21 6 150
Sig double 3 2 100