Multi time frame plot of rsi


Some of you will say - keep trying, been at it for over 2 months -my coding skills are poor !

This time am posting the formula - till it basically works - first a screen shot depicting on an hourly chart
of thr Nifty 50 - the standard RSI in hourly [ time frame of the chart], daily and weekly time frames:


the code is:


GraphLabelDecimals = 2;
GraphXSpace = 10;
R = RSI(14);
Plot(R," RSI(14),", colorBlue, styleLine | styleThick  );
PlotOHLC( R,R,50,R, "", IIf( r > 50, colorPink, colorPaleGreen ), styleCloud | styleNoLabel | styleClipMinMax, 30, 70,0,-2 ); 

plotDLY = ParamToggle("DAILY","OFF|ON",0);	
plotWKLY = ParamToggle("WEEKLY","OFF|ON",0);	

RsiDly = RSI(14);

RsiWKLY = RSI(14);

if(plotDLY )
Plot(TimeFrameExpand(RsiDly,inDaily),"\nRsi-Dly" ,colorCustom12,styleLine| styleThick ); 
Plot(TimeFrameExpand(Rsiwkly,inWeekly),"\nRsi-WKLY" ,colorCustom16,styleLine| styleThick ); 

PlotGrid(60,colorLightYellow); PlotGrid(40,colorLightYellow);
GfxSetZOrder( -2 );
GfxSetCoordsMode( 1 );

GfxSelectSolidBrush( colorPaleGreen); // fill color
GfxRectangle (BarCount-15, 60, BarCount+5, 40 );
GfxSelectPen( colorLightYellow,0 ); 
 GfxMoveTo(BarCount-15, 50);		GfxLineTo(BarCount+5,50 );

GfxSelectPen( colorRed, 1 ); 
 GfxMoveTo(BarCount-15, 70);		GfxLineTo(BarCount+5,70 );

 GfxSelectPen( colorGreen, 1 ); 
 GfxMoveTo(BarCount-15, 30);		GfxLineTo(BarCount+5,30 );


OK till now, now if I change the chart time frame to daily, the RSI on this, daily, time frame plots in BLUE color, since param "daily" is still on the daily RSI[from the afl alsi plots as a magenta line for the current day. screent shot below:


IS THERE ANY WAY TO AUTOMATICALLY TURN OF THE RSI, without having to go to "Parameters" to turn off the param selection for that time frame.


1 Like

@JEETU, as suggested by @TrendSurfer you should study/use the Interval() function to detect the current interval (bar duration) that you are using to display your chart.

The same issue may also apply to the weekly line in your formula, so you should draw the d/w RSI lines only when the current interval is less than the one used to calculate the corresponding line.

I will try this modification to your code (I changed the colors to see in on my settings):

if ( plotDLY AND (Interval() < inDaily) )
    Plot( TimeFrameExpand( RsiDly, inDaily ), "\nRsi-Dly" , colorRed, styleLine | styleThick );

if( plotWKLY AND (Interval() < inWeekly))
    Plot( TimeFrameExpand( Rsiwkly, inWeekly ), "\nRsi-WKLY" , colorGreen, styleLine | styleThick );

This does not disable/change the parameter option but only addresses the visual issue.

1 Like

@ beppe , thanks a lot, you know how poor my AFL coding is, like I mentioned , went thru the forum and re read the manual, pulled out my hair and then came to the forum.

On the first look at your post, beleive it will work.

Will try and get back to you by tomorrow.

Once again thanks a lot

1 Like

Once you have done what you need to do at your end - which you have done (study, make an effort, show your effort, etc) then don't hesitate to seek assistance sooner.

I was one who struggled to ask for help when I should have so now I don't have any hair left to pull out! :angry:


How many times should I say thanks , not enough.
In this case it is you but over the past nearly3 years this forum has stood tall.

Though I am always reminded to put in more work, I do try, have absolutely no claim OR the ability to think like some one who knows how to write code. Guess I am just not wired like that.

Once again, thanks a ton, to you and all the experts.
God bless.


This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.