Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Capture UI Setting

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

    Capture UI Setting

    Can I capture the UI setting in a Strategy for the Trading Hours? If so, how?

    I am attempting to AddSataSeries but only if the TRading Hours is ETH.

    This code will not work because the Bars Object is not available in State.Configure. So I though about capturing the Trading Selection to test for ETH.

    PHP Code:
                else if (State == State.Configure)
                {
                    if(Bars.TradingHours.Name.Contains(" ETH"))
                    {
                        //    tajBar == 159753
                        AddDataSeries(null, new BarsPeriod(){ BarsPeriodType  = (BarsPeriodType) 159753, Value  = BarsPeriod.Value, Value2 = BarsPeriod.Value2},"CME US Index Futures RTH", true);                
                    }
    
                }
    
                else if (State == State.DataLoaded)
                {
                        //    ETH Chart
                        if(Bars.TradingHours.Name.Contains(" ETH"))
                        {
                            DayType = tajBarDayType(BarsArray[1]);
                        }
    
                        //    RTH Chart
                        else
                        {
                            DayType = tajBarDayType();
                            AddChartIndicator(DayType);    
                        }
                }            
    ​ 
    


    The item I am trying to capture in the UI is Trading Hours.
    then use it in State.Configure instead of the Bars Object.



    #2
    Hello TAJTrades,

    Thank you for your post.

    Unfortunately, it's not possible to do this since the trading hours information is not available until State is State.DataLoaded:

    "Warning: The properties in this class should NOT be accessed within the OnStateChange() method before the State has reached State.DataLoaded​"



    And all calls to AddDataSeries() must be made when State is State.Configure:

    "This method should ONLY be called from the OnStateChange() method during State.Configure​"

    Comment


      #3
      I am familiar with all that replied.

      They question is can I somehow get the "Trading hours" parameter from the UI from within State.Configure? This question is NOT about using the Bars Object in State.Configure.

      Comment


        #4
        Hello TAJTrades,

        Unfortunately, it is not possible to get this information before State.DataLoaded. As stated in the Help Guide link in my previous reply:

        "Warning: The properties in this class should NOT be accessed within the OnStateChange() method before the State has reached State.DataLoaded​"



        There is no workaround to obtain the trading hours info another way before State.DataLoaded.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        48 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        126 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        66 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X