Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cannot add period to strategy

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

    Cannot add period to strategy

    I have a strategy coded that works on a certain timeframe. In order to back-test it properly, I would like to be able to run the strategy on 1 minute or tick bars, while still taking the trades as they would be taken on the higher timeframe. I have managed to do this with one of my systems, but the other system just won't work with it. When I had Add(PeriodType.Minute, 10), the system just does not work anymore at all. I added a code to write text to the chart on every bar, just to see if the strategy is even running, and they text does not come up. If I take away the Add(PeriodType.Minute, 10), things work again. Is it something in my code that I am missing?

    #2
    Did you check your log tab? Any errors? I would start there. I suspect something in OnBarUpdate() is throwing an exception as it fires for the secondary series.
    RayNinjaTrader Customer Service

    Comment


      #3
      Ah ty, I was using BarsSinceEntry() in the strategy which cannot be used in Multi timeframe strategies. Now the problem is that I get an entry, and the strategy says the the profit target was filled in that bar when it was not filled in that bar.

      For example, I get a short entry filled at 1271.00, and the profit target is 1269.5, and the low of the entry bar is 1270.25. The strategy shows on the chart the profit was given on that bar :/

      Comment


        #4
        Is the issue, that the backtest fill price is outside the bar's range? If so, the this is expected, Please read more here:


        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        60 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        147 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        161 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        97 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        284 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X