Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trade Fills

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

    Trade Fills

    I have a strategy that enters and exits with limit orders, but always bids and offers 1 tick better to guarantee the fill. However, the trades are not always being filled on the back-test. For example, this is the code I am using for the exit order:

    exit_price = Open[0] - TickSize;
    exit_order_id = generate_tag(0) + "_exit";
    exit_order = ExitLongLimit(exit_price, entry_order_id);

    As you can see, this code should pretty much always get the fill since it is exiting at a one tick premium to the market. However, the trade sometimes does not execute on the chart for the back-test until about 3 bars after it should. Any reason for this or have I just made a coding error? I would use market orders but that significantly throws off the back-test results. If it makes any difference, all of the variables used above have been declared earlier in the strategy which is why i don't have it written as "string exit_order_id = " and so forth.

    #2
    Why do you think the order is filled three bars later than it should? I would print out the price of the ordernand the Time of the bar where the order is initially placed, then check the chart and determine how the order is filled based on the following fill type selected during backtest.

    The two system fill algorithms are:


    Default
    An algorithm that takes a conservative and more realistic approach to filling limit and stop limit orders.
    • <LI class=rvps1>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.
    • <LI class=rvps1>Limit orders fill if the limit price was touched <LI class=rvps1>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
    RayNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    559 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    546 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X