Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Delyaed response to trigger

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

    Delyaed response to trigger

    I'm experiencing some unexpected behavior in strategy--perhaps I've misunderstood the correct sequence for "On Bar Update" events.

    My trigger for entry first requires a series of filters to be positive after which a change in direction of the RSI will allow an entry. I've coded a print statement in the strategy which shows that all filters are positive (i.e. variable "DirShrt" = 1) for 3 bars in succession during a certain period on the chart. The print statement first shows the time and then the value for the variable "DirShrt".

    E.g. my print results shows like this:

    6/10/2009 9:59:17 AM DirShrt=1
    6/10/2009 10:00:05 AM DirShrt=1
    6/10/2009 10:00:57 AM DirShrt=1
    6/10/2009 10:01:13 AM DirShrt=0

    This is just as it should be. However during the second bar the RSI value reaches a maximum and thus the RSI for the 3rd bar is less than the RSI for the second bar. Since my strategy should enter the trade in this situation I expect an entry. Instead I don't have one. I added another print statement just ahead of the entry code something like this

    if (RSI[0] < RSI[1]) {print (Time + "RSI turned down");}

    This statement does not show up on the third bar even though the RSI value for the 3rd bar is less than that of the 2nd bar. Instead it shows up for the time which corresponds to the 4th bar. And this is why I'm not getting my entry. By the 4th bar the directional filters no longer allow a short entry. But the conditions for the short entry did exist at the third bar, as well as the decreasing RSI value.

    To check what's going on again I added the RSI value to my first print statement. This shows conclusively that the strategy sees a lower RSI value for the 3rd bar, but it still won't give an affirmative response to a logic statement with the condition "if (RSI[0] <RSI[1])". [SEE BELOW]

    What's going on????

    6/10/2009 10:00:57 AM, RSI=81.43, RSI[1]=81.41, DirLng=0, DirShrt=1
    6/10/2009 10:01:13 AM, RSI=68.19, RSI[1]=81.43, DirLng=0, DirShrt=0
    6/10/2009 10:01:13 AM, RSX Turned Down


    Thanks

    RSI77

    #2
    rsi77, I believe your issue is linked to the circumstance that in backtesting the trade will be placed on the next bar for execution, so if your conditions trigger on bar 3, the trade is placed on bar 4.

    To place an order before your directional filters switch you could try working with the concept of adding a finer datastream to execute on like in this sample - http://www.ninjatrader-support2.com/...ead.php?t=6652

    Comment


      #3
      Something else is going on here. I have another strategy which enters at the change in direction of RSI, but with different filters. That strategy enters at the opening tick of the bar following the fulfillment all conditions. This is what I expect. This strategy on the other hand did not enter at the open of the bar following the bar which had all conditions correct for entry. The only difference between these two strategies is that the filters in this strategy are much more likely to change quickly--and in this case they have gone negative on the next bar. But there was a bar where all conditions were correct for entry and I would have expected an entry at the open of the following bar. Do you understand what I'm saying?

      In my original message do you not agree that if my only conditions for entry is

      DirShrt =1
      && RSI[0] < RSI[1]

      I should have entered at the open of the the 1001:13 bar?

      rsi77

      Comment


        #4
        Thanks for clarifying rsi77 - I would suggest you add a draw command when all your trade entry condition including filters agree, this way it will be easy to debug when the entry should occur. Also which orders are you using? A limit order for entry could expire unfilled - you can check debug this with TraceOrders = true in the Initialize() - http://www.ninjatrader-support2.com/...ead.php?t=3627

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        633 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        364 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        567 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X