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 Hwop38, 05-04-2026, 07:02 PM
    0 responses
    169 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    324 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    250 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    353 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    180 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Working...
    X