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

Multi-Time Frame (primary data series is larger than secondary data series)

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

    Multi-Time Frame (primary data series is larger than secondary data series)

    If I begin with an existing 1-minute chart, is it possible in NT8 to use AddDataSeries() to create a secondary data series with 1-tick resolution?

    I have attached a code example which seems to demonstrate that the above scenario is not possible in NT8. The indicator is intended only for demonstration purposes, so it only prints diagnostic messages to a NinjaScript Output window.

    Steps to replicate:

    Download the attached zip archive to a folder of your choice
    Control Panel -> Tools -> Import -> NinjaScript Add-On (browse for the zip file and install)
    Create a 1-minute chart (I tested with instrument "ES 03-17" using iqFeed)
    It might be necessary to connect the chart to a live datafeed during regular trading hours
    Control Panel -> New -> NinjaScript Output (in order to view diagnostic messages from the script)
    Apply the attached Indicator to the chart
    Observe the diagnostic reports which appear in the NinjaScript output window

    Note that only the primary data series is able to print information about the status of key variables to the output window, but the code tries unsuccessfully to print information about the secondary data series which is based on 1-tick resolution. I think that the secondary data series never gets created but I am not sure if that is correct.

    The attached code example is a slightly modified version of a very helpful working example from another thread:



    The working example demonstrates that the secondary series can be the same or higher resolution, and if those conditions are met, I think there will always be a complete diagnostic report from both data series. In my version of the file, I commented out the working code in order to highlight the not working scenario in which the secondary data series is smaller.

    Is there a limitation in NT8 which prevents the use of a 1-tick secondary data series on an existing 1-minute chart, or is there just a mistake somewhere in the attached code?

    note of apology to website administrator: an earlier version of this post was originally started in a different category called "Indicator Development". I have now started an alternative version of the original post here in "Indicator Development" because it may apply to both categories, and the replies may not match. Here is a link to my first post:

    Attached Files

    #2
    Hello Kh_Model,

    Thank you for writing in.

    Yes, it is possible to add a tick secondary data series and the attached indicator demonstrates this.

    When I attach your indicator to a chart and pull up an output window I’m seeing its printing the correct information for the secondary data series as well as the first. See the Attached results.

    The issue you link to in the following post does indeed highlight a bug with certain indicators, where passing in a BarsArray value will not always give you the correct output.


    I have revised your indicator which will print the value of the primary and secondary last price correctly on each bar update as well as the value of the 5 period SMA of both series. If, however you comment out lines 79/80 and uncomment lines 82/83, compile and reload historical NinjaScript on the chart you will see the prints for the CCI indicator will not respect the BarsArray passed to it and instead use the Bars In Progress as the data series.

    Could you review my results and let me know if there are any other things I need to do to see the same thing on my end that I may have missed?

    Also I would suggest upgrading to NinjaTrader 8.0.3.0 if you have not done so already.


    I look forward to your reply.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Thank you to NinjaTrader_AlanP for such extremely helpful support. After my initial post and prior tests, I failed to notice that my NT8 version 8.0.0.1 is now obsolete and therefore I will upgrade today to 8.0.0.3 as per your suggestions so that I may review your example code and then report the results. I also noticed that my iqFeed version is no longer supported by NT8 so it only provides historical data, and that may have influenced my prior tests. I failed to notice that my realtime data could only be acquired via my InteractiveBrokers connection and perhaps it was not connected during the tests. I will upgrade iqFeed also.

      update: for NinjaTrader_AlanP, so far I can confirm that your code example is able to write diagnostics to the NinjaTrader Output window for both the primary and secondary data series (as-is without uncommented lines for CCI indicator) even with nt 8.0.0.1. My results were obtained after I upgraded iqFeed client to 5.2.3.0 and connected to my realtime subscription for iqFeed, followed by "reload historical data".

      I still plan to upgrade to 8.0.0.3 and post the output for TF 03-17 in the near future, but I need some time to backup my systems here first.
      Last edited by kh_model; 01-11-2017, 08:37 AM.

      Comment


        #4
        For NinjaTrader_AlanP, I have attached two output files which contain diagnostic messages from the code sample that was provided to me. As requested, I upgraded NT to 8.0.0.3 from my existing 8.0.0.1 prior to running tests. In addition, I upgraded to iq client 5.2.3.0 prior to testing.

        On another note, it looks like my private multi-series code that worked before in NT7 has now been ported to NT8 with success thanks to the LINQPAD5 converter script with dotnet 4.6.2 installed, and also to excellent communication here in the nt forums. I found the nt8 help guide to be extremely useful when it came time to make manual conversions in places where the automated converter script did not go far enough, although some simplification was needed to achieve those results.

        Attached Files

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by nandhumca, Yesterday, 03:41 PM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by The_Sec, Yesterday, 03:37 PM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by vecnopus, Today, 06:15 AM
        0 responses
        1 view
        0 likes
        Last Post vecnopus  
        Started by Aviram Y, Today, 05:29 AM
        0 responses
        5 views
        0 likes
        Last Post Aviram Y  
        Started by quantismo, 04-17-2024, 05:13 PM
        3 responses
        27 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X