Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy taking different trades in live vs backtest/historical

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

    Strategy taking different trades in live vs backtest/historical

    I'm testing out a very simple strategy to get the idea of how orders are submitted. My strategy uses/calculates OnBarClose and has a couple simple conditions. Very simple stuff such as if bar closes below a moving average, then place order. When I run a backtest, the orders looks OK. Same whenever I add it to a chart and look at the historical trades, everything looks fine. However, during live (sim) trading, the trades it placed do not fit any of the conditions. For example, the bar didn't close below the moving average but it still placed an order. In addition, as I understand it, if a market order were placed with OnBarClose, then it would likely fill at the open of the next bar. The historical data shows this but again on the live trades it took, the prices it entered on aren't near the open. The logs show that the order was initiated from the strategy. I understand that there would be discrepancies between historical and live but the fact that the trades were placed when it was simple conditionals that should have prevented it leaves me lost. Any thoughts would be appreciated. Thanks.

    #2
    Hello veetotheone,

    Are you printing the values to the output window so that we can confirm?

    If so, please save the output to a text file (right-click -> Save as) and attach this with your next post.

    If not, use prints and TraceOrders to understand behavior.

    Below is a link to a forum post that demonstrates using Print() to understand behavior and includes videos.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, 03-13-2026, 05:17 AM
    0 responses
    86 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    151 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    79 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    53 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    61 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X