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

Getting ATR from second Data Series

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

    Getting ATR from second Data Series

    Hello

    I have been trying to get what I want for weeks now and I really need help on something that seems really simple to me.


    I have a main data series that is a 30 Minute chart.
    Now I am adding a second Data Series with a different trading hours ( Period Day and a different session name ) to calculate the ATR on that Data Series which I would like to use on my main Data Series.

    I have set the ATR as :

    atr ATR;
    atr = ATR(BarsArray[1], 7);


    When I try to use atr[0] on my main Data Series ( 30 Minute bars ) I get nothing.

    In reality I need 3 Data Series with different session to calculate different things in order to use it from my main Data series



    Thank you


    Last edited by blar58; 06-21-2022, 10:02 AM.

    #2
    Hello blar58,

    Thank you for your note.

    What trading hours template is in use for the daily series vs. for the primary series?

    How many days of data are you loading on the chart?

    Thanks in advance; I look forward to assisting you further.

    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hello Kate,

      I am using the CME US Index Futures RTH for my main Data Series ( Period 30 Minute 20 Days)
      I am using the CME US Index Futures ETH for my second Data Series to calculate ATR ( Period : Day , 20 days )
      I am using the CME US Index Futures Overnight Only session ( custom Trading Hours that I created ) for my third Data Series to calculate ATR ( Period Day, 20 Days)

      Comment


        #4
        Hello blar58,

        Thank you for your reply.

        I suspect you may be running into an issue with how the system treats added series with different trading hour templates. From our help guide:

        If your NinjaScript object is using AddDataSeries() allowing to specify a tradingHoursName, please keep in mind that: An indicator / strategy with multiple DataSeries of the same instrument will only process realtime OnBarUpdate() calls when a tick occurs in session of the trading hour template of all added series. Any ticks not processed will be queued and processed as a tick comes in for all subsequent DataSeries.

        See the warnings on this page: https://ninjatrader.com/support/help...dataseries.htm

        Do the sessions all overlap at any point, or does the overnight only template basically include all the time RTH doesn't?

        Thanks in advance; I look forward to assisting you further.
        Last edited by NinjaTrader_Kate; 06-21-2022, 11:51 AM.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Kate

          Is there another way to do that ?

          I have worked with barsRequest to get the data and calculate ATR from there but again it seems that the calculated ATR is not available to my primary Data Series

          Comment


            #6
            Hello blar58,

            Thank you for your reply.

            Another thing I want to point out here is that applying a trading hours template won't actually do anything to daily bars as these are ETH by default. If you need a daily series with a trading hours template applied, you'd need to use a 1440 minute series and apply the desired template.

            I've talked this over with a colleague and he agrees that it's likely you're seeing this because all 3 added series have to be in session. If there is a series with a trading hours that is opposite, it will never be all series in session and OnBarUpdate won't be run.

            That being said, with a BarsRequest you could request data, and then pump that to a series that is synchronized with the primary series. You can take a look at the attached DynamicBarsRequestExample for some direction there.

            Please let us know if we may be of further assistance to you.
            Attached Files
            Kate W.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by traderqz, Yesterday, 04:32 PM
            1 response
            10 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by f.saeidi, Today, 05:56 AM
            1 response
            4 views
            0 likes
            Last Post Jltarrau  
            Started by Jltarrau, Today, 05:57 AM
            0 responses
            4 views
            0 likes
            Last Post Jltarrau  
            Started by Stanfillirenfro, Yesterday, 09:19 AM
            7 responses
            51 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by TraderCro, 04-12-2024, 11:36 AM
            4 responses
            71 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X