Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Mysterious inflated profit/loss value during backtest does not match chart

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

  • st0rm
    replied
    Originally posted by QuantKey_Bruce View Post
    Glad to be of service.
    Very much appreciated, thank you. I'll return the favor to the community some day

    Leave a comment:


  • QuantKey_Bruce
    replied
    Glad to be of service.

    Leave a comment:


  • st0rm
    replied
    Originally posted by QuantKey_Bruce View Post
    st0rm Is that -63 column the number of TICKS of profit or oss rather than points?
    Oh my. Yes, those are TICKS! Ha! I had changed the display from Pts to Ticks without realizing it.

    Mystery solved. Thank you!

    Leave a comment:


  • QuantKey_Bruce
    replied
    st0rm Is that -63 column the number of TICKS of profit or loss rather than points?
    Last edited by QuantKey_Bruce; 05-13-2023, 04:54 PM.

    Leave a comment:


  • st0rm
    replied
    Originally posted by NinjaTrader_ChelseaB View Post
    Hello st0rm,

    Welcome to the NinjaTrader forums!

    If the strategy is using Calculate.OnBarClose, you can use High Order Fill Resolution increase the accuracy of fills.
    If the strategy is using Calculate.OnEachTick or .OnPriceChange 1-tick intra-bar granularity and TickReplay is necessary for accurate fills.

    Below is a link to a forum post that discusses both.
    https://ninjatrader.com/support/foru...377#post773377

    If you are interested in analyzing the data to understand what is causing a difference between real-time and backtest, see the post below.
    https://ninjatrader.com/support/foru...nce#post100192
    Thank you. I've been on quite a journey since this post but am still experiencing the same behavior. I've tried almost everything:

    - Enable tick replay, add a 1-tick series to my strategy, and place orders using the proper EnterLong(1,<qty>,<entry-name>) format.
    - Enable 'High' order fill resolution

    I've noticed the 'profit' column is showing 4x the true profit/loss in every case. (see screenshot below)

    I don't believe this is a problem with random fills, as the trades on the chart do not contain wild bars. Could there be any other cause? This is making my backtesting very difficult. Thanks.

    Click image for larger version

Name:	image.png
Views:	176
Size:	577.7 KB
ID:	1251315
    Attached Files
    Last edited by st0rm; 05-12-2023, 08:23 PM.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello st0rm,

    Welcome to the NinjaTrader forums!

    If the strategy is using Calculate.OnBarClose, you can use High Order Fill Resolution increase the accuracy of fills.
    If the strategy is using Calculate.OnEachTick or .OnPriceChange 1-tick intra-bar granularity and TickReplay is necessary for accurate fills.

    Below is a link to a forum post that discusses both.


    If you are interested in analyzing the data to understand what is causing difference between real-time and backtest, see the post below.
    Citizens of the NinjaTrader Community, A common question we hear from clients is 'why are results from backtest different from real-time or from market replay?'. Live orders are filled on an exchange with a trading partner on an agreed upon price based on market dynamics. Backtest orders are not using these market dynamics.

    Leave a comment:


  • Mysterious inflated profit/loss value during backtest does not match chart

    I'm noticing extreme profits and losses while backtesting which does not match the open/close prices shown on the chart for the simulated trade.

    The example below shows two /NQ contracts that experienced a combined -25pt loss. The same trade appears as a -100 point loss and inflates the statistics. The trade log records the appropriate open price (11351.50 and close price of 11339), resulting in a loss of -25 points. However, the 'Profit' column shows 100 points, MAE is 100 points.What in the world? Has anyone else experienced this?

    I'm using stock data, so there are no custom data errors. 5-minute calendar, standard order fill resolution. The strategy is using a 12.5pt stop loss which I'm setting in code (and which works great on the charts and in real life.

    Thanks for your help!


    ​​

Latest Posts

Collapse

Topics Statistics Last Post
Started by CarlTrading, 05-11-2026, 05:56 AM
0 responses
63 views
0 likes
Last Post CarlTrading  
Started by CarlTrading, 05-10-2026, 08:12 PM
0 responses
35 views
0 likes
Last Post CarlTrading  
Started by Hwop38, 05-04-2026, 07:02 PM
0 responses
198 views
0 likes
Last Post Hwop38
by Hwop38
 
Started by CaptainJack, 04-24-2026, 11:07 PM
0 responses
364 views
0 likes
Last Post CaptainJack  
Started by Mindset, 04-21-2026, 06:46 AM
0 responses
283 views
0 likes
Last Post Mindset
by Mindset
 
Working...
X