// Downloaded From https://www.WiseStockTrader.com
_SECTION_BEGIN("Indicator - SMA Two Market"); 
symbol = ParamStr("Ticker to compare", GetBaseIndex() );
fc = Foreign( symbol, "C" );
FPeriods = Param("Foreign Periods", 20, 2, 300, 1, 10 );
TurnOnSMA=ParamToggle("Turn On SMA","On|Off",1);
P = ParamField("Price field",-1);
Periods = Param("Periods", 20, 2, 300, 1, 10 );
X0 = Param ("X - Left Up Corner",   0,   0,  1200, 10);
Y0 = Param ("Y - Right Up Corner",   580,  40, 1200, 10); 

SMA=MA( P, Periods );
H1 = TimeFrameGetPrice("H", inDaily, -1);       // yesterdays high
L1 = TimeFrameGetPrice("L", inDaily, -1);   
GfxSetTextColor(colorWhite);
procedure DrawBut3 (Text, x1, y1, x2, y2, colorFrom, colorTo)
{
	GfxSetOverlayMode(0);
	GfxSelectFont("Verdana", 7, 400);
	GfxSetBkMode(1);
	GfxGradientRect(x1, y1, x2, y2, colorFrom, colorTo);
	GfxDrawText(Text, x1, y1, x2, y2, 32|1|4|16);
	
} 

//Plot SMA 
if(TurnOnSMA==0){
Plot( SMA, _DEFAULT_NAME(), IIf(fc>MA(fc,FPeriods) AND C>SMA ,colorGreen,colorRed), ParamStyle("Style") ); 


}



_SECTION_END();