Finite Volume Elements (FVE) for ThinkOrSwim

korygill

korygill

Member
VIP
Warehouse
This study is a thinkorswim version of an indicator posted in a question on this forum. This indicator is the work of Markos Katsanos. I have ported the indicator to thinkorswim.

Here is a chart of the indicator from Markos



Here is a chart from thinkorswim



ThinkScript code for this indicator

Code:
#
# FiniteVolumeElements_FVE
#
# Author: Kory Gill, @korygill
#
# 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.
# ...
# ...

declare once_per_bar;
declare lower;

#
# inputs
#
input CutOff = 0.003;
input Samples = 22;

#
# logic
#
def bn = BarNumber();
def nan = double.NaN;

def tp = hlc3;
def mf = (close - (high+low)/2) + tp - tp[1];
def fveFactor = if mf > (CutOff*Close)
                then 1
                else if mf < (-1*CutOff*Close) then -1
                else 0;

def VolumePlusMinus = volume * fveFactor;
def fveSum = Sum(VolumePlusMinus, Samples);
def fve = if bn > Samples
          then (fveSum / (Average(volume,Samples) * Samples)) * 100
          else nan;


#
# plots
#
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);
Link to a flex grid as shown above

http://tos.mx/PUmEFD

Happy trading,
Kory Gill, @korygill
 
S

SolidChiken

New member
VIP
Shocked. Genius work there @skynetgen. Unbelievable 💎
 
markos

markos

Well-known member
VIP
Warehouse
@korygill and @skynetgen Great job! This will be a good addition to my repertoire. 😁
 
B

ball

New member
Hello, I have serious doubts about this code.

Why are you not using any measurement of price range in the cutoff?
 
markos

markos

Well-known member
VIP
Warehouse
@ball welcome to useThinkScript. The following is from the author's website... "You can find a money flow divergence system using both FVE and VFI here and a comparison between 7 Money Flow Indicators in my article in the July 2011 of S&C. " You may find the answer there.
 
Z

zeek

Member
VIP
Can anyone post a screenshot of how the reworked version looks like?
 
BenTen

BenTen

Administrative
Staff
VIP
Warehouse
@zeek Kory already posted it above. You can always add it to your ToS as well.
 

Top