Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Detecting regular trading hours in a strategy

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

    Detecting regular trading hours in a strategy

    Hello

    I am coding up a strategy that operates on a 1-minute bar chart on US stocks. My strategy requires the chart cover pre and after market hour bars (to update my data model) but I am looking to only trade during regular trading hours. (i.e., 930a - 4p or 930a - 1p US Eastern for full and half trading days). I cant seem to find a way to detect regular trading hour window for a given trading day. The option to use a SessionIterator doesn't seem helpful as it seems to be a way to read the Trading Hours setting of the chart (which in my case is set to default 24x7).

    Is there a way in NinjaScript to accomplish my need?

    Thanks!

    #2
    Hello srkbits,

    You can add a series with the trading hours you want and use the SessionIterator with that BarsArray index.



    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the quick response. I will need a bit more explanation. When you say "you can add a series with the trading hours you want" - in the drop down for supported trading hours in the data series UI within charts, the only option that seems applicable for my scenario of US stocks is "US Equities ETH" but this trading hour option limits pre-trading hours to start 8a EST instead of 4a EST. Would you know of a way how I can configure trading hours to reflect true pre and after trading hours for US equities? And in a way that allows me to use SessionIterator to detect if a given day is a full or half trading day session?

      Thanks

      Comment


        #4
        Hello srkbits,

        Series are added with AddDataSeries(). The tradingHoursName will be the name of the trading hours template.

        Below is a link to the help guide on AddDataSeries().


        Where you have mentioned:
        "Would you know of a way how I can configure trading hours to reflect true pre and after trading hours for US equities?"

        Yes, use the name "US Equities ETH" as the trading hours template name.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea - Like I mentioned earlier, "US Equities ETH" is only loading bars starting 8a EST for pre-trading hours and not from 4a EST as I would have expected. Is there a different trading hours settings that will load the full pre and post trading hours windows (other than the default 24x.. setting, which does not help when wanting to see actual trading hours with SessionIterator).

          Comment


            #6
            Hello srkbits,

            You can create your own custom template if you do not want to use the hours defined by the exchange.


            The SessionIterator will use the trading hours of the supplied bars object.
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by junkone, Today, 11:37 AM
            0 responses
            1 view
            0 likes
            Last Post junkone
            by junkone
             
            Started by quantismo, 04-17-2024, 05:13 PM
            5 responses
            34 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by proptrade13, Today, 11:06 AM
            1 response
            5 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Started by love2code2trade, 04-17-2024, 01:45 PM
            4 responses
            34 views
            0 likes
            Last Post love2code2trade  
            Started by cls71, Today, 04:45 AM
            2 responses
            10 views
            0 likes
            Last Post eDanny
            by eDanny
             
            Working...
            X