Created
November 3, 2017 08:41
-
-
Save sthewissen/44d87a1b5651da6aa553ed2cec9189ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static List<double?> Sma(this List<double> source, int period = 30) | |
{ | |
int outBegIdx, outNbElement; | |
double[] smaValues = new double[source.Count]; | |
List<double?> outValues = new List<double?>(); | |
var sma = TA.Library.Core.Sma(0, source.Count - 1, source.ToArray(), period, out outBegIdx, out outNbElement, smaValues); | |
if (sma == TA.Library.Core.RetCode.Success) | |
{ | |
FixIndicatorOrdering(smaValues.ToList(), outBegIdx, outNbElement); | |
} | |
throw new Exception("Could not calculate SMA!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment