Syntax for drawing object in one time frame only

I have an AFL program which I use to draw chart on two time frames say 3 mins and 15 mins.
I want to draw a Horizontal line and a Moving Average only if the time frame is 3mins. Is should not draw these two things in 15 mins time frame chart. How do I achieve it.

Plot(lastvalue(c),"",coloryellow);
Plot(em(C,14),"",colorPink);

Just enclose the AFL code that is specific to a particular time interval in the code blocks like this:

if( Interval() == 3*in1Minute ) {

	// specific code for 3min

}
else if ( Interval() == in15Minute ) {
	
	// specific code for 15min

}
// and so on
// Make sure common variables are defined outside these blocks
2 Likes

It worked as suggested. Thank yo so much.