Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom symbol

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

    Custom symbol

    Hi,

    I'm looking into adding a long term strategy to my existing ones trading stock indizes with only a couple of trades per year. I thought that for this purpose it is a good idea to consider some long term economic data like PE(G), CPI. I know that NT does not yet handle historical fundamental data (http://www.ninjatrader.com/support/f...ad.php?t=56369) so I'm looking for a workaroud.

    A simple idea would be to format the data in a csv file and import it in a custom symbol, say PEGRATIO. Then I could access the data in a strategy simply with Add("PEGRATIO") ; Of course the system could not go live and I would need to trade it by hand, but I could at least quantify the results of my ideas.

    Thanks

    #2
    Hello marcoheimann,

    Yes, importing it as a symbol would be one way of getting this data inside of NinjaTrader. You may also read the data from a file like a csv or txt file into NinjaTrader for the Historical Data and then use the OnFundamentalData for any of the real-time data inside of your strategy.

    Let me know if you have any further questions.
    JCNinjaTrader Customer Service

    Comment


      #3
      Thank you JC,

      I created a new symbol and imported SP500 earnings which I can now access during backtesting.

      Can you please clarify the read/write workaround you suggested. Do you mean that i could run a indicator on a live symbol that writes the OnFundamentalData to a csv file wich I could then import to another symbol for backtesting?

      Since most fundamental data doesn't change that fast I was going to scrap the data on weekends with some other tool.

      Comment


        #4
        Hello marcoheimann,

        No, I was referring to instead of having to import the file into NinjaTrader that you may just read the file into NinjaScript. This way will be a bit more custom programming to be able to handle this so you may want to stick with just import the data so NinjaTrader will handle that for you.
        JCNinjaTrader Customer Service

        Comment


          #5
          That would be a cleaner solution since it allows to run the strategy. I also came across the StreamReader reference sample and it doesn't look too difficult to implement.

          Thanks JC

          Comment


            #6
            Originally posted by marcoheimann View Post
            That would be a cleaner solution since it allows to run the strategy. I also came across the StreamReader reference sample and it doesn't look too difficult to implement.

            Thanks JC
            Hi Marco Heimann,

            Could you let me have the source for the StreamReader reference sample, thanks. Did implement the import of data in the end? I'm also looking to do this.

            Comment


              #7
              Hello Farmer George,


              Here is the link to our StreamReader sample that you may view and download.




              Let us know if we can be of any further assistance.
              JCNinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_JC View Post
                Hello Farmer George,


                Here is the link to our StreamReader sample that you may view and download.




                Let us know if we can be of any further assistance.
                Thanks for that.

                Comment


                  #9
                  Originally posted by NinjaTrader_JC View Post
                  Hello Farmer George,


                  Here is the link to our StreamReader sample that you may view and download.




                  Let us know if we can be of any further assistance.
                  Does this only handle OHLC data or can other forms of data be imported e.g say daily interest rates or inflation rates? Thanks.

                  Comment


                    #10
                    Hello Farmer George,

                    Thanks for your post.

                    If you are wanting to import historical data to be used for backtesting, this will need to be done with the Historical Data Manager with a specially formatted text file or csv file.

                    Tools -> Historical Data Manager... -> Import -> Start Import

                    The content format and file name format are important and can be found from the link below. (Please see the section 'How to import historical data from a text file')
                    http://www.ninjatrader.com/support/h.../importing.htm


                    The StreamReader will allow you to pull any information from a text file or csv, but this data will not be used in the primary dataseries to fill orders. You can use this data for calculations however. This means yes you can read this information for daily interest rates / inflation rates or any other data to a variable, and then use this information in the script.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by NinjaTrader_ChelseaB View Post
                      Hello Farmer George,

                      Thanks for your post.

                      If you are wanting to import historical data to be used for backtesting, this will need to be done with the Historical Data Manager with a specially formatted text file or csv file.

                      Tools -> Historical Data Manager... -> Import -> Start Import

                      The content format and file name format are important and can be found from the link below. (Please see the section 'How to import historical data from a text file')



                      The StreamReader will allow you to pull any information from a text file or csv, but this data will not be used in the primary dataseries to fill orders. You can use this data for calculations however. This means yes you can read this information for daily interest rates / inflation rates or any other data to a variable, and then use this information in the script.
                      Thanks for the prompt reply ChelseaB.

                      So, presumably I could use the imported Dataseries to create an indicator?

                      Will I have to adhere to the OLHC format etc when supplying the data information? I haven't used StreamReader so am unsure about the script. Thanks.

                      Comment


                        #12
                        Hello Farmer George,

                        The data read from the StreamReader will only be used by you for your logic and will not be used by the NinjaTrader backtest engine.

                        The structure of the data is completely up to you. My suggestion would be to use a dictionary or keyvaluepair so that you may store the data along with a time stamp. Then you can check that the current bar of historical data matches the timestamp of the custom data you are importing.

                        http://www.dotnetperls.com/dictionary
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          Originally posted by NinjaTrader_ChelseaB View Post
                          Hello Farmer George,

                          The data read from the StreamReader will only be used by you for your logic and will not be used by the NinjaTrader backtest engine.

                          The structure of the data is completely up to you. My suggestion would be to use a dictionary or keyvaluepair so that you may store the data along with a time stamp. Then you can check that the current bar of historical data matches the timestamp of the custom data you are importing.

                          http://www.dotnetperls.com/dictionary
                          Hi ChelseaB,

                          Ok. Thanks for that.

                          I think there's a bit of learning curve here as I'm new to C# and Ninja script. If anyone has implemented this I'd be keen to see the details. Thanks.

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by ScottWalsh, Today, 06:52 PM
                          4 responses
                          32 views
                          0 likes
                          Last Post ScottWalsh  
                          Started by olisav57, Today, 07:39 PM
                          0 responses
                          4 views
                          0 likes
                          Last Post olisav57  
                          Started by trilliantrader, Today, 03:01 PM
                          2 responses
                          19 views
                          0 likes
                          Last Post helpwanted  
                          Started by cre8able, Today, 07:24 PM
                          0 responses
                          6 views
                          0 likes
                          Last Post cre8able  
                          Started by Haiasi, Today, 06:53 PM
                          1 response
                          5 views
                          0 likes
                          Last Post NinjaTrader_Manfred  
                          Working...
                          X