I can’t get a strategy using monthly bars to test farther back than 17 months. Wondering if any of you can spot something in my code preventing this.
I have a strategy where I try to confirm multiple timeframes are synchronized (all having a higher close than open for their respective time periods). The timeframes are daily, weekly, monthly.
I’m using TimeFrameSet and TimeFrameRestore to create the various period’s Open, High, Low, Close data points. The core of the strategy confirms the daily close is higher than the daily open; the weekly close is higher than the weekly open; and the monthly close is higher than the monthly open.
It seems to be working but will only execute trades going back about 17 months (from August 2021).
I thought maybe it could be I’m not loading enough bars, but my Database Settings show I’m loading 10,000 days, and I have no problem running any of my other strategies back 20 years to present.
My inference was TimeFrameExpand() was just for displaying the bars correctly on a chart in a non-native timeframe, but are you saying that using TimeFrameExpand() it's required just to complete a screen backtest or exploration?
No, you should always expand. It is no where written to expand for charts only.
If you do not expand then you are working with compressed data.
Simply follow the manual.
Orange box from upper link:
IMPORTANT: TimeFrameExpand IS REQUIRED for any formula that uses TimeFrame* functions. If you don't expand time compressed data you will have incorrect timestamps (see description below in "How it works").