TC2000.com• Download software • Tutorial videos • Subscription & data-feed pricing • Class schedule

TC2000Brokerage.com• New account application • Trading resources • Margin rates • Stock & option commissions

Worden Discussion Forum » General Discussions » RealCode for StockFinder 5.0 » VFI (Volume Flow Indicator)

Attachments:Volume Flow Indicator VFI.sfInd - 11 KB, downloaded 442 time(s).

Bruce,

Can a PCF now be written in TC2000 for the Volume Flow Indicator? There is information on its coding at www.mkatsanos.com/VFI.html (I could not get the address to link, and I could not get the code to paste).

If the code can be written in TC2000 would you be so kind?

Thank you,

Fisher2

This is what I have come up with for TC2000 v17+.

XAVG(IIF(AVGV130.1 > 0, SUM(IIF(ABS(H + L + C - H1 - L1 - C1) / 3 > .2 * SQR(ABS((SUM((LOG((H + L + C) / 3) - LOG((H1 + L1 + C1) / 3)) ^ 2, 30) - SUM(LOG((H + L + C) / 3) - LOG((H1 + L1 + C1) / 3), 30) ^ 2 / 30) / 30)) * C, SGN(H + L + C - H1 - L1 - C1) * LEAST(V, AVGV130.1 * 2.5), 0) , 130) / AVGV130.1, 0), 3)

But it isn't matching up with StockFinder (seems to be upside down and the off by some factor), so one of them is wrong.

Thanks Bruce, I have been using it as an indicator on ThinkorSwim, but was wanting to see if I could get in on TC2k as scanning is so much more to my liking. I'll be able to compare it to the one on TOS to see if it is showing the same values or acting the same way as the one on TOS.

Thanks for your help,

Bruce, after looking at a few charts the readings are a bit different at any given time but the dates of crosses above and below zero are very close and seem fairly consistent though not exact. I think it is close enough and good enough for my purposes.

Thanks so much.

Trying to create Volume Flow Indicator with RealCode.

Plot vcp then drag it to indicator to calculate vfi.

Then drag vfi to indicator to calculate vfima.

Then plot vfi - vfima

I have a problem at StdDev step. SumC & SumSq are zero.

Can you help me? or is there a better way? Trying to get RealCode version that gives similar zero crosses to your TC2000 code.

Changed StdDev code to the following and am getting a value but vcp is zero

What is your complete RealCode after the changes?

I don't think my StdDev code is correct

code after StdDev logic change

Is it possible to just translate the TC2000 code to RealCode?

I think the original PCF was missing a ^ 2. When this is added I get the following.

I have come up with the following RealCode Indicator which seems to match the altered PCF.

'|****************************************************************** '|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com '|*** Copy and paste this header and code into StockFinder ********* '|*** Indicator:Volume Flow Indicator (VFI) '|****************************************************************** '#Cumulative '# Length = UserInput.Integer = 130 '# coef = UserInput.Single = 0.2 '# vcoef = UserInput.Single = 2.5 '# SDper = UserInput.Integer = 30 '# Smooth = UserInput.Single = 3 Static Typical As New List(Of Single) Static LogTyp As New List(Of Single) Static Sum As Single Static SumSq As Single Static Past As New List(Of Single) Static PastSum As Single Static EMA As Single Static sumWeight As Single Static termRatio As Single If isFirstBar Then Typical.Clear LogTyp.Clear Sum = 0 SumSq = 0 Past.Clear PastSum = 0 End If Typical.Insert(0, (Price.High + Price.Low + Price.Close) / 3) LogTyp.Insert(0, Math.Log(Typical(0))) If Typical.Count >= 2 Then Sum += LogTyp(0) - LogTyp(1) SumSq += (LogTyp(0) - LogTyp(1)) ^ 2 End If If Typical.Count >= SDPer Then If Math.Abs(Typical(0) - Typical(1)) > Price.Last * _ coef * Math.Abs((SumSq - Sum ^ 2 / SDper) / SDper) ^ .5 Then Past.Insert(0, Math.Sign(Typical(0) - Typical(1)) * Math.Min(Volume.Value, Volume.AVG(Math.Min(CurrentIndex, Length), 1) * 2.5)) PastSum += Past(0) Else Past.Insert(0, 0) End If Sum -= LogTyp(SDper - 1) - LogTyp(SDper) SumSq -= (LogTyp(SDper - 1) - LogTyp(SDper)) ^ 2 End If If Past.Count > Length Then Dim Weight As Single = 1 / sumWeight EMA = EMA * (1 - Weight) + Weight * PastSum / Volume.AVG(Length, 1) sumWeight = sumWeight * termRatio + 1 PastSum -= Past(Length - 1) Plot = EMA Else If Past.Count = Length Then EMA = PastSum / Volume.AVG(Length, 1) termRatio = (Smooth - 1) / (Smooth + 1) sumWeight = termRatio + 1 PastSum -= Past(Length - 1) Plot = EMA Else Plot = Single.NaN End If If isLastBar Then Typical.Clear LogTyp.Clear Sum = 0 SumSq = 0 Past.Clear PastSum = 0 End If