Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calling indicator from another indicator

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

    Calling indicator from another indicator

    I've some trouble when calling IMI from an own indicator/
    This is about imi : (this indicator as stand alone works perfectly)
    Code:
    private int length = 13;
            private int avgLength = 8;
            private bool showSignal = false;        
            private DataSeries Up;
            private DataSeries Down;
    -----------------------------------------------------------------------------------------------
    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);
                double imi = ((SUM(Up, Length)[0] / (SUM(Up, Length)[0] + SUM(Down, Length)[0])) * 100);
                Value.Set (imi);
                if (ShowSignal && CurrentBar > AvgLength) 
                    Signal.Set(SMA(IMI_, AvgLength)[0]);
    This is how i call it from own indic:
    Code:
    private int       imiPeriod = 12; // Default setting for IMI
                private int       imiAvgP   = 1; // Default setting for IMI
    ----------------------------------------------------------------------------------------
    double imiValue = IMI(imiAvgP,imiPeriod,false)[0];
    ........
    changing the imiAvgP don't change anything.
    imiValue still set to 0.

    Any help would be very appreciated.
    Last edited by mate41; 10-06-2015, 07:06 AM.

    #2
    Hello mate41

    Thanks for your post.

    Are you generating any errors? (Any error messages in the "log" tab of the control center)

    Comment


      #3
      no errors detected .....

      Comment


        #4
        Hello mate41,

        Thanks for your reply.

        I am unfamiliar with the IMI indicator. If it is publicly available please post the link or the source code. Alternatively send it to Platformsupport[at]Ninjatrader[dot]com Atten paul and the title of this thread in the subject line.

        Comment


          #5
          Thanks, don't know where it come from but here it is.
          Attached Files

          Comment


            #6
            Hello mate41,

            Thanks for your post.

            I installed the indicator, created a temporary indicator that called the IMI using the same varibles and using the same call. I added a Print statement immediately after where I printed the bar number as well as the value of imiValue. The print statements showed the correct value for IMI on each bar.

            Please note that there are some cases where IMI will be 0.

            I recommend that you add a print statement just below and verify that you are getting the IMI value.

            Comment


              #7
              Originally posted by NinjaTrader_Paul View Post
              Hello mate41,
              Thanks for your post.
              Please note that there are some cases where IMI will be 0.
              Thanks Paul, i did...
              The 0 value is the problem, it couldn't never be 0 or almost.
              Settings are 14,8
              Look at the panel and compare the trace with the print.
              Last edited by mate41; 10-06-2015, 09:17 AM.

              Comment


                #8
                Originally posted by mate41 View Post
                Thanks Paul, i did...
                The 0 value is the problem, it couldn't never be 0 or almost.
                Settings are 14,8
                Look at the panel and compare the trace with the print.
                Of course imi can be zero.

                Here is how imi is calculated.
                Code:
                double imi = ((SUM(Up, Length)[0] / (SUM(Up, Length)[0] + SUM(Down, Length)[0])) * 100);
                Therefore, if SUM(Up, Length)[0] is zero, then so is imi (identically). All that is required for the sum to be zero, is to have zero values of Up for length number of values.

                Comment


                  #9
                  Hello mate41,

                  As member Kogaman has advised IMI can be 0 and was what I was observing in the plot and the print using the period/lengths you had posted previously.

                  I'm unsure what you mean by settings 14, 8 but if the average length is 14 and the length is only 8 then the indicator will produce an error (value outside of valid range).

                  If you are using an average length of 8 and a length of 14 then the indicator IMI will work and its plot will still register 0 when the calculations warrant.

                  Comment


                    #10
                    Thanks Paul,
                    a 0 value is irrelevant in this case so the calculation has to be done when the bar close; at least with this simple working-out and called from another indic.I don't know at this moment why but have to work on it.
                    Problem resolved.
                    The Intraday Momentum Index is similar to the RSI, but uses the movement between the open and close whereas the RSI uses the movement between the close and the previous close. IMI values over 70 indicate an overbought condition, and values under 30 indicate oversold.
                    Useful for day-trading specially on futures.
                    br
                    Last edited by mate41; 10-06-2015, 12:40 PM. Reason: Better info

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    605 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    351 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    105 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    560 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    561 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X