Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Accessing multi time frame indy from a second indy

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

    Accessing multi time frame indy from a second indy

    I have an indicator that uses a second time frame to create a paint bar for the panel background. The background simply changes from red to green to red to green for each bar depending on the results returned by the second time frame.

    Now I want to access the string series created by that indicator in a second indicator that does not use multi time frames.

    Indicator1 myOtherIndicator = Indicator1(p1,p2,p3);

    string myColor = myOtherIndicator.BColor[0]; //BColor is the string series, R or G

    if (myColor == "G") BackColor = Color.FromArgb(255,0,64,0);
    if (myColor == "R") BackColor = Color.FromArgb(255,64,0,0);

    This code accesses the other indicator, but the strings returned are all wrong.

    Do I need to add the other time frame to this indicator? Do I need to pass extra parameters/BarsArrays or something to myOtherIndicator?

    Any help would be appreciated.

    #2
    Hello snaphook,

    No, you shouldn't need to add the series to the calling indicator. I would check log tab of control center to make sure you aren't running into issues accessing objects.

    Also make sure you are following with this sample here on exposing values from other indicators:


    This ensures the string series is up to date.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      I believe that I am experiencing the exact same problem (see my post from today).
      My log doesn't report any problems.

      Comment


        #4
        Hi Trader2Be,

        If you created a separate thread, please continue there.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Ok, I will:
          here is my thread: http://www.ninjatrader.com/support/f...ad.php?t=37119

          Comment


            #6
            Session Template

            AHA, the problem is with the Data Series session template. The calling chart is on Default 24/7. How do I pass that template to the called indicator?

            Comment


              #7
              That might do it, snaphook. Good catch.



              If a multi-series script adds an additional Bars object that already exists on the chart, the script will use the preexisting series instead of creating a new one to conserve memory. This includes that series' session template as applied from the chart. If the Bars object does not exist on the chart, the session template of the added Bars object will be the default one set for that instrument in the Instrument Manager and not the session template of the primary Bars object.
              Ryan M.NinjaTrader Customer Service

              Comment


                #8
                RyanM

                Thank you!!! Where can I send the Scotch?

                Comment


                  #9
                  I guess that I am still missing the solution to this problem.
                  How do we fix this?

                  Comment


                    #10
                    Since there is apparently no way to change the session template programmatically, is the only way to fix this to change the default session template for the instrument being used so that it matches the calling chart?

                    Comment


                      #11
                      Yes. It appears that is the solution. It fixed mine. Simply edit the instrument in Instrument Manager and change the default Session Template to that of the calling chart. It won't work if you are calling from RTH and 24/7 on different charts, though..

                      Not the most elegant solution, but it works. Perhaps NT can put this into a future update.

                      Comment


                        #12
                        Thanks for the update here. Yes, changing the session template in the instrument manager is good to force the session template of the added series.

                        If you add a multiseries indicator to a chart and the chart contains the series, then it will use the session template of the chart series. This only works if the series is added to the indicator directly, and not called from a separate indicator.
                        Ryan M.NinjaTrader Customer Service

                        Comment


                          #13
                          Ok I am glad to report that this approach fixed the problem on my end as well. I wish that there was a way to programmatically set the session template. Maybe as an additional parameter in the Add() method. Something the development team may want to consider for a future release.

                          Comment


                            #14
                            Originally posted by snaphook View Post
                            Yes. It appears that is the solution. It fixed mine. Simply edit the instrument in Instrument Manager and change the default Session Template to that of the calling chart. It won't work if you are calling from RTH and 24/7 on different charts, though..

                            Not the most elegant solution, but it works. Perhaps NT can put this into a future update.
                            Thanks for your help, snaphook. In a way I am glad that we faced the same problem at the same time...it was resolved quickly.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by PaulMohn, Today, 03:49 AM
                            0 responses
                            6 views
                            0 likes
                            Last Post PaulMohn  
                            Started by inanazsocial, Today, 01:15 AM
                            1 response
                            9 views
                            0 likes
                            Last Post NinjaTrader_Jason  
                            Started by rocketman7, Today, 02:12 AM
                            0 responses
                            10 views
                            0 likes
                            Last Post rocketman7  
                            Started by dustydbayer, Today, 01:59 AM
                            0 responses
                            4 views
                            0 likes
                            Last Post dustydbayer  
                            Started by trilliantrader, 04-18-2024, 08:16 AM
                            5 responses
                            23 views
                            0 likes
                            Last Post trilliantrader  
                            Working...
                            X