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.
    https://ninjatrader.com/support/help...dataseries.htm
    https://ninjatrader.com/support/help...oniterator.htm

    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().
        https://ninjatrader.com/support/help...dataseries.htm

        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.
            https://ninjatrader.com/support/help...ngHourTemplate

            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 tgn55, Today, 09:51 PM
            0 responses
            1 view
            0 likes
            Last Post tgn55
            by tgn55
             
            Started by cxxazssx, Today, 09:45 PM
            0 responses
            1 view
            0 likes
            Last Post cxxazssx  
            Started by southpacific001, 02-26-2021, 09:25 PM
            14 responses
            65 views
            0 likes
            Last Post REI140205  
            Started by punkiy2111, Today, 05:22 PM
            0 responses
            3 views
            0 likes
            Last Post punkiy2111  
            Started by secrettrader, Today, 03:36 PM
            0 responses
            8 views
            0 likes
            Last Post secrettrader  
            Working...
            X