Wrong base time interval, was: Rotational Trading - Periodicity Issue

Hi,

I was trying to backtest some rotational trading strategies however, when I want it to execute on EOD data it is processing on the 1-minute data despite setting periodicity in the settings window to "Daily".

It works fine on some other database that I have also containing 1-minute data. But just not on the one that I want. So I figured it might be something to do with the database settings as that was the only thing that changed and re-saved the seetings with base interval as "End-of-day" instead of 1-minute to see if that made any difference. But same result - it is running the code on 1-minute data.

image

Also tried using "TimeFrameSet()" and "TimeFrameRestore()" in the code to try and force the periodicity from AFL - but to no joy.

Please find the detailed log and backtester settings for quick reference. Please assist.

Hi @Tomasz... Could you please look into the issue since nobody else has volunteered any suggestions ?

Not that code should matter in this case but included it FYI...

SetBacktestMode( backtestRotational );


//System and Backtest Settings  
SetOption("worstrankheld",80);  
SetOption("Maxopenpositions",40);  
SetOption("allowpositionshrinking",True);

PositionSize= -2.5;   
PositionScore=  (100-RSI(14));
//PositionScore= Max( PositionScore, 0);

You really need to read ORANGE boxes in the manual
http://www.amibroker.com/guide/h_timeframe.html

The orange boxes only specify that periodicity is solely covered by the backtester settings window - which is already set in the screenshot enclosed earlier. I merely stated I ALSO tried using the timeframe code which you see from the above code snippet is not part of the core code.

Also, the same code and same settings on a different database works perfectly fine. So it cant be the code or the backtester settings that is the issue in my view.

Perhaps database settings or something particular about the database seems to be causing the odd behaviour. Please let me know what more info I can provide you with to help debug the issue.

Obviously then, you've got messed up database.

You don't even say what data source you are using. How can we guess what database you have? If you want help you need to provide ALL the details.

Obviously this is wrong. You can't simply change "base time interval" of the database. This has to be set ONCE when database is created and never changed again UNLESS you clear up all the existing data. Depending on data source you are using (again you did not tell that), it may mean using "Force backfill" on each and every symbol if it is data plugin driven.

I would create NEW database properly, with base time interval set to 1-minute from the start.

Base time interval setting MUST be representing THE TRUTH, i.e. ACTUAL periodicity of data. If you have 1-minute data but later change base time interval to EOD then you will create yourself this situation that you are experiencing now.

The database details were not provided as also for the amibroker version, windows version, directx version, etc because they don't necessarily seem relevant to the main issues (i.e) periodicty and rotational trading. And the program should work just fine irrespective of it being IB data or eSignal data, etc.

Anyways, It is a local database built from CSV files with REAL 1-minute data similar to another database on which it is working successfully. It is not that obvious that it is a database issue - because the same database works fine in regular backtesting mode with periodicity set to "Daily". Screenshot enclosed.

image

The easy answer is to create a new database with EOD data - but that wont help us in understanding why something is behaving the way it is. It is akin to saying that format your system and reinstall Windows everytime you hit an error you dont understand.

Afterall, your objective is the same as ours to develop a backtesting system where the results are rock solid and can be explained by logic. So the purpose of the post was just to try and understand why it is behaving one way in regular backtest and another way with rotational backtest.

AmIBroker users use myriad of different (often 3rd party unsupported) data sources developed all over the world and we DO NOT control that data.

It is up to YOU to keep YOUR database correctly configured. And it is pretty simple: as I wrote previously: Base time interval setting MUST be representing the truth, i.e. ACTUAL periodicity of data
Good data is ALL that is needed. And it just works regardless of what backtest you run (rotational or not).

This is the same way as with cooking. If you use good quality products on INPUT you can get tasty food on OUTPUT, but if you start cooking from garbage you will end up with garbage. And it is the case no matter how great cookware you have purchased.
AmiBroker is just like cookware. You need to feed it with quality input to have good dinner.