// Downloaded From https://www.WiseStockTrader.com
// By Mr. Abhimanyu Y. Altekar  abhimanyu.altekar@gmail.com
// 6th January 2025 V1.2
Hor=Param("Horizontal Position",55,05,1200,1);
Ver=Param("Vertical Position",90,5,1000,1);
IsxPlot2 = ParamToggle ("Plot Hourly & 5Min Averages Only", "No|Yes",1);
IsxPlot = ParamToggle ("Plot all Averages", "No|Yes",0);

function xSignalF(xTf,Hor,Ver,sxTf,isPlot)
{
TimeFrameSet(xTF);
ea5=EMA(C,5);
ea13=EMA(C,13);
ea21=EMA(C,21);
TRSI = RSI(14);
TimeFrameRestore();
	exTRSI= LastValue(SelectedValue( TimeFrameExpand( TRSI,xTF,expandLast )));
	RSIcolor =IIf(exTRSI > 70, colorBrightGreen,       // SuperBullish
			  IIf(exTRSI > 60 AND exTRSI <= 70, colorpaleGreen,     // Bullish
			  IIf(exTRSI > 50 AND exTRSI <= 60, colorTurquoise,      // Rising
			  IIf(exTRSI > 40 AND exTRSI <= 50, colorYellow,    // FLAT
			  IIf(exTRSI >= 30 AND exTRSI <= 40, colorLightOrange,   // Bearish
			  colorCustom12)))));


exa5=TimeFrameExpand( ea5, xTF,expandLast );
exa13=TimeFrameExpand( ea13, xTF,expandLast );
exa21=TimeFrameExpand( ea21, xTF,expandLast );
if(isPlot)
{
Plot(exa5,"\n"+sxTf,colorGreen,styleThick);
Plot(exa13,sxTf,colorBlue,styleThick);
Plot(exa21,sxTf,colorOrange,styleThick);
}
sOK=WriteIf(exa5>exa13 OR exa5<exa13,"Ok" ,"Flat" );
sGood=WriteIf(exa5>exa13 AND exa5>exa21,"Good " ,"Flat" );
sBad=WriteIf(exa5<exa13 AND exa5<exa21,"Bad " ,"Flat" );

if(sOK=="Ok" )

GfxSetCoordsMode( 0 ); // bar/price mode (instead of pixel) 
GfxSetZOrder(6);
GfxSelectSolidBrush(colorGold);
//PlotShapes(shapeCircle,colorGold,0,1,1,5);
if(sGood=="Good " )
GfxSelectSolidBrush(colorBrightGreen);
if(sBad=="Bad " )
GfxSelectSolidBrush(colorRed);

		GfxSelectFont("Times New Roman", 10, 400, True ); 
		GfxTextOut(sxTF,Hor+70, Ver-15);
		GfxRectangle( Hor+70,Ver+5,Hor+100,Ver+15 );

			GfxSelectFont("Times New Roman", 8, 300, True ); 
			GfxTextOut("R"+sxtf,Hor+68, Ver+50);
			GfxSelectSolidBrush(RSIColor);
			GfxRectangle( Hor+70,Ver+35,Hor+100,Ver+45 );

}
xSignalF(in5Minute,Hor,Ver,"5M",isxPlot);
xSignalF(in15Minute,Hor+40,Ver,"15M",isxPlot2);
xSignalF(in15Minute*2,Hor+85,Ver,"30M",isxPlot);
xSignalF(inHourly,Hor+125,Ver,"1H",isxPlot2);
xSignalF(inHourly*2,Hor+165,Ver,"2H",isxPlot);
xSignalF(inHourly*4,Hor+205,Ver,"4H",isxPlot);
xSignalF(inDaily,Hor+245,Ver,"Day",isxPlot);
xSignalF(inweekly,Hor+285,Ver,"WK",isxPlot);



SetChartOptions(0,chartShowDates|chartShowArrows|chartWrapTitle);
SetChartBkGradientFill( ParamColor("BgTop", colorLightGrey),ParamColor("BgBottom", colorTan),ParamColor("titleblock",colorLightGrey)); 
gxs=Param("GRAPH spaceing",5,5,50,5); 
GraphXSpace = gxs;
_SECTION_BEGIN( "Price" );	
GraphLabelDecimals = 2;
_N( Title = StrFormat( "{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle(),0,0,0,1 ); ;
_SECTION_END();