/// <summary>
 /// Add a moving average line to the FinanceChart object.
 /// </summary>
 /// <param name="m">The FinanceChart object to add the line to.</param>
 /// <param name="avgType">The moving average type (SMA/EMA/TMA/WMA).</param>
 /// <param name="avgPeriod">The moving average period.</param>
 /// <param name="color">The color of the line.</param>
 /// <returns>The LineLayer object representing line layer created.</returns>
 protected LineLayer addMovingAvg(FinanceChart m, string avgType, int avgPeriod, int color)
 {
     if (avgPeriod > 1)
     {
         if (avgType == "SMA")
         {
             return(m.addSimpleMovingAvg(avgPeriod, color));
         }
         else if (avgType == "EMA")
         {
             return(m.addExpMovingAvg(avgPeriod, color));
         }
         else if (avgType == "TMA")
         {
             return(m.addTriMovingAvg(avgPeriod, color));
         }
         else if (avgType == "WMA")
         {
             return(m.addWeightedMovingAvg(avgPeriod, color));
         }
     }
     return(null);
 }