Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Profitable strategy in backtest getting always hitting stop loss before profit target

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

  • NinjaTrader_BrandonH
    replied
    Hello torch2k,

    Thank you for writing in.

    You should expect that a strategy running real-time (live brokerage account, live market simulation, Playback connection etc...) will produce different results than the performance results generated during a backtest.

    When using Historical data, Strategies can ONLY be processed at the close of each bar. The fill price of an order is based on the OHLC of a bar and the price of the order itself since that is the only information that is known during a backtest.

    When using real-time market data or Playback you have a choice to run a strategy tick by tick (Calculate set to 'On Each Tick') which could produce different results. The fill price is based on incoming market data and volume, and you may receive better or worse fill prices depending on where the bid or ask price is and what volume is available at this market prices. During real-time live brokerage trading, orders are filled according to market dynamics.

    This is why you may see orders NOT fill in real-time that you may otherwise expect to see filled based on your backtesting results.

    Here is a NinjaTrader Help Guide link with information about discrepancies between realtime and historical data — https://ninjatrader.com/support/help...ime_vs_bac.htm

    Please let us know if we may assist further.

    Leave a comment:


  • Profitable strategy in backtest getting always hitting stop loss before profit target

    I have a strategy in the works where is is looking for a small scalp while trading the ES market.

    When the right conditions are met, it simply looks for a profit of 5 ticks. Strategy Analyzer determined that the best results were yielded when the Stop Loss was set to 8 ticks.

    I've now tested the strategy settings on a playback connection, and it's giving me ~20% win rate rather than the ~80% win rate the back test showed. The problem is that the bar does fill the profit target, but most of the time a little later on into the bar.

    Can this be solved by switching the Strategy to an Calculate.OnPriceChange method instead of OnBarClose?

    My first idea was just to increase the stop loss. This fixed some of the bars, but then the the result of the strategy remains a loss because of the now larger stop loss.

Latest Posts

Collapse

Topics Statistics Last Post
Started by GussJ, 03-04-2020, 03:11 PM
16 responses
3,281 views
0 likes
Last Post Leafcutter  
Started by WHICKED, Today, 12:45 PM
2 responses
19 views
0 likes
Last Post WHICKED
by WHICKED
 
Started by Tim-c, Today, 02:10 PM
1 response
9 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by Taddypole, Today, 02:47 PM
0 responses
5 views
0 likes
Last Post Taddypole  
Started by chbruno, 04-24-2024, 04:10 PM
4 responses
53 views
0 likes
Last Post chbruno
by chbruno
 
Working...
X