Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calling Indicator for Multi Timeframe

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

    Calling Indicator for Multi Timeframe

    I am trying to call an indicator in a script for multi timeframe so that my charts do not look all messed up after holidays (Equi spacing = True instead of loading the data series)


    I did this:


    protected override void Initialize()
    {
    Add(PeriodType.Minute,2);
    Overlay = false;
    }

    and I do this:

    if (BarsInProgress == 0)
    MEFLinRegAngle(Closes[1],60,14,3,9,3,false);

    which from what I read is correct, can someone help me understand why it will not plot the indicator at all?

    Thanks,
    R.T.

    #2
    Hi R.T,

    Please check log tab of control center for any error messages. Multiseries scripts will need something like the following to prevent accessing data objects before they exist:

    if (CurrentBars[0] < 0 || CurrentBars[1] < 0) return;

    Add that to first line of OnBarUpdate()
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks Ryan,

      I added this:

      /// <summary>
      /// Called on each bar update event (incoming tick)
      /// </summary>
      protected override void OnBarUpdate ()

      {
      // Use this method for calculating your indicator values. Assign a value to each
      // plot below by replacing 'Close[0]' with your own formula.
      if (CurrentBars[0] < 0 || CurrentBars[1] < 0) return;
      if (BarsInProgress == 0)
      MEFLinRegAngle(Closes[1],60,14,3,9,3,false);

      but still does not plot...

      Comment


        #4
        Are there any error messages in log tab of control center?
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Yes, sorry,

          on Bar 0 : Index was out of bounds of the array"

          Comment


            #6
            You may have to play with the values there on CurrentBars[1], in case your indicator does any indexing for past values. Try with < 20 and then adjust up/down as needed.

            If you're still not able to see a plot, please share the indicator script and let us know the primary series interval you're applying this to.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Thanks,

              tried everything inbetween nad it still will not plot, no new errors reported in the log

              Comment


                #8
                I am applying this to a 5 minute primary... I attached the indicator
                Attached Files
                Last edited by tshirtdeal; 02-21-2012, 02:34 PM.

                Comment


                  #9
                  Thanks for the file. Where are you setting the plot in your own indicator? This line you included from earlier doesn't seem to be doing anything.

                  MEFLinRegAngle(Closes[1],60,14,3,9,3,false);
                  Ryan M.NinjaTrader Customer Service

                  Comment


                    #10
                    okay, that was one of my other questions... do I have to call each plot for the indicator or can I just call the entire indicator up?

                    any tips to getting this to plot are greatly appreciated

                    Comment


                      #11
                      You have to set indicator plots to something if you're using this in your own indicator. You have to set for each plot you want to display. Use the name of your plot and Set it to that indicator value. The default is named Plot0 but you may have change it in the indicator wizard.

                      Plot0.Set(MEFLinRegAngle(Closes[1],60,14,3,9,3,false)[0]);

                      This page can help with some NinjaScript indicator tutorials to assist with basic structure:
                      Last edited by NinjaTrader_RyanM1; 02-21-2012, 03:19 PM.
                      Ryan M.NinjaTrader Customer Service

                      Comment


                        #12
                        Hey, well I get a plot now, it gives the correct value for the last bar but it does not look correct past the first bar and I cannot change the color of the line plot... any ideas?

                        Comment


                          #13
                          Okay, it looks perfect on a 2 minute chart but totally different on the 5 minute (primary) chart when I add it,

                          Comment


                            #14
                            okay, on the primary 5 minute chart it is caculating the values but only to the 5 minute bars, the value plot is not creating a "bar plot" for each 2 minute candle coming through.... any ideas how to fix that so it looks correct?

                            Comment


                              #15
                              From your description, it sounds like it's working correctly. The values will by synced to that 5 minute bar, so there no 2min data that would take place "inbetween" them. If you aren't sure how it should look, try a simple example with SMA plotted on a secondary series. If you have any further concerns post a screenshot of this simple implementation.
                              Ryan M.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              579 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              334 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
                              554 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              551 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X