// Downloaded From https://www.WiseStockTrader.com
//-- Author: KelvinHand
//TP - Typical Price (H+L+C)/2
//MP - Median Price  (H+L)/2 
//WP - Weight Price  (H+L+C+C)/4 


MAType    = ParamList("Type", "SMA,EMA,WMA,TSF,DEMA,TEMA,LinearReg,Wilders");
Periods   = Param("Periods", 20, 1, 500 );
iPrice    = ParamList("Price", "C,O,H,L,MP,TP,WP");

Shift     = Param("Shift", 0, -50, 50 );

cColor    = ParamColor("Color", ColorCycle);
iStyle    = ParamStyle("Style", styleLine, maskAll);


switch (iPrice)
{
   case "O"   : p = Open;        break;
   case "H"   : p = High;        break;
   case "L"   : p = Low;         break;
   case "MP"  : p = (H+L)/2;     break;
   case "TP"  : p = (H+L+C)/3;   break;
   case "WP"  : p = (H+L+C+C)/4; break;
   default:     p = Close;       break;
}


switch (MAType)
{
   case "EMA":     iMA = EMA( P, Periods );  break;
   case "WMA":     iMA = WMA( P, Periods );  break;
   case "DEMA":    iMA = DEMA( P, Periods ); break;
   case "TEMA":    iMA = TEMA( P, Periods ); break;
   case "Wilders": iMA = Wilders( P, Periods ); break;
   case "TSF":     iMA = TSF( P, Periods ); break;
   case "LinearReg": iMA = LinearReg( P, Periods ); break;


   default:   iMA = MA( P, Periods );	 break;
}

ShortName = MAType+Periods+iPrice;
if (Shift !=0)
   ShortName = ShortName + "x"+Shift; 

Plot( iMA, ShortName, cColor, iStyle, 0, 0, Shift);