Announcement

Collapse
No announcement yet.

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 sjsj2732, Yesterday, 04:31 AM
    0 responses
    31 views
    0 likes
    Last Post sjsj2732  
    Started by NullPointStrategies, 03-13-2026, 05:17 AM
    0 responses
    286 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    283 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    133 views
    1 like
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    91 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Working...
    X