This is FantailVMA indicator, converted from PineScript.
The FantailVMA is a type of moving average that adjusts its sensitivity to the price action of the instrument based on the volatility of the market. This makes it a more responsive indicator compared to traditional moving averages. The ADX and VMA indicators are used in the calculation of the FVMA to further enhance its responsiveness to changes in the market.
The indicator is a combination of Moving Average and Average True Range indicators. It shows trend movements.
//PRC_FantailVMA | indicator
//13.04.23
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//author: bixord
// --- settings
ADXLength=2 //ADX_Length
Weighting=10.0 //Weighting
MALength=6 //MA Length This must be =1 so that the VMA base line does not get averaged.
// --- end of settings
VMA=close
VarMA=close
MA=close
STR = high-low
//
Hi = high
Hi1 = high[1]
Lo = low
Lo1 = low[1]
Close1= close[1]
Bulls1 = 0.5*(abs(Hi-Hi1)+(Hi-Hi1))
Bears1 = 0.5*(abs(Lo1-Lo)+(Lo1-Lo))
if Bulls1 > Bears1 then
Bears=0
elsif Bulls1 = Bears1 then
Bears=0
else
Bears=Bears1
endif
if Bulls1 < Bears1 then
Bulls = 0
elsif Bulls1 = Bears1 then
Bulls = 0
else
Bulls = Bulls1
endif
if (barindex > 0) then
sPDI = (Weighting*sPDI[1] + Bulls)/(Weighting+1)//ma weighting
sMDI = (Weighting*sMDI[1] + Bears)/(Weighting+1)//ma weighting
endif
iTR = max(Hi-Lo,Hi-Close1)
if (barindex > 0) then
STR = (Weighting*STR[1] + iTR)/(Weighting+1)
endif
if STR >0 then
PDI=sPDI/STR
else
PDI=0
endif
if STR>0 then
MDI=sMDI/STR
else
MDI=0
endif
if (PDI + MDI) > 0 then
DX = abs(PDI - MDI)/(PDI + MDI)
else
DX=0
endif
if (barindex > 0)then
iADX = (Weighting*iADX[1] + DX)/(Weighting+1)
endif
vADX = iADX
adxlow = lowest[ADXLength](iADX)
adxmax = highest[ADXLength](iADX)
ADXmin = min(1000000.0, adxlow)
ADXmax = max(-1.0, adxmax)
Diff = ADXmax - ADXmin
if Diff>0 then
Const=(vADX- ADXmin)/Diff
else
Const=0
endif
if (barindex > 0)then
VarMA=((2-Const)*VarMA[1]+Const*close)/2
endif
MA= average[MALength](VarMA)
return MA as "FVMA"