Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Fractal Dimension Indicator for Stockfinder 4 Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
phillrun
Posted : Wednesday, June 23, 2010 12:06:11 PM
Registered User
Joined: 1/31/2005
Posts: 24

You've added the Fractal Dimension Indicator to Stockfinder 5, as mentioned in Stocks and Commodities Magazine June Issue.  However, it is not in Version 4.  I'm reluctant to upgrade until the backscanner issues have been solved.  Can you help me use this indicator in Version 4?

Bruce_L
Posted : Wednesday, June 23, 2010 12:29:48 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
The Fractal Dimension Indicator uses a bottled Smooth Indicator in its calculations. It is not possible to bottle the Smooth Indicator in StockFinder 4. The Smooth RealCode Indicator could be created by replacing everything after the Inherits line in the Class tab of the RealCode Editor with the following:

    Sub New
        AutoLoop = False
    End Sub
    Public Overrides Function Plot() As System.Single
        If Price.Bar.Count >= 3 Then
            For i As Integer = 3 To Price.Bar.Count - 1
                AddToOutput(Price.Bar.DateValue(i), _
                    (Price.Bar.Value(i) + 2 * Price.Bar.Value(i - 1) + _
                    2 * Price.Bar.Value(i - 2) + Price.Bar.Value(i - 3)) / 6)
            Next
        End If
    End Function
End Class

Once this is created, you could Drag and Drop the Smooth Indicator into the Code tab of the RealCode Editor to create the first line of the following RealCode Indicator:

'# Smooth = indicator.Smooth
'# EvenPeriod = UserInput.integer = 30
Static N(1) As Integer
Static Ratio(19) As Single
Static Dimen As Single
Dim CurRatio As Single
If isFirstBar Then
    N(0) = System.Math.Floor(EvenPeriod / 2) * 2
    N(1) = N(0) / 2
    For i As Integer = 0 To 19
        Ratio(i) = 0
    Next
    Dimen = 0
End If
Dim N1 As Single = (Smooth.MaxClose(N(1)) - Smooth.MinClose(N(1))) / N(1)
Dim N2 As Single = (Smooth.MaxClose(N(1), N(1)) - Smooth.MinClose(N(1), N(1))) / N(1)
Dim N3 As Single = (Smooth.MaxClose(N(0)) - Smooth.MinClose(N(0))) / N(0)
If N1 > 0 AndAlso N2 > 0 AndAlso N3 > 0 Then
    CurRatio = .5 * ((System.Math.Log(N1 + N2) - _
        System.Math.Log(N3)) / System.Math.Log(2) + Dimen)
Else
    CurRatio = 0
End If
Dimen -= Ratio(CurrentIndex Mod 20) / 20
Ratio(CurrentIndex Mod 20) = CurRatio
Dimen += CurRatio / 20
Plot = Dimen

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.