Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indexes in Strategy Analyzer

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

    Indexes in Strategy Analyzer

    Hi,

    I know that it is possible to chart indexes within Ninjatrader, as I have an S&P 500 chart (code SP500) which has no problems from Yahoo.

    My question is, is it possible to run the strategy Analyzer against an index, as I can find no where to import the index.?

    Any help on this matter would be much appreciated.

    TIA,

    Graham.

    #2
    To backtest against an index you should try an actually tradeable instrument like the SPY for the SP500.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      josh,

      Thanks for the reply. I can access SPY when drawing a normal chart.

      Now for the stupid question, how do I add SPY into the left hand items of the strategy analyzer window?

      Graham

      Comment


        #4
        You will need to add it to your Instrument List. Please see: http://www.ninjatrader-support.com/H...eFromList.html
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Hi Josh,

          Thanks for the reply below.

          I have managed to add the SP500 index to the Instrument manager as per your previous link, but when I run the strategy analyzer I get no results, but when I run it under debug mode I do hit both long and short trades.

          I use the coding as follows:

          private IOrder entryOrder = null;

          entryOrder = ExitShort();

          when I have investigated further I find that the 'entryOrder' has a null value, which seems to say that I have done something wrong, but when running the same strategy against the NASDAQ 100 I get results out.

          Any ideas where I need to look to find out why no physical trades are produced?

          TIA,

          Graham.

          Comment


            #6
            Graham, not sure why you assing an Exit order to the entryOrder IOrder object...is this all the code you use?

            To check for the instrument setup (SPY) please run with the default SampleMACrossOver and see if this returns trades as expected.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Betrand,

              Thanks for the reply, the code was only a sample to show using an IOrder object to capture the result of a EnterShort(), ExitShort() function.

              I have run the default SampleMACrossOver against ^SPY and it returns the same results of no trades for the daily period 01/01/2000 to current date. So it seems that I have not got something setup correctly, although the chart shows correctly after the strategy has run, with the MACD crossing over a number of times.

              Can you think of anything else that I can check.

              TIA,

              Graham.

              [IMG]file:///C:/DOCUME%7E1/graham/LOCALS%7E1/Temp/moz-screenshot.png[/IMG][IMG]file:///C:/DOCUME%7E1/graham/LOCALS%7E1/Temp/moz-screenshot-4.png[/IMG]
              [IMG]file:///C:/DOCUME%7E1/graham/LOCALS%7E1/Temp/moz-screenshot-2.png[/IMG][IMG]file:///C:/DOCUME%7E1/graham/LOCALS%7E1/Temp/moz-screenshot-3.png[/IMG]

              Comment


                #8
                Graham,

                SPY should not be denoted as an index. Please remove the ^ notation.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Josh,

                  Sorry about this, but I went back to first principles and created a new instrument list in the instrument manager, then selected index as the type and added the Dow Jones, which was automatically entered as ^DJIA.

                  When I try and run one of the predefined strategies (SimpleMACrossover) against this index I get no results, but the chart shows clearly with the MA's crossing over, so one would expect a trade to be produced in a 19 year period (I ran it from 01/01/1990 to current date).

                  Is there something up with running the strategy analyzer against indexes, or more probably, have I missed something?

                  Any help that you could give would be much appreciated, as I am getting to the hair pulling out point.

                  TIA.

                  Graham.

                  Comment


                    #10
                    Graham, there is indeed an issue with running the Strategy Analyzer against indicies. The expected behavior is for zero trades to occur because in NT, the indicies don't actually have any information available for trades, like how much $/point, for example.

                    If you think about it, how exactly would you buy or sell the Dow Jones index? There isn't actually a way to directly trade this index. You'd have to pick an instrument that tracks the DJIA, like the YM futures contract, the DIA ETF, or options even. It just isn't possible to directly buy or sell an index (at least not usually).

                    The same logic holds for other indicies:
                    S&P 500 - future (ES), stock/ETF (SPY), or options
                    Russell 2000 - future (TF), stock/ETF (IWM), and of course, options

                    In most cases, the best choice for backtesting an index is to just backtest the strategy against the corresponding ETF (DIA, QQQQ, IWM, SPY, etc) because these ETFs track the index better than futures (there are issues with fair value and such).
                    AustinNinjaTrader Customer Service

                    Comment


                      #11
                      I'd like to be able to backtest on indexes aswell. Not because i want to trade directly in the index but because i want certain criterias to be met in the index before i trade a share from that index (ex.: i would want the SMA(50) to be above the SMA(200) in the index before considering going long in a share in the index. Ofcourse other criterias would have to be met on that specific share too).
                      So when i construct a new strategy i'd like to be able to make it one the conditions that the index-criterias are met.
                      Could you please consider to make that option in future upgrades?

                      Comment


                        #12
                        Hello,

                        I believe this is possible. You can make criteria based on indices but you can't trade an indice.
                        DenNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by judysamnt7, 03-13-2023, 09:11 AM
                        4 responses
                        57 views
                        0 likes
                        Last Post DynamicTest  
                        Started by ScottWalsh, Today, 06:52 PM
                        4 responses
                        36 views
                        0 likes
                        Last Post ScottWalsh  
                        Started by olisav57, Today, 07:39 PM
                        0 responses
                        7 views
                        0 likes
                        Last Post olisav57  
                        Started by trilliantrader, Today, 03:01 PM
                        2 responses
                        20 views
                        0 likes
                        Last Post helpwanted  
                        Started by cre8able, Today, 07:24 PM
                        0 responses
                        9 views
                        0 likes
                        Last Post cre8able  
                        Working...
                        X