• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how do i create a custom index?

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

    how do i create a custom index?

    I'm really just interested in combining two different EOD securties into a single price series for charting and backtesting. Is that possible in NT? Big time noobie, just trying to figure out where to start, if this is possible.
    thanks for your help,
    rhoward

    #2
    Hello,

    There is not a way to do this right out of the box, but it would be possible to accomplish this by custom coding an indicator. If you would like to go this route, I'll be happy to point you in the right direction.
    Dave I.NinjaTrader Product Management

    Comment


      #3
      I would appreciate that, Dave..Hopefully the coding would not be too much of a daunting task! I have a little experience in creating indicators, but not in NT.
      thanks again,
      rhoward

      Comment


        #4
        I'll be happy to help, and the task should not be too daunting if you have previous coding experience.

        There is a pre-loaded indicator called HeikenAshi that already hides and replaces the data series with its own series of bars on a chart, and you can use this indicator as a starting point to develop what you are looking for. You will need to open the source of the HeikenAshi indicator via Tools > Edit NinjaScript > Indicator, then copy all of the code and paste it into a new indicator via Tools > New NinjaScript > Indicator.

        In the new indicator, you can use the Add() method to add any two data series that you wish, such as two daily series. You can then delete all of the logic related to the HeikenAshi calculations in HAClose.Set(), HAOpen.Set(), etc., and replace it with your own calculations to combine the values of the two data series.

        Assuming you wish to find the average between the prices of both data series, you could do something like the following:

        HAClose.Set((BarsArray[1].GetClose(0) + BarsArray[2].GetClose(0)) / 2);

        ...and the same for HAHigh, HALow, and HAOpen.

        One quick thing to note -- If you go this route, you will need to make sure that "Auto Scale" is set to "False" in the Data Series window for the primary data series, so that you don't run into any scaling issues.

        Please let me know if I can assist further.
        Dave I.NinjaTrader Product Management

        Comment


          #5
          I am looking for a way to plot the oil crack spread for NT8, which has three futures instruments and this weighting 84*RB + 42*HO - 3*CL. Would the Heikin-Ashi code provide a base to allow three instruments and the multiplication and subtraction?

          BTW, in NT8, I found a HeikenAshiBarsType, but not a HeikinAshi indicator.

          I found a "Spread" NT8 indicator in futures.io that may be a good foundation. It has two dataseries, and parameters for the ratios. I will see if I can add a third.
          Last edited by BruceK; 11-14-2018, 10:43 PM.

          Comment


            #6
            Hello BruceK,

            Thanks for your inquiry.

            NinjaTrader 8 has a Heiken Ashi BarsType which rounds values to a tick size so they can be backtested appropriately. This makes the calculation different from the indicator which uses the data points without rounding the input. We have a Heiken Ashi indicator that can be downloaded below.

            Heiken Ashi - https://ninjatraderecosystem.com/use...heiken-ashi-8/

            The Heiken Ashi indicator would be a good example to use for rendering candlesticks based off your own Open High Low and Close Series. Calculating based off of additional data series could be better referenced in a spread indicator.

            For adding additional data series to your script, this would be done using AddDataSeries and following the multi time frame documentation linked below. Please note that it is not technically supported to use user defined input for adding additional data series. (See notes in AddDataSeries) A spread indicator that uses user defined input for the data series would break this rule, and issues can particularly be seen if you are running optimizations in the Strategy Analyzer. There are several cases where this does work, but if you run into issues, be sure to test with a hardcoded data series, which we do support.

            Multi Time Frame and Instruments - https://ninjatrader.com/support/help...nstruments.htm

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

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by saeed, Today, 10:20 AM
            3 responses
            12 views
            0 likes
            Last Post koganam
            by koganam
             
            Started by priceisking, Yesterday, 07:44 PM
            1 response
            23 views
            0 likes
            Last Post NinjaTrader_Kate  
            Started by aligator, Today, 02:05 PM
            1 response
            5 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by rexsole, Today, 11:27 AM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by alfonso, Today, 10:21 AM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_Kate  
            Working...
            X