1 minute RSI on daily database

Hi,

At the closing of the day, if the 1 minute RSI of the whole day RSI(390) is low, I buy.
And I sell at the closing of the day, a few days later.
I like this kind of strategy, the problem is that running backtesting and optimization process can slow down my computer.

My formula is:

RSI_C= valuewhen(Hour()==15 AND Minute()==59, RSI(390), 1);
Buy=RSI_C<45;
Sell=RSI_C>55;

To allow faster backtest I use the function explore:

RSI_C=IIf(Hour()==15 AND Minute()==59, RSI(390), Null);
AddColumn(RSI_C,"RSI_C");

I rank the RSI_C values (if the value is null, it will go to the lower part of the sheet).
I export it to a .txt file.
I manually delete all the values on the lower part of the sheet.
I import the RSI_C values into my Norgate database, a new symbol “RSI_C” being my indicator.
And I read it using a daily database.
It runs much faster.

RSI_C =Foreign("RSI_C ","C");
Buy=RSI_C<45;
Sell=RSI_C>55;

However, the whole process is cumbersome…

Is there a way to be more efficient?

Best regards,

1 Like

How about using TimeFrame functions as described in the manual:
https://www.amibroker.com/guide/h_timeframe.html

Yes I could use Timeframecompress() and timeframeexpand(,,expandPoint) instead of "IIf(Hour()==15 AND Minute()==59, RSI(390), Null);". But it would change nothing to my problem.

Running the exact same optimization take half a second with the method I have described above and 30 seconds using 1 minute data and timeframecompress() + timeframeexpand() .

What I would want is to have access to the 1 minute RSI(390) at the End Of the Day.
The only value of the RSI(390) that matters for me is its value at the EOD.
And calculating it every minute in intraday slows down my computer.

And yes I "can only compress data from shorter interval to longer interval" :confused:

You obviously don't understand how computer programs work. You can't have RSI(390) from 1-minute data without feeding it with 1-minute data. The thing is that 390 bar RSI needs at least 390 1-minute bars to do the calculation for SINGLE OUTPUT value of RSI at the point that you are asking. In practice it needs more because RSI uses Wilders smoothing which is form of INFINITE impulse response filter (i.e. exponential-like smoother that uses ALL data).

To get better understanding of what is happening in your code and how functions work, use advice given here: How do I debug my formula?