Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can't call indicator from another

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

    Can't call indicator from another

    Hello,
    i've got this indicator and need to call it from mine.
    here is the code of the indicator i have to call:
    Code:
     protected override void OnBarUpdate()
            {            
                if (CurrentBar < 1)
                {
                    Down.Set(0);
                    Up.Set(0);
                    return;
                }
                
                Up.Set(Close[0] > Open[0] ? Close[0] - Open[0] : 0);
                Down.Set(Close[0] < Open[0] ? Open[0] - Close[0] : 0);            
                
                IMI_.Set((SUM(Up, Length)[0] / (SUM(Up, Length)[0] + SUM(Down, Length)[0])) * 100);
                if (ShowSignal && CurrentBar > AvgLength) 
                    Signal.Set(SMA(IMI_, AvgLength)[0]);
            }
    thanks for any help

    #2
    Hello mate41,
    It is difficult to say the exact code from the given code snippet, but you can call it the same way one would call a say MACD indicator for example

    Code:
    MACD(12,26,9)[0]; //gets the current value for the MACD
    MACD(12, 26, 9).Avg[0];  //get the MACD Average value
    MACD(12, 26, 9).Diff[0];   //gets the MACD Diff value
    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Hello mate41,
      So that I can test it at my end can you send the indicator (or still better a toy code*) at support[AT]ninjatrader[DOT]com

      Please append Attn:Joydeep in the subject line of your email and give a reference of this thread in the body of the email.

      I look forward to assisting you further.

      *The "toy" just means something that is a stripped down version that isn't necessarily the whole logic. It makes things easier to rout out.
      Last edited by NinjaTrader_Joydeep; 06-04-2012, 11:58 AM.
      JoydeepNinjaTrader Customer Service

      Comment


        #4
        solved

        Thanks for th reply,
        there must be 3 arguments and i'll try that...
        And yes, that was the solution.
        Last edited by mate41; 06-04-2012, 12:18 PM.

        Comment


          #5
          Originally posted by NinjaTrader_Joydeep View Post
          Hello mate41,
          It is difficult to say the exact code from the given code snippet, but you can call it the same way one would call a say MACD indicator for example

          Code:
          MACD(12,26,9)[0]; //gets the current value for the MACD
          MACD(12, 26, 9).Avg[0];  //get the MACD Average value
          MACD(12, 26, 9).Diff[0];   //gets the MACD Diff value
          Please let me know if I can assist you any further.
          1)
          Joydeep -- how is the input to the MACD here (12,26,9, for example) mapped as input to the MACD indicator? Is it their ordering in the properties section of the MACD code? Or ordering of variables defined in the variables region? Or something else? Just to be clear, I mean, how does it know that the "12" input, the first, is to be assigned to the fast EMA, and so on...

          2)
          Also, the ".Avg[0]" -- is this referencing the #properties code that returns a DataSeries, or does this go by the name of the plot itself? In other words, I don't need a plot in order to retrieve a data series, right?
          Last edited by JoshDance; 06-04-2012, 09:27 PM.

          Comment


            #6
            Hello JoshDance,
            1. It sorts the property alphabetically, Fast, Slow, Smooth for example for the MACD.

            2. It refers to the DataSeries and not the Plot name. You need to Add the plot only if you want to plot the values on the chart.

            Please refer to this sample code if you need to expose any dataseries/values which are not plots http://ninjatrader.com/support/forum...ead.php?t=4991

            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
            566 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            330 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            547 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            548 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X