How show different timeframe charts with different parameter of same AFL

Hi everyone,

i am having problem , setting one same AFL with different parameter for different time frames..when watching all time frames at the same time
( daily with n=25, monthly n=20, quartly n=15, yearly n=3 )

*i.e. if i set n = 25 (parameter ) in daily chart & than when i shift to yearly, it remains n=3, *
which is not useful, i need n=3 for yearly.

i need it lock different n parameter for different time frames, to see it easily.

its a trend following afl, known as KPL swing indicator.

Thank you very much.

Screenshot 2020-06-03 20.13.42

Following is the AFL code. written by kamlaesh langote.

//Save indicator as "" in C: program files > Amibroker > Formulas > Custom folder and then drag and drop indicator on price window.
//Copyright Kamalesh Langote. Visit for latest code and updates
//You can use in indicator mode (chart) or scanner (generate buy/ sell signals).
//Risk management: do not risk more than 1% of your capital on any trade.
//Avoid trading in futures unless you are well capitalised.

no=Param( "Swing", 20, 1, 100,1 );


Plot(tsl, _DEFAULT_NAME(), colorblack, styleStaircase);
arrows=Cross(C,Ref(res,-1))*shapeUpArrow + Cross(Ref(sup,-1),C)*shapeDownArrow;

//Scanner mode


You have to create New Blank Chart but not New Default Chart. Default chart will have same ChartID for all chart tabs and so if you change Param* it will be changed for all charts to same value. If you create Blank Chart then Param will remain fix per chart tab once it is set and not being modified per chart.


If you look for fix values per interval then use Interval() function.

switch ( Interval(2) ) {
	case "Monthly":
		no = 20;	break;		
	case "Quarterly":
		no = 15;	break;		
	case "Yearly":
		no = 3;	break;		
	case "Daily":     
		no = 25;	break;

printf( "no: %g", no);


Besides you should read here first (before creating post). Please apply code tags button for inserting code to a post.


thanx fxshrat for replying the solutions,
and that too with screenshot...

regarding, the code you provided,
should i insert that in existing AFL ?
sorry for asking such things, as i am no coder .

again. thanx.

worked like a dream.

thanx for solution.

1 Like

Great but if you want to mark something as solution then you rather should mark the post that actually solved your issue but not a post asking question(s).