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

recursive function

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

    recursive function

    Hi I am not sure if this is available either with Ninjasscript or the MSDN library I am just trying to get the below function done: Thanks!
    Syntax

    compoundValue(int length, IDataHolder visible data, IDataHolder historical data);
    The default value of the length parameter is 1.
    Description

    Calculates a compound value according to following rule: if a bar number is bigger than length then the visible data value is returned, otherwise the historical data value is returned. This function is used to initialize studies with recursion.
    Example

    declare lower;rec x = compoundValue(2, x[1] + x[2], 1);plot FibonacciNumbers = x;
    The example calculates the Fibonacci sequence. Starting from the third bar each following number is calculated as the sum of the previous two numbers while the numbers for the first two bars are equal to one. As a result you will get a plot containing the 1 1 2 3 5 etc values.

    #2
    ziggymeister,

    I am not sure where you got that method from as it is not a standard method from .NET that I am aware of. You can still feel free to create yourself your own method named that that does exactly that if you wish though.
    Josh P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by 21laienoch, Today, 10:21 AM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Started by synthhokie, Today, 10:24 AM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by RaddiFX, Today, 10:15 AM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by Rogers101, 05-05-2024, 11:30 AM
    23 responses
    68 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by Human#102, Today, 09:54 AM
    1 response
    2 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X