Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Incorrect fills on backtests

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

    Incorrect fills on backtests

    Sorry for posting every other day but here's the most recent issue I'm facing. A quick brainstorming of what I could be doing wrong would suffice for now.

    I'm on NT 7.14. I have a strategy that enters limit orders at a certain price. The trades get executed at the correct limit price, however, they get executed at the wrong time. So basically price never touches the limit level and the trades gets executed. I'm attaching an image of a 1-tick chart produced during my backtesting. As you may notice, the fills are happening way outside of the price at the time. I've checked for wrong ticks and this behavior is seen on almost every trade produced by this strategy.

    I'm pasting below the simple strategy that I'm using where I see this behavior. I assume this is another one of NT's order entry quirks. If you've ever seen something like this before or may know what the issue is, then please do let me know.


    Code:
            protected override void Initialize()
            {
                CalculateOnBarClose = false;
                
                Add(PeriodType.Tick, 1);
                Add(PeriodType.Minute, 5);
                TraceOrders = true;
            }
    
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
                if(Position.MarketPosition == MarketPosition.Long)
                {
                    if(BarsInProgress == 1)
                    {                
                        if(Close[0] >= (Position.AvgPrice + TickSize * 30))
                        {
                            ExitLong("longEntry");
                        }
                        else if(Close[0] <= (Position.AvgPrice - TickSize * 100))
                        {
                            ExitLong("longEntry");
                        }
                    }
                }            
                
                if(Position.MarketPosition == MarketPosition.Flat)
                {
                    if(BarsInProgress == 2)
                    {
                        if(Close[1] > Close[2])
                        {
                            EnterLongLimit(1, true, 100000, High[1], "longEntry");
                        }
                    }
                }            
            }
    Attached Files

Latest Posts

Collapse

Topics Statistics Last Post
Started by CaptainJack, 04-24-2026, 11:07 PM
0 responses
30 views
0 likes
Last Post CaptainJack  
Started by Mindset, 04-21-2026, 06:46 AM
0 responses
125 views
0 likes
Last Post Mindset
by Mindset
 
Started by M4ndoo, 04-20-2026, 05:21 PM
0 responses
181 views
0 likes
Last Post M4ndoo
by M4ndoo
 
Started by M4ndoo, 04-19-2026, 05:54 PM
0 responses
94 views
0 likes
Last Post M4ndoo
by M4ndoo
 
Started by cmoran13, 04-16-2026, 01:02 PM
0 responses
138 views
0 likes
Last Post cmoran13  
Working...
X