Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Range Bars Entry Order Issue

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

    Range Bars Entry Order Issue

    I have a strategy that trades on range bars, basically entering one or two ticks above the high. Now the issue comes when the order is entered with range bars as the close of one bar does not occur until the next bar opens one tick above/below the prior bar. So by the time the close[0] occurs for the strategy logic, the ask has to be one or two ticks above the close already. So, I added this check:

    Code:
    if(GetCurrentAsk() < customIndi.ExposedPrice)  // which is the similar to High[0]
    	{
            EnterLongStop(TradeSize, customIndi.ExposedPrice, "LEstop");
            }
    Then I found that it was missing some trades that I still would like to get into so I added:

    Code:
    if(GetCurrentAsk() < customIndi.ExposedPrice)
                {
                EnterLongStop(TradeSize, customIndi.ExposedPrice, "LEstop");
                }
    					
    else if(GetCurrentAsk() >= CustomIndi.ExposedPrice)
    	    {
                EnterLong(TradeSize, "LEmkt");
                }
    With this second snippet, I got a double fill yesterday that threw an error message, exited the trade and disabled the strategy.

    How to fix this when using range bars in particular but also to verify it as correct with all bar types. I am using CalculateOnBarClose = true; as well.

    Cheers!

    - CableTrader007

    #2
    Hi CableTrader007,

    I wouldn't think that this code by itself could cause an overfill. (Are you saying you have received an overfill? May I see the error message you have received?)

    You are using an else if, meaning that only one or the other will trigger. And there is nothing wrong with entering two entry orders on the same bar anyway.

    From the help guide:
    An overfill is categorized as when an order returns a "Filled" or "PartFilled" state after the order was already marked for cancellation. The cancel request could have been induced by an explicit CancelOrder() call, from more implicit cancellations like those that occur when another order sharing the same OCO ID is filled, or from things like order expirations.
    http://www.ninjatrader.com/support/h...reoverfill.htm

    This can happen when you try and call an entry on the same bar as an exit. This can happen if you use multiple exit orders for a single entry order. This can happen if you try and call CancelOrder() on an order that has already begun to fill.

    This can't happen if you are just submitting two entry orders.

    So I don't think this code is what is causing the issue. Do you have more code in your strategy?
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    647 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    368 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    571 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    573 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X