public double Value() { double v = 0; if (SMA.isPrimed()) { double sum = 0; for (int i = 0; i < periods; i++) { sum += Math.Pow(((double)History.GetItem(i)) - SMA.Value(), 2); } v = Math.Sqrt(sum / periods); } return(v); }
// returns true when indicator has seen enough values to compute a result // it will never return true if initialization parameters are incorrect // this will cause indicator to silently fail and not give results // on optimization runs where parameter combination is invalid. public bool isPrimed() { bool v = false; if (ATR.isPrimed() && SMA.isPrimed()) { v = true; } return(v); }
public bool isPrimed() { return(longSMA.isPrimed()); }
public string GetValues() { string Values; double BPlus, BSMA, BMinus, PctB, BW; double Deriv1, Deriv2; double MACDv, MACDs, MACDh; double STARCPlus, STARCSMA, STARCMinus; double STOv, STOs; double ATRv = ATR.Value(); BB.Value(out BPlus, out BSMA, out BMinus, out PctB, out BW); double CCIv = CCI.Value(); Derivatives.Value(out Deriv1, out Deriv2); double EMAv = EMA.Value(); double FMAv = FMA.Value(); double HMAv = HMA.Value(); MACD.Value(out MACDv, out MACDs, out MACDh); double MOMv = Momemtum.Value(); double RSIv = RSI.Value(); double RKOv = Renko.Value(); double SMAv = SMA.Value(); STARCBands.Value(out STARCPlus, out STARCSMA, out STARCMinus); double STDv = STDDEV.Value(); double SLPv = Slope.Value(); double SRSv = StochRSI.Value(); Stochastics.Value(out STOv, out STOs); double STv = Stub.Value(); double TRDv = Trend.Value(); double TRv = TrueRange.Value(); double WMAv = WMA.Value(); string ATRp = ATR.isPrimed().ToString(); string BBp = BB.isPrimed().ToString(); string CCIp = CCI.isPrimed().ToString(); string DERp = Derivatives.isPrimed().ToString(); string EMAp = EMA.isPrimed().ToString(); string FMAp = FMA.isPrimed().ToString(); string HMAp = HMA.isPrimed().ToString(); string MACp = MACD.isPrimed().ToString(); string MOMp = Momemtum.isPrimed().ToString(); string RSIp = RSI.isPrimed().ToString(); string RKOp = Renko.isPrimed().ToString(); string SMAp = SMA.isPrimed().ToString(); string STCp = STARCBands.isPrimed().ToString(); string STDp = STDDEV.isPrimed().ToString(); string SLPp = Slope.isPrimed().ToString(); string SRSp = StochRSI.isPrimed().ToString(); string STOp = Stochastics.isPrimed().ToString(); string STp = Stub.isPrimed().ToString(); string TRDp = Trend.isPrimed().ToString(); string TRp = TrueRange.isPrimed().ToString(); string WMAp = WMA.isPrimed().ToString(); Values = Candle.O + "," + Candle.H + "," + Candle.L + "," + Candle.C + "," + ATRp + "," + ATRv + "," + BBp + "," + BPlus + "," + BSMA + "," + BMinus + "," + PctB + "," + BW + "," + CCIp + "," + CCIv + "," + DERp + "," + Deriv1 + "," + Deriv2 + "," + EMAp + "," + EMAv + "," + FMAp + "," + FMAv + "," + HMAp + "," + HMAv + "," + MACp + "," + MACDv + "," + MACDs + "," + MACDh + "," + MOMp + "," + MOMv + "," + RSIp + "," + RSIv + "," + RKOp + "," + RKOv + "," + SMAp + "," + SMAv + "," + STCp + "," + STARCPlus + "," + STARCSMA + "," + STARCMinus + "," + STDp + "," + STDv + "," + SLPp + "," + SLPv + "," + SRSp + "," + SRSv + "," + STOp + "," + STOv + "," + STOs + "," + STp + "," + STv + "," + TRDp + "," + TRDv + "," + TRp + "," + TRv + "," + WMAp + "," + WMAv; return(Values); }