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

Custom Instrument?

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

    Custom Instrument?

    Hi

    I'd like some general guidance on how to create a custom/synthetic instrument that I can plot on a candlestick chart as though it was a valid instrument from a data provider.

    The instrument would be an arithmetic combination of several other instruments, like an index.
    It does not need to update with incoming ticks, but ideally would update on a timer, e.g. every minute.

    My initial thoughts are...
    Create the instrument in the Instrument Manager.
    Create an indicator or strategy to periodically write the calculated daily and minute 'price' data to day and minute folders in the db folder.
    Open a chart with the custom instrument.
    Apply an indicator or strategy that reloads the data on a timer (possibly the same indicator or strategy that writes the data).

    Will this work?
    Are there better ways of doing it?

    Any suggestions gratefully received.

    Regards
    Tony

    #2
    Hi Tony,

    This is possible.

    A great example of this is the HeikenAshi indicator which overlays its own bars on top of the chart.

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea

      I've tried using the approach used for the Heiken Ashi indicator, but the resulting indicator must load the data series for 8 instruments for each instance, so it's become cumbersome and not very robust.

      I think a better approach is to create a custom instrument, with its own calculated data, so there is only one data series to be loaded.

      I've tried this:
      Create an instrument in the instrument manager (AUDIDXTEST). It made me choose an exchange (I chose Default) and a Symbol Map (I typed "AUD Test" against Simulator).
      To get some data to use, I exported AUDCAD minute.last data.
      Rename the AUDCAD minute data as AUDIDXTEST.last.txt.
      Import the data.
      I was able to load the data to a chart, but it was corrupt. See attached image.

      Is it possible to create a custom chart like this?
      Should the process I used work? If not what am I doing wrong?
      Is there a better way?

      Cheers
      Tony
      Attached Files

      Comment


        #4
        Hi Tony,

        How is the data corrupt?

        It appears to be displaying on the chart.

        Are the bars on the chart not matching what is in the file?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea

          In the attachment to my previous post, two 60 min charts are shown - AUDCAD and my custom AUDIDXTEST. AUDIDXTEST was created by exporting the AUDCAD data and importing it as AUDIDXTEST. I think the two charts should be identical, but clearly they are not.

          The text files AUDIDXTEST.Last.txt has continuous 1 min data, unlike the chart.

          Should the process I described work as I expect? If so, what am I missing?

          Cheers
          Tony
          Last edited by Jellybean; 03-27-2017, 01:04 PM.

          Comment


            #6
            Hi Tony,

            The issue is the number of decimal places.

            There does seem to be unexpected behavior when importing a file as when I tested this, the exported file has the correct number of decimals, however, after imported is showing the wrong number of decimals in the historical data manager.

            I will do some further testing with this and then report the behavior to our development.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hi Chelsea

              Your comment about the decimal places suggested I may have the tick size wrong, but no.

              I've attached the instrument setting for the normal AUDCAD and my custom AUDIDXTEST for your reference.

              Cheers
              Tony
              Attached Files

              Comment


                #8
                Tony,

                Our development has let me know that Forex symbols must have 6 characters.

                By having 7, the data automatically imports as a stock.

                Should you absolutely want to do this, use 6 characters when creating the new instrument.

                Like ADCADB.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Thanks, Chelsea.

                  I can see now that when I imported the data, a new stock instrument was created.

                  However, I tried the same process with only a 6-character name (AUDAJS) for the new instrument and data file, as you suggested, but I still get the same result.

                  I can export AUDCAD data and import it back to AUDCAD fine, but renaming the experted file and importing to AUDAJS makes it a stock. There must something else that causes the data to be imported as a stock. Any ideas?

                  Cheers
                  Tony

                  Comment


                    #10
                    Hi Tony,

                    I've tested and confirmed and sent this back to development.

                    I appreciate your patience.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by Jellybean View Post
                      Thanks, Chelsea.

                      I can see now that when I imported the data, a new stock instrument was created.

                      However, I tried the same process with only a 6-character name (AUDAJS) for the new instrument and data file, as you suggested, but I still get the same result.

                      I can export AUDCAD data and import it back to AUDCAD fine, but renaming the experted file and importing to AUDAJS makes it a stock. There must something else that causes the data to be imported as a stock. Any ideas?

                      Cheers
                      Tony
                      Hello Jellybean,

                      Thank you for your patience.

                      Development has got back to us on this matter. The new instrument data is imported as a stock because it will only ever import data as a forex instrument if the the symbol is valid to the format of a forex symbol.

                      For example, EURUSD contains six characters and each name is a valid currency. EURUSDA as an example would be invalid based on the length of the name and the invalid currency.

                      Please let me know if you have any questions.

                      Comment


                        #12
                        Hi Patrick

                        Thanks. I'll just multiply my values by 1000 to keep the precision and treat it as a stock or index.

                        Regards
                        Tony

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by cre8able, Today, 03:20 PM
                        0 responses
                        5 views
                        0 likes
                        Last Post cre8able  
                        Started by Fran888, 02-16-2024, 10:48 AM
                        3 responses
                        47 views
                        0 likes
                        Last Post Sam2515
                        by Sam2515
                         
                        Started by martin70, 03-24-2023, 04:58 AM
                        15 responses
                        114 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Started by The_Sec, Today, 02:29 PM
                        1 response
                        7 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Started by jeronymite, 04-12-2024, 04:26 PM
                        2 responses
                        31 views
                        0 likes
                        Last Post NinjaTrader_BrandonH  
                        Working...
                        X