Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EnterLongLimit() Problem in backtest

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

    EnterLongLimit() Problem in backtest

    EnterLongLimit(), EnterShortLimit() seem to have a problem in backtesting. The following code produce the trade entry in the attached chart image. Basically, EnterLongLimit() shows an entry at a price above the bar, but the bar never actually reaches that price. The result is that the backtest seems dubious at best or totally wrong at worst.

    The code is:

    EnterLongLimit(250, Close[0]+(20*TickSize), "");

    ...
    Attached Files
    Last edited by monpere; 02-28-2010, 12:36 PM.

    #2
    Hello,

    It looks like your limit price is 20 ticks above the current close, which would match the close of the pervious bar + .20.
    DenNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Ben View Post
      Hello,

      It looks like your limit price is 20 ticks above the current close, which would match the close of the pervious bar + .20.
      The chart shows that I get a fill on a price above the bar. How can I get a fill on a price, when the market never gets to that price? In real life, if I got a fill on that price, wouldn't the bar include that price? How could I get a fill at 134.83 on a bar whose high is 134.78 ? The way I see it, in a backtest simulation, if a limit buy entry is placed above the market, then the price recorded should be the high of the bar, not the the price above the market that the bar never actually reaches, as can clearly be seen on the chart.
      Last edited by monpere; 02-28-2010, 11:24 PM.

      Comment


        #4
        Hello Monpere,

        This is related to how NinjaTrader proccess fills. You're going to get a fill on your Buy limit order above the market. The price of this fill is then determined by what you set for Fill type.

        The two system fill algorithms are:


        Default

        An algorithm that takes a conservative and more realistic approach to filling limit and stop limit orders.
        • Limit orders only fill if the limit price was penetrated
        • Limit orders are always filled at the limit price specified never better (for example, if a limit order is submitted on bar n, NT will check if the order is filled on bar n+1, if this bar gaps down and the limit order was a buy, the order would be filled at the limit price and NOT the high of bar n+1)

        Liberal

        An algorithm that takes a liberal approach to filling limit and stop limit orders.
        • Limit orders fill if the limit price was touched
        • On gap down bars, buy limit orders will fill at the high of the gap down bar
        • On gap up bars, sell limit orders will fill at the low of the gap up bar
        http://www.ninjatrader-support.com/H...AStrategy.html
        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
        651 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        370 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        109 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        574 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        577 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X