Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Profit target bug

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

    Profit target bug

    In back testing my brilliant, I am going to make a billion dollars strategy, I uncovered a bug in the profit target logic.

    I am enclosing a screen shot of some back testing entries. Look at the bar on 7/22. The buy signal happens at 5 minutes before the close of the day and is entered at 1078.25. (3) The profit target is 1090 and is hit the next day. (4) The bar on the 22nd, never reached 1090.

    On 7/19 however, the buy signal happens at 5 minutes before the close of the day at 1054.75. (1) The profit target is at 1060.75 which happened earlier that day, yet the back testing shows that it was hit and closed out. (2) Now the next day, that would have happened, but there is something in the logic of the profit target that is closing out the trade if the bar hits the target on the same bar. This happens on both long and short entries.
    Attached Files

    #2
    Hello ExactlyMyPoint,

    This is expected during a backtest. The exact sequence isn't known so it's possible to see fills that wouldn't realistically happen. See here for discrepancies expected during real time versus backtest.

    You can program granularity into your strategy, but would have to move away from set statements and use for example ExitLongLimit() or ExitShortLimit(). These methods allow you to specify submitting orders to a specific series. A sample on this is available here:


    You may also consider running your strategy live or in market replay, which does not have the same limitation as a backtest.
    Last edited by NinjaTrader_RyanM1; 12-21-2010, 05:57 PM.
    Ryan M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    639 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    366 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    107 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    569 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    572 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X