Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

which dataseries returns my indicator

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

    which dataseries returns my indicator

    I'm new to NinjaScript and I have some newbie questions related to dataseries handling:

    1 - Suppose I write code for a multiplot indicator like stochastics that plots two signals (%K and %D). How do I know which one of both dataseries is returned by the indicator? Is it the last one that was plotted?

    2 - Suppose I want to code an indicator to be used inside another indicator but that I don't plot it. I mean, I only need to use the dataseries returned by my new indicator but it's not necessary to display it. Then, I don't need to define an Add Plot instruction into Initialize(). What do I have to define in Initialize() in order to "tell" the program which dataseries must be returned by the indicator?

    #2
    Hello gofortips,
    Welcome to NinjaTrader forum and I am happy to assist you.

    To explicitly call a specific data series please use the below codes
    Code:
    Stochastics(periodD, periodK, smooth).K; //calls the data series K
    Stochastics(periodD, periodK, smooth).D;	//call the data series D
    To get the value you can use like
    Code:
    double dValue = Stochastics(periodD, periodK, smooth).D[0];
    To call an indicator without plotting it please follow the below steps:
    Code:
    if (SMA(14)[0] > Close[0])
    {
    	//do something
    }
    In the above code I am calling the SMA indicator.

    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    581 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    338 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    552 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X