Would you mind sharing the study code or chart with the fix, please?
Code:
#
# FiniteVolumeElements_FVE
#
# Author: Kory Gill, [USER=212]@korygill[/USER]
#
# Created from idea on https://usethinkscript.com/threads/finite-volume-elements.593/
# Original idea is from http://mkatsanos.com/FVE.html
#
# VERSION HISTORY (sortable date and time (your local time is fine), and your initials
# 20190907-1200-KG - Created.
# ...7/20/2020 Added MTF Capability in order to combat the fact that it does not appear on lower than 2 minute time frames### Ramon Del Villar AKA Pelonsax
# ...
declare lower;
input AGG = aggregationPeriod.FIVE_MIN;
input CutOff = 0.003;
input Samples_Used = 22;
def samples = Samples_Used * (AGG/60000);
def bn = BarNumber();
def nan = double.NaN;
def tp = hlc3(period = AGG);
def mf = (close(period = AGG) - (high(period = AGG)+low(period = AGG))/2) + tp - tp[1];
def fveFactor = if mf > (CutOff*Close(period = AGG))
then 1
else if mf < (-1*CutOff*Close(period = AGG)) then -1
else 0;
def VolumePlusMinus = volume(period = AGG) * fveFactor;
def fveSum = Sum(VolumePlusMinus, Samples);
def fve = if bn > Samples
then (fveSum / (Average(volume(period = AGG),Samples) * Samples)) * 100
else nan;
plot pFVE = fve;
plot pFVE_MA = MovingAverage(AverageType.SIMPLE, fve, 30);
pFVE_MA.SetDefaultColor(Color.Gray);
PFVE_MA.SetPaintingStrategy(PaintingStrategy.DASHES);
plot zeroLine = 0;
zeroLine.SetDefaultColor(Color.White);