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 kinfxhk, 07-14-2026, 09:39 AM
    0 responses
    127 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 10:18 AM
    0 responses
    105 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 09:50 AM
    0 responses
    85 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 07:21 AM
    0 responses
    105 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-11-2026, 02:11 AM
    0 responses
    86 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X