Multi Time Frame

Dear Experts,

I have a strategy running in 1 min chart, but my dbase is set with base time interval of 5secs.

My question is:-
Can I use TimeFrameSet (15) to change the chart to 15sec interval, do some calculation (including generating and array in 15sec) then restore the time frame to 1 min? Do I use Timeframeexpand to convert the array that was generated in the 15sec interval and use this is the 1 min interval?

Please help.

Thank you so much.

Most sincerely,
Roy

Hi,
Please refer to the above link to understand, how to use Timeframe functions. Also it's good to search in the forum before asking for help. Most of time, you can find you answers easily, when you search.

https://www.amibroker.com/guide/a_mistakes.html#TIMEFRAME

Hi,

Thank you for your reply.

I think I have to clarify a bit. I have a trading strategy running in 1 min chart and the dbase is set with base time interval of 5 seconds.

Then, I want to add an indicator to the strategy and the indicator has to work in 15 second interval. Can I use TimeFrameSet (15) within a 1 min chart? Most of the cases I read are about working with 1-minute data and compress to 2,3,4,5... N-minute data, ie from a lower time frame to a higher time frame.

But in my case I am asking if I can work with 1 minute data and compress to 15 sec data.

My understanding is: assuming in the 1 minute data case the dbase is set to 1 min time interval, so one cannot go from a higher time frame (say 1 min) to a lower one (say 15 sec) because there is no such data in the dbase. But in my case, the dbase was set with 5 sec time interval, so the required information was stored in the dbase. Am I correct on this?

If the above is correct, then, I should be using TimeFrameSet (15) to switch to 15sec interval to do the calculation and restore to 1 min with TimeFrameRestore. When I have to use the 15sec array, do I have to call TimeFrameCompress as I am compressing 1 min to 15 sec?

Please help.

Thank you very much.

Most sincerely,
Roy

No, you can't. 15 seconds is shorter than 60 seconds.

Check out here
https://www.amibroker.com/guide/afl/timeframeset.html

Please note that you can only compress data from shorter interval to longer interval. So when working with 1-minute data you can compress to 2, 3, 4, 5, 6, ....N-minute data. But when working with 15 minute data you can not get 1-minute data bars. In a similar way if you have only EOD data you can not access intraday time frames.

Add indicator to 15 second chart and compress all other to 1 minute if needed.

And to clarify , the database setting has nothing to do with it. If your at 5 second then leave that alone. Timeframe functions rely on the interval set for chart if ran on chart or setting in analysis settings if using analysis window to run AFL.

You can go up but not down.

Dear codejunkie,

Thank you v much for your reply.

Understood.

One last question, if we can only go from lower to higher timeframe, do we still need timeframecompress?

Thank you.

Most sincerely,
Roy

Dear Metamega,

Thank you v much for your reply.

Most sincerely,
Roy