Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Fractal Dimension Charting

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Fractal Dimension Charting

    I wish to create a custom indicator to chart an index below the stock chart. I have the formula for it written in QuickBASIC. The first section goes like this:
    ' ************ Program to Calculate Fractal Dimension of Waveforms
    DECLARE SUB LenCalc (y!(), ymin!, ymax!, N%, Length!)
    DECLARE SUB DataInput (x!, y!, N%)
    DIM x!(300), y!(300)
    CLS
    PRINT "Fractal Dimension of Waveforms": PRINT
    PRINT "Steps (N)", " x", " y", " D": PRINT
    ' ******** Get Initial Values **************
    N% = 1
    Length! = 0
    CALL DataInput(x!(N%), y!(N%), N%)
    PRINT , " -,
    ymax! = y!(1)
    ymin! = y!(1)
    ' *** Loop to Calculate Fractal Dimension ****
    DO
    N% = N% + 1
    CALL DataInput(x!(N%), y!(N%), N%) ' ***** Data enter here *****
    IF (y!(N%) >= ymax!) THEN ymax! = y!(N%)
    IF (y!(N%) <= ymin!) THEN ymin! = y!(N%)
    CALL LenCalc(y!(), ymin!, ymax!, N%, Length!)
    D! = 1 + LOG(Length!) / LOG(2*(N% - 1))
    PRINT , D!
    LOOP WHILE (N% <= 300)
    END ' ***** End of Main Program *****
    SUB DataInput (x!, y!, N%) ' ***** Subroutine for Data Input *****
    PRINT N%;
    PRINT , ;
    INPUT ; x!
    PRINT , ;
    INPUT ; y!
    END SUB ' ***** End of Data Input *****
    ' ****** Len Calc; Subroutine that Calculates the Normalized Length of the Waveform
    SUB LenCalc (y!(), ymin!, ymax!, N%, Length!)
    IF N% = 1 THEN
    PRINT , " -"
    ELSE
    Length! = 0
    FOR i% = 1 TO N%
    y! = (y!(i%) - ymin!) / (ymax! - ymin!)
    IF (i% > 1) THEN Length! = Length! + SQR((y! - yant!) ^ 2 + (1! / (N% - 1)) ^ 2)
    yant! = y!
    NEXT i%
    END IF
    END SUB ' ***** End of LenCalc *****

    Could one of you smart people show me how to splice the formula into the custom indicator wizard? There is a place where it says to insert your own formula between two () but when I did that it kept giving me NinjaScript errors like "statement expected" and "; expected" located in the first few lines.

    #2
    self similar idiot,

    You will not be able to just copy paste it. You have to convert it to C# to make it compatible. If you are not a programmer you could try one of these 3rd party NinjaScript Consultants here: http://www.ninjatrader.com/webnew/pa...injaScript.htm
    Josh P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by frslvr, 04-11-2024, 07:26 AM
    9 responses
    120 views
    1 like
    Last Post caryc123  
    Started by rocketman7, Today, 09:41 AM
    4 responses
    15 views
    0 likes
    Last Post rocketman7  
    Started by selu72, Today, 02:01 PM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_Zachary  
    Started by WHICKED, Today, 02:02 PM
    2 responses
    13 views
    0 likes
    Last Post WHICKED
    by WHICKED
     
    Started by f.saeidi, Today, 12:14 PM
    8 responses
    21 views
    0 likes
    Last Post f.saeidi  
    Working...
    X