Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Question on running strategy on historical data

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

    Question on running strategy on historical data

    Hi - I created a strategy which plots arrows when the conditions are met (the strategy doesn't enter positions). The arrows are not being plotted on the historical data now that real-time trading is taking place. How can I get this to work?

    The process I follow is to launch a Chart window with my instrument; then Right click and apply my strategy. When I was doing this over the weekend when market was closed, the arrows were plotted correctly on the historical data. Now, when I do the same, the charts are real time because the market is open so the arrows don't show up on the historical data.

    I tried using the backtest feature however that didn't plot any arrows. Does backtesting feature plot graphics or does it only analyze if positions are taken?

    Thanks

    #2
    You need to use unique tag names for the draw objects.

    Code:
    "tag" + CurrentBar
    would be unique.
    Code:
    "tag"
    would not be unique.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Josh View Post
      You need to use unique tag names for the draw objects.

      Code:
      "tag" + CurrentBar
      would be unique.
      Code:
      "tag"
      would not be unique.
      Hi - thanks for your response; however I believe I'm already using a unique tag; here is my draw object call:
      DrawArrowUp(CurrentBar.ToString(),true,0,High[0] + TickSize, Color.Blue);

      Comment


        #4
        Then you will need to track down why it is not drawing the object through Print()s. You need to see what your code is doing.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Josh View Post
          Then you will need to track down why it is not drawing the object through Print()s. You need to see what your code is doing.
          Hi Josh - the issue is not with the code, but this is rather a question about how NT handles this scenario. I'll describe the exact scenario again.

          I open a chart from the File>New>Chart menu item (i.e. i do not use backtesting feature for this scenario). I set a time interval and a range of lets say 15 days back. The data is filled on the chart. I then right click on the chart, click the Strategies option, and execute my strategy on the chart..... What happens next is where my confusion is. I'm applying this to an FX instrument, and now that real-time trading happens the strategy is only executed to newly created bars. However, this weekend when I was connected to the Gain NJ Demo server (and fx trading was not taking place), then my strategy was executed for all historical bars and I was able to see the arrows at the expected locations on the historical data.

          It appears that when there is real-time data coming in, the strategy is "running" on live data and isn't being applied to historical data. This in fact makes sense. SO my question is, how can I configure NT to re-create my weekend scenario where the strategy was executed on the historical data when launched from a Chart window. I tried disconnection from the data feed and used the cached data, but then the Strategies option in the Chart window was disabled...

          I like using this method to do strategy development because I can quickly see changed to my strategy by hitting F5 in the Chart window. This is why I prefer this for strategy development than the backtesting method.

          I added Print statements as you suggested to print the date/time of the current bar, and this does correctly appear in the output window but only for newly created bars; not for historical bars.


          Thanks

          Comment


            #6
            Incorrect. NinjaTrader handles everything in the exact same fashion. It does not matter if there is real-time data coming in or not. Your strategy will process all historical data prior to then regardless. You need to use Print()s to find out what your strategy is doing. The only reason your strategy would not process historical bars is if the code tells it not to. At this point in time the only way to proceed is for you to provide full code so we can evaluate it. If you are afraid of proprietary trade ideas, just replace all trade conditions with some dummy condition like Close[0] > Open[0].
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Josh View Post
              Incorrect. NinjaTrader handles everything in the exact same fashion. It does not matter if there is real-time data coming in or not. Your strategy will process all historical data prior to then regardless. ...
              Hi Josh - thanks for your reply. I found that a combination of adding time frames and the Min bars required property for the strategy effect the historic execution. I am still trying to understand exactly how and may come back with more questions.

              Comment


                #8
                Min bars required property needs to be satisfied on all bar series before your strategy will begin.
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by agclub, 04-21-2024, 08:57 PM
                4 responses
                18 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by Irukandji, Today, 04:58 AM
                0 responses
                2 views
                0 likes
                Last Post Irukandji  
                Started by fitspressoburnfat, Today, 04:25 AM
                0 responses
                2 views
                0 likes
                Last Post fitspressoburnfat  
                Started by Skifree, Today, 03:41 AM
                1 response
                4 views
                0 likes
                Last Post Skifree
                by Skifree
                 
                Started by usazencort, Today, 01:16 AM
                0 responses
                1 view
                0 likes
                Last Post usazencort  
                Working...
                X