Change chart display as per TimeFrameMode(4) and TimeFrameSet(100R) programmatically

I have successfully used TimeFrameMode(4) and TiemFrameSet(100R) for generating the buy sell signal is the AFL code. On the chart, I am right now manually selecting the range bar to 100R from dropdown interval window, after customizing the ranges in the Intraday settings in the Preferences.
Is it possible to plot charts in rangebar for TimeFrameSet(100R) and display the chart directly by coding in the afl instead of manually selecting it?
please help.

Try searching the internet, but the topic was often discussed on the old forum. I don't recall seeing many afl's for range bars.

A starting place for you might be this article from TASC whose logic incorporates Renko Bars is coded into afl here,

http://www.amibroker.com/members/traders/07-2014.html

I'm no expert but do realize that depending on your definitions, there is a difference between Renko and Range bars.

Of course if you have some programming talent you can see almost anything is possible in AmiBroker with terrific examples here,

1 Like

hi
Automatically changes the range bars according to their name

there are 3 diferent ways in here. I recoment the switch() one

//xTimeFrameSet=Param("Rangebar interval:(YM=25.0,AB=1.5,NQ=3.75,ES=3.0)",1,0.25,1000,0.25);
//////// Automatically changes the range bars according to their name
// tiker=Name();   a13="EURUSD"; b13="GBPUSD";  a25="Dow_Jones"; a3="S&P_500"; a5="DAX_30";
// xTimeFrameSet= IIf(tiker==a13,13,IIf(tiker==b13,13,IIf(tiker==a25,25,IIf(tiker==a3,3,IIf(tiker==a5,5 ,1) ))));

switch( Name() )
{
case "Dow_Jones":
xTimeFrameSet= 25;
break;

case "S&P_500":
xTimeFrameSet= 3; //SP500 3*0.25 =0.75 points
break;

case "EURUSD":
xTimeFrameSet= 13;
break;

case "DAX_30":
xTimeFrameSet= 5;
break;

default:  // << @rvdesh you need the default aslo
xTimeFrameSet= 1;
GfxTextOut("ALERT: Ticker is not exist",20,40);
break;

}

TimeFrameMode( 4 ); 
TimeFrameSet( xTimeFrameSet ); // Pips bars.. PX SP500 3*0.25 =0.75 points
Plot(C,"c = ",colorBlack,styleCandle);
titlos="\nClose "+C + ", Open "+O +", High " +H +", Low "+L;
TimeFrameRestore(); 

Title=Date()+"  "+Name()+" @ Range Bars = "+xTimeFrameSet +" Pips"+titlos;
2 Likes

Thank you very much @PanoS

Thank you. I will study the afl at the link http://www.amibroker.com/members/traders/07-2014.html you have provided.