Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AddDataSeries with different Trading Hours

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

    AddDataSeries with different Trading Hours

    I have an ES Chart with Trading Hours Template "CME US Index Futures ETH". BarType is my custom BarType. Stuck on stupid trying to figure out the AddDataSeries for RTH Session syntax.

    This does not work. What am I missing?

    AddDataSeries(new BarsPeriod(){BarsPeriodType = (BarsPeriodType) 856941, Value = BaseTicks, Value2 = NewTicks}, "CME US Index Futures RTH");

    Iam trying to get an indicator to only plot RTH on an ETH Chart.

    Thanks.
    (I know it will be something incredibly basic!)


    #2
    Hello TAJTrades,

    Are you executing your plotting code from BarsInProgress 1? The script will still process the primary ETH hours series in addition to the RTH series.

    Comment


      #3
      "Are you executing your plotting code from BarsInProgress 1?" YES

      Comment


        #4
        Hello TAJTrades,

        Then what problem are you seeing? Have you used a print to print the times to confirm you are seeing updates for the RTH session?

        Comment


          #5
          I am also NOT getting any Error Messages in the Output Window or the Control Center Log Tab. So am not sure what the next debugging step should be. Just a blank indicator panel with the Plot value = n/a in the Data Box window.

          Comment


            #6
            Also tried this:

            if(BarsInProgress == 1)
            {
            Print(string.format("BIP 1 Bar Number {0}", CurrentBar ));
            }

            OutputWinow is empty.


            And this:
            else if(State = State.Configure)
            {
            Print(string.format("State.Configure BarsPeriod.Value {0}", BarsPeriod.Value ));

            AddDataSeries(new BarsPeriod(){BarsPeriodType = (BarsPeriodType) 856941, Value = BarsPeriod.Value, Value2 = BarsPeriod.Value2}, "CME US Index Futures RTH");

            }

            and it is printing the correct value to the OuptputWindow.
            Last edited by TAJTrades; 08-28-2024, 11:58 AM.

            Comment


              #7
              Hello TAJTrades,

              That may be due to using variables like BarsPeriod.Value, have you tried hard coding the values and then removing/re-adding the script to where it is applied?

              Comment


                #8
                Jesse,

                Problem solved. I dumbed it down and tried this on a stock 15 Min Chart.

                In the AddDataSeries line for instrumentName:

                Wrong:
                Bars.Instrument.MasterInstrument.Name

                Correct:
                Bars.Instrument.FullName.



                Comment


                  #9
                  Hello TAJTrades,

                  Just for future reference the Bars object should not be used in that state, this is mentioned in the help guide page for Bars. You can instead use null for the instrument name to assume the primary instrument, that would be the correct way and is guaranteed to always work where using Bars would not be guaranteed.

                  Comment


                    #10
                    Jesse,

                    Thank you I missed that chapter. Change made.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    666 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    377 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    110 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    575 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    580 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X