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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    152 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    87 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    131 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    127 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    106 views
    0 likes
    Last Post CarlTrading  
    Working...
    X