Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy not taking trades in Playback, with a twist

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

    Strategy not taking trades in Playback, with a twist

    So here is an odd one that I can't sort out. When running a strategy in playback, there are entry signals that are ignored according to the conditions. No issues with the account being out of sync, or with the strategy itself as it also shows historical trades.

    Scenario: The signal is triggered, no action is taken.

    The twist: If you disable then re-enable the strategy after the signal is triggered, it immediately submits the correct order (this strategy is set to immediately submit then synchronize).

    So, it seems like the trigger is solid, the strategy sees it and knows what to do and when, but when the bars are printing in real-time, nothing is happening.

    How can/should I troubleshoot this? I've yet to add prints to this one, as it's relatively straightforward and wasn't posing any issues in backtesting, but should that be my next stop?

    Thanks

    #2
    I would definitely put a bunch of print statements, just to make sure the strategy is doing what it's supposed to do, when it's supposed to do it. You could also turn on TraceOrders and check to make sure the quantity, limits and stops are where they are supposed to be as well. If you would like to put the logic in here, that would also help possibly figuring out if it's a logic problem, or maybe it's even a syntax problem. I've thrown a ; after if () and that messed up everything. Hopefully you can get this solved, otherwise just hop back on here and i'm sure someone can help you figure it out.

    Comment


      #3
      Originally posted by rockmanx00 View Post
      I would definitely put a bunch of print statements, just to make sure the strategy is doing what it's supposed to do, when it's supposed to do it. You could also turn on TraceOrders and check to make sure the quantity, limits and stops are where they are supposed to be as well. If you would like to put the logic in here, that would also help possibly figuring out if it's a logic problem, or maybe it's even a syntax problem. I've thrown a ; after if () and that messed up everything. Hopefully you can get this solved, otherwise just hop back on here and i'm sure someone can help you figure it out.

      This kept me up last night and I think I sorted it out. The strategy is limiting itself to one trade per "day", but I have this as a bool relating to the first bar of session parameter.

      Problem is (in this case) is that the bars are 57 minutes, and I started the strategy past the session open. Which, I assume, means that the bool was never set to true, and no trades were taken as the conditions never became true. Does this track with how NT8 should behave?

      I did some digging, and it sounds like a better way to do this is with the bars since enty execution command. Easy enough to determine how many bars I need it to wait, and then it isn't limited by having to "see" the session's first bar.

      I do have a question, just for some clarity, how does NT8 handle the BarsSinceEntryExecution(0,""0)=-1 command? I see this in other posts, but I'm not clear on what exactly this command is telling the strategy.

      I see this explanation:

      An int value that represents a number of bars. A value of -1 will be returned if a previous entry does not exist.

      Here: https://ninjatrader.com/support/help...yexecution.htm

      But I'm not sure exactly what it means when it says "a previous entry does not exist", is this within a certain time period? Or the same bar, or....? I think this is just a semantics problem, as I'm woefully ignorant when it comes to any sort of programming language and there is likely some understanding of word choice that makes this make sense to most.

      Any help would be great, thanks!

      Comment


        #4
        Hello sclay115,

        The note you are unclear on means exactly what it says, when a previous entry is not found -1 is returned. That is for the entire time the script has run, if no entry is found when you call that method -1 is returned.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        44 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        124 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        65 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X