// Downloaded From https://www.WiseStockTrader.com
//===========================================================Rafi-MFI+RSI+Candle========================================================\\ 
//======================================================================================================================================\\ 
//======================================================================================================================================\\ 

  
_SECTION_BEGIN("Line Detail");//==================================================================================================  
Bought = Param( "OverBought Above", 70, 1, 100, 1 );
Boughtcolor = ParamColor( "Bought Color", colorGreen );
Boughtstyle = ParamStyle("Bought Style", styleThick|8|styleNoLabel );
Sold = Param( "OverSold Bellow", 30, 1, 100, 1 );
Soldcolor = ParamColor( "Sold Color", colorRed );
Soldstyle = ParamStyle("Sold Style", styleThick|8|styleNoLabel );
_SECTION_END();//======================================================================================================================== 

_SECTION_BEGIN("RSI in Heikin Detail");//================================================================================================  
periods = Param( "Periods", 15, 1, 200, 1 );
Haikincolor = ParamColor( "Haikin Color", colorRed );
HaClose = (RSIa(Open, periods)+RSIa(High, periods)+RSIa(Low,periods)+RSIa(Close,periods))/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( RSIa(High, periods), Max( HaClose, HaOpen ) );
HaLow = Min( RSIa(Low,periods), Min( HaClose, HaOpen ) );
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose,"",Haikincolor,styleCandle);
_SECTION_END();//======================================================================================================================== 

_SECTION_BEGIN("MFI Detail");//==========================================================================================================   
SetChartOptions(0,0,chartGrid30|chartGrid70);
periods = Param( "Periods", 15, 1, 50, 1 );
MFIstyle = ParamStyle("Style", styleThick );
MFIcolor = IIf( MFI(periods) > Ref(MFI(periods),-1), ParamColor("Up Color", colorDarkGrey ), ParamColor("Down Color", colorDarkGrey ));
Plot( MFI( periods), _DEFAULT_NAME(), MFIcolor, MFIstyle );

Fillswitch = ParamToggle("Fill Color","On,Off",1);
r = MFI(periods);
FillColor = IIf( r > 50, ParamColor("Up Fill Color", colorRed),ParamColor("Down Fill Color", colorGreen));
if (NOT Fillswitch) PlotOHLC( r,r,50,r, "", FillColor, styleNoLabel | styleCloud | styleClipMinMax, Sold, Bought );

UPcolor = ParamColor( "UP Color", colorBlack );
DOWNcolor = ParamColor( "Down Color", colorBlack);
Buy=Cross( MFI( periods), Sold ); 
Sell=Cross( Bought, MFI( periods) );
PlotShapes( IIf( Buy, shapeUpArrow, shapeNone ), UPcolor, layer = 0, yposition = R, offset = -20  ); 
PlotShapes( IIf( Sell, shapeDownArrow, shapeNone ), DOWNcolor, layer = 0, yposition = R, offset = -20  ); 
_SECTION_END();//======================================================================================================================== 

_SECTION_BEGIN("RSI Detail");//==========================================================================================================  
SetChartOptions(0,0,chartGrid30|chartGrid70);
periods = Param( "Periods", 15, 1, 50, 1 );
RSIstyle = ParamStyle("Style", styleThick );
RSIcolor = IIf( RSI(periods) > Ref(RSI(periods),-1), ParamColor("Up Color", colorYellow ), ParamColor("Down Color", colorYellow ));
Plot( RSI( periods), _DEFAULT_NAME(), RSIcolor, RSIstyle );

Fillswitch = ParamToggle("Fill Color","On,Off",0);
r = RSI(periods);
FillColor = IIf( r > 50, ParamColor("Up Fill Color", colorRed),ParamColor("Down Fill Color", colorGreen));
if (NOT Fillswitch) PlotOHLC( r,r,50,r, "", FillColor, styleNoLabel | styleCloud | styleClipMinMax, Sold, Bought );

UPcolor = ParamColor( "UP Color", colorYellow );
DOWNcolor = ParamColor( "Down Color", colorYellow );
Buy=Cross( RSI( periods), Sold );
Sell=Cross( Bought, RSI( periods) );
PlotShapes( IIf( Buy, shapeUpArrow, shapeNone ), UPcolor, layer = 0, yposition = R, offset = -20  ); 
PlotShapes( IIf( Sell, shapeDownArrow, shapeNone ), DOWNcolor, layer = 0, yposition = R, offset = -20  ); 
_SECTION_END();//========================================================================================================================

_SECTION_BEGIN("Lines");//===============================================================================================================  
Plot(Bought,"",boughtcolor,Boughtstyle);  
Plot(50,"",colorDarkGrey,styleDashed|styleNoLabel);
Plot(Sold,"",Soldcolor,soldstyle);
_SECTION_END();//=======================================================================================================================\\
//======================================================================================================================================\\
//=============================================================End of Code==============================================================\\