// Downloaded From https://www.WiseStockTrader.com
// Vortex Indicator 
// S&C Traders Tips Jan 2010 
period = Param("Period", 14, 2 ); 

VMP = Sum( abs( H - Ref( L, -1 ) ), period ); 
VMM = Sum( abs( L - Ref( H, -1 ) ), period ); 
STR = Sum( ATR( 1 ), period ); 

VIP = VMP / STR; 
VIM = VMM / STR; 

//Plot( VIP, "VI"+period+"+", colorBlue); 
//Plot( VIM, "VI"+period+"-", colorRed );


Hist      = VIP - VIM;
HistPrev  = Ref(Hist,-1);

Color = IIf(Hist>HistPrev,colorCustom9,
IIf(hist<HistPrev,colorRed,colorWhite));

Plot( Hist*1.02, "", color, styleDots+styleNoLine+styleNoLabel);
Plot( Hist*1.01, "", color, styleDots+styleNoLine+styleNoLabel);

Color = IIf(Hist>0,colorCustom11,
IIf(hist<0,colorCustom8,colorWhite));


Plot( Hist, "", color, styleHistogram+styleOwnScale+styleThick );