Want to use 1 min data in 15 min chart

i want to use value of 1 min timeframe rsi value in 15 min time frame

i.e buy =c > ma(c,20) and rsi of 1 min >50

You need to use the MultiTimeFrame functions (and be aware of using lowest granularity data as your baseline, so in your case 1 minute data)


1 Like

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.

i guess that will not work when we need lower time frame data

@Rakesh_Lala, you can not look from 15-minute to 1 minute. You can look to 15-minute from 1-minute, for example.

On the other hand if you only want to call LAST value of 1-minute RSI from 15-minute chart then use Static Variables. Open a second chart being set to 1-minute interval.

Code for 1-minute chart (ONE minute):

// for 1-minute (ONE-min) chart interval
if ( Interval() == 60 )
    StaticVarSet( "LastValue_RSI" + Interval() + "sec", LastValue(RSI()));
	Error( "Set chart interval to 1-minute!" );

Then in 15-minute interval:
Read comment in1st line (Not for backtesting!)


/// for 15-minute interval
rsi_1min = StaticVarGet( "LastValue_RSI60sec" );
Buy = C > MA(C,20) and rsi_1min > 50;
lastBUY = LastValue(Buy);

As said.. for backtesting you have to look from 1-minute to 15-minute using TimeFrame functions. See 2nd post of this thread.


If 1-minute data is base interval then it has higher or finer granularity than for instance Hourly or Daily interval(s) etc. because of having more detailed data information than those other ones.


can it be used for backtesting too ??

@Rakesh_Lala read carefully and follow the link on the Yellow/Orange section of the first document linked by @portfoliobuilder re "Periodicity Settings"


This setting controls bar interval used for backtesting/scan/exploration/optimization. To backtest intraday data you should switch to proper interval there and then run the backtest.

1 Like

Say you want to reference condition x on the 1hr TF from the 15min. Do you have to reference Ref(x,-1) or can you reference x? Thanks.

/// Applied on intervals equal or shorter than Hourly.
/// Hourly TF divided by shorter Interval has to be integer
/// @link https://forum.amibroker.com/t/want-to-use-1-min-data-in-15-min-chart/6837/7

period = 50; // MA periods 

tmfrm = inHourly;

TimeFrameSet( tmfrm );
	m = MA( Close, period ); // simple moving average

	BuyCond = Cross( Close, m );
	SellCond = Cross( m, Close );

expandmode = expandLast;
Buy = TimeFrameExpand( BuyCond, tmfrm, expandmode );
Sell = TimeFrameExpand( SellCond, tmfrm, expandmode );

// Entry/Exit next bar at open
BuyPrice = SellPrice = Open;

Buy = Ref(Buy, -1); 
Sell = Ref(Sell, -1);  

Short = Cover = 0;

// Plot ###################################################
Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );

Plot( C, "Price", colorDefault, styleCandle );
PlotShapes( Buy * shapeUpArrow + Sell * shapeDownArrow,
            IIf( Buy, colorGreen, colorRed ), layer = 0,
            y = IIf( Buy, L, H ), -12 );



// Entry/Exit this bar at close
BuyPrice = SellPrice = Close;

Buy = Ref(Buy, -0); 
Sell = Ref(Sell, -0); 


Follow the instructions at
We can only compress data from shorter interval to longer interval. It mean I can not use 1-tick data in 3-min chart. My idea that, I create two chart. One in 1-tick, the other in 3-min. In chart 1-tick I calculation may indicator and save it by StaticVarSet and after that in the 3-min.
The problem now is

How to solve this master?