How to include timeframe as parameter input

Hi,
Is that possible to include TF as a parameter to my ea? It enter when rsi = x and price is out of keltner, leave when rsi = y.

What make me think it can’t is that :

datetime lastCandle = 0;

If I use a tf different from the “analyzed” it will try to use a candle as datetime and may no function…

Like this:

input ENUM_TIMEFRAMES RSI_TF = PERIOD_CURRENT; // TimeFrame for RSI

I’ve changed everything that makes reference to CurrentTime, and when i change the tf on tester (not in paramater), it change the performance.
Does this datatime “ruins” my idea?

when passed as some function parameters, current time frame , can be NULL, 0, PERIOD_CURRENT