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 argusthome, 03-08-2026, 10:06 AM
0 responses
72 views
0 likes
Last Post argusthome  
Started by NabilKhattabi, 03-06-2026, 11:18 AM
0 responses
43 views
0 likes
Last Post NabilKhattabi  
Started by Deep42, 03-06-2026, 12:28 AM
0 responses
25 views
0 likes
Last Post Deep42
by Deep42
 
Started by TheRealMorford, 03-05-2026, 06:15 PM
0 responses
28 views
0 likes
Last Post TheRealMorford  
Started by Mindset, 02-28-2026, 06:16 AM
0 responses
58 views
0 likes
Last Post Mindset
by Mindset
 
Working...
X