PDA

View Full Version : Backtest > Time frame


sdooley
03-14-2007, 04:11 AM
Hi,

Question on the "Time series" in backtesting. I'm trying to understand exactly how the Backtest Time Series works... I'm trading a currency pair and have hard-coded "only enter position of before 2:00PM" See code below...


// Condition set 1
if (EMA(5)[0] >= PriorDayOHLC().PriorHigh[0] + 6 * TickSize
&& ToTime(Time[0]) < ToTime(14, 0, 0))
{
EnterLong(DefaultQuantity, "LONG");
}

My question is under "Time frame > Session Ends/Begins" in the Backtest window why do my results change when I change the "Session Ends and Session Begins" parameters?

If I've hard-coded my entry times (in Ninja Strategy), shouldn't the results remain the same regardless of "Backtest time settings"?

On both the Ninja strategy I have "ExitOnClose = false;" as well as "Exit on close" in Backtest window set to "False"

Thanks,
Steve D.

NinjaTrader_Ray
03-14-2007, 04:36 AM
Hi,

The session begin/end time defined the data set that the strategy is being tested against. Changing these values change the data set (increase/decrease the number of bars) which can change the back test results.

Rau

sdooley
03-22-2007, 07:14 AM
Hi,

Apologies, I don't think I'm explaining my issue correctly. My NinjaScript says only ENTER or EXIT trades between 12:00AM and 1:00 PM (see code below).

&& ToTime(Time[0]) > ToTime(0, 0, 0)
&& ToTime(Time[0]) < ToTime(13, 0, 0)

If my strategy only ENTERS/EXITS strategies during those times, then I don't seewhy changing the Backtest "BEGIN/END Sessions" changes the results. (Assuming I have "Exit on close" set to "False".)

I understand that if Ididn't set my ENTRY/EXIT times in my strategy that yes,changingBacktest "BEGIN/END Sessions" will clearly alter my results.

For example, when I set Backtest "BEGIN/END Sessions" to 12:00AM-12:00AM, I get different results than when I set the Backtest "BEGIN/END Sessions" to 12:00AM-1:00PM. Since, my Ninja Strategy strictlyinstructs to only ENTER or EXIT positions from 12:00AM-1:00PM, seems like my backtest results should be consistent regardless of "BEGIN/END Sessions" settings?

Let me know if I'm still not clear.

Thanks,
Steve D.

NinjaTrader_Ray
03-22-2007, 07:52 AM
Changing the historical data set can affect your results. There are many variables such as how bars are built based if they are tick based intervals for example. A chart with defined sessions times on tick based intervals can look very different than one without a 24 hour session defined.

I suggest running a test on a small data set range (5 days for example), run each one in a separate market analyzer window, one with 24 hour range, one with a session defined, then compare the two results, trade for trade to see what the difference is.

Ray