System placing trades before the time period set in backtester

I'm testing the code below on weekly data with a time period set to 1/1/2016 - 12/31/2025. It consistently makes trades before 2016 and the equity chart goes all the way back to 1995 (my max data from Norgate). I've tested a lot of systems in the last few months and never had this issue before.

I added the qualifier Status("barinrange") to the buy and sell signals in an attempt to fix it but the error persists.

Any advice you have on how to fix this issue would be much appreciated.

/*
Core Plus Satellites Trading System
Simple rotation using built-in AmiBroker ranking
...System holds one "core" index ETF and then allocates remaining capital
	to other sector or industry ETFs in a Watchlist based on simple trend following
	entry criteria and momentum.
WEEKLY DATA ONLY - Set Analysis Periodicity to WEEKLY
*/

SetTradeDelays(1, 1, 1, 1);
BuyPrice = Open;
SellPrice = Open;

// Include my custom functions
#include <KS_functions.afl>

// ========================================
// PARAMETERS
// ========================================
SetOption("MaxOpenPositions", 4);
SetOption("WorstRankHeld", 3);
SetPositionSize(15, spsPercentOfEquity);

WatchlistName = ParamStr("Watchlist Name", "_SecNav2");
CoreSymbol = ParamStr("Core Holding", "SPY");
MALength = Param("MA Length", 10, 5, 50, 1);
MomPeriod = Param("Momentum Period", 26, 10, 52, 1);

// Find watchlist
WatchlistNum = -1;
for(i = 0; i < 256; i++) 
{
    if(CategoryGetName(categoryWatchlist, i) == WatchlistName) 
    {
        WatchlistNum = i;
        break;
    }
}

InWL = InWatchList(WatchlistNum);
IsCore = Name() == CoreSymbol;

// ========================================
// WEEKLY INDICATORS
// ========================================
MA10 = MA(C, MALength);
Mom = ROC(C, MomPeriod);

// ========================================
// ENTRY/EXIT LOGIC
// ========================================
if(IsCore)
{
    // Core: Always hold
    Buy = Status("barinrange");
    Sell = 0;
    PositionScore = 1000000; // Highest priority
    SetPositionSize(55, spsPercentOfEquity);
}
else if(InWL AND NOT IsCore) 	
{
    // Satellites: Above MA, positive momentum
    Buy = C > MA10 AND Mom > 0 AND Status("barinrange");
    Sell = C < MA10;
    
    // Rank by momentum
    PositionScore = Mom;
}
else
{
    // Not in system
    Buy = Sell = 0;
    PositionScore = 0;
}


Just ran another system that I've had for months which never had any issues and it suffers the same problem which leads me to believe that there is something in settings that is causing the problem. I recently got a new computer and installed Amibroker on the new machine and then copied the Amibroker directory to the new machine according to the instructions I found. Wondering if that led to this problem. Still no idea how to fix it though.

!!!!!!!!!!!!
My apologies folks! Just figured it out --- in the Analysis window, to the right of the word RANGE is a dropdown with these options: All quotes, 1 recent bar, 1 recent day, From-To Dates. This was mistakenly set to "All quotes" which probably happened on the new software installation. Changing it to "From-To Dates" fixed the issue.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.