Hello all,
Can any one please help me to get the correct code for the following. I'm trying to get Daily RSI 40-60 level cloud color change based on the MTF RSI levels. For example if monthly and weekly RSI is above 60 level, then when the Daily RSI gets above 60 level cloud color should be changed to accordingly. If the color change happens we will get to know that all time frames are in sync with RSI above 60 levels. Like that RSI drops below 40 level.
I have tried to write the code, but I'm unable to understand that how to write using iif or if or dynamic color options.
Thank you very much for spending your precious time.
Here is the code :
//Daily RSI 40-60 level cloud color change based on MTF RSI 40-60 level//
TimeFrameSet( inMonthly );
MonthlyRSI = RSI(14);
TimeFrameRestore();
Monthly_RSI = TimeFrameExpand( MonthlyRSI, inMonthly, expandLast );
TimeFrameSet( inWeekly );
WeeklyRSI = RSI(14);
TimeFrameRestore();
Weekly_RSI = TimeFrameExpand( WeeklyRSI, inWeekly, expandLast );
MRSI60 = IIf(Monthly_RSI>60,1,0);
MRSI40 = IIf(Monthly_RSI<40,1,0);
WRSI60 = IIf(Weekly_RSI>60,1,0);
WRSI40 = IIf(Weekly_RSI<40,1,0);
r = RSI(14);
Plot( r, "", colorGreen, styleLine | styleClipMinMax | styleNoLabel, 40, 0 );
Plot( r, "", colorRed, styleLine | styleClipMinMax | styleNoLabel, 100, 60 );
IIf( r > 40 AND r < 60, Plot( r, _DEFAULT_NAME(), colorLightOrange, styleLine | styleClipMinMax ), Null );
PlotOHLC( r,r,50,r, "", IIf( r > 50 AND WRSI60=1, colorRed, colorGreen ), styleCloud | styleClipMinMax | styleNoLabel, 40, 60 );
Plot(60, "", colorblack, styleLine);
Plot(40, "", colorblack, styleLine);
Plot(50, "", colorblack, styleLine);