/*[[ Name := fnBackTestPeriod Author := Copyright © 2006, iExpertAdvisor, LLC Link := http://www.iExpertAdvisor.com ]]*/ Inputs: StartYear(0), StartMonth(0), StartDay(0), EndYear(0), EndMonth(0), EndDay(0); // Test 1. Has the start year arrived? if( ( Year < StartYear) ) then return(0); // Test 2. The start year has arrived, has the start month arrived? if( (Year >= StartYear) and (Month < StartMonth) ) then return(0); // Test 3. The start year and start month have arrived, has the start day (day of month) arrived? if( (Year >= StartYear) and (Month >= StartMonth) ) and (Day < StartDay) ) then return(0); // Test 4. Has the end year arrived? if( (Year > EndYear) ) then return(0); // Test 5. The end year has not arrived, but has the end month arrived? if( (Year <= EndYear) and (Month > EndMonth) ) then return(0); // Test 6. The end year and month have not arrived, has the end day arrived? if( (Year <= EndYear) and (Month <= EndMonth) and (Day > EndDay) ) then return(0); // All tests have passed // Return 1 to indicate the current date is within the testing period return(1); /* // This is how to call this UserFunction from within an expert var: InTestPeriod(0); InTestPeriod = UserFunction( "fnBackTestPeriod", 2005, 2, 25, 2005, 4, 28 ); if( InTestPeriod == 0 ) then { print("Not in test period: ", TimeToStr(CurTime)); exit; } else { print("Testing allowed: ", TimeToStr(CurTime) ); }; */