Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

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

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

    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.


    #2
    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.
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by punkiy2111, Today, 05:22 PM
    0 responses
    2 views
    0 likes
    Last Post punkiy2111  
    Started by secrettrader, Today, 03:36 PM
    0 responses
    6 views
    0 likes
    Last Post secrettrader  
    Started by t3chn0, Today, 01:03 PM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_ChrisL  
    Started by jleira, Today, 02:27 PM
    0 responses
    22 views
    0 likes
    Last Post jleira
    by jleira
     
    Started by Kreyenhagen, Today, 01:54 PM
    2 responses
    21 views
    0 likes
    Last Post Kreyenhagen  
    Working...
    X