public override void HandleNextTick(Tick t) { double emaVal = EMA.HandleNextTick(t); LRValues.Enqueue(emaVal); double[] Y = LRValues.ToArray(); double stdErr = 0; if (Y.Count() == X.Length) { Vector x_data = new Vector(X); Vector y_data = new Vector(LRValues.ToArray()); var poly = new PolynomialRegression(x_data, y_data, 2); for (int i = 0; i < Period; i++) { double x = (i); double y = poly.Fit(x); stdErr += Math.Pow(LRValues.ToArray()[i] - y, 2); } stdErr = Math.Sqrt(stdErr); } HighData.Enqueue(EMA[0] + STDEV * stdErr); MiddleData.Enqueue(EMA[0]); LowData.Enqueue(EMA[0] - STDEV * stdErr); }
public override double HandleNextTick(Tick t) { double DMP = 0; double DMN = 0; if (prevTick != null) { double upMove = t.BidHigh - prevTick.BidHigh; double downMove = prevTick.BidLow - t.BidLow; if (upMove > downMove && upMove > 0) { DMP = upMove; } if (downMove > upMove && downMove > 0) { DMN = downMove; } } double atr = ATR.HandleNextTick(t); double DIP = 100 * EMA_DMP.HandleNextTick(DMP) / atr; double DIM = 100 * EMA_DMN.HandleNextTick(DMN) / atr; ((GenericContainer)subIndicators["DIP"]).HandleNextTick(DIP); ((GenericContainer)subIndicators["DIM"]).HandleNextTick(DIM); prevTick = t; indicatorData.Enqueue(double.NaN); return(double.NaN); }
public override double HandleNextTick(Tick t) { double ema1 = EMA1.HandleNextTick(t); double ema2 = EMA2.HandleNextTick(ema1); double ema3 = EMA3.HandleNextTick(ema2); double value = 100 * (ema3 - EMA3[1]) / ema3; indicatorData.Enqueue(value); return(value); }
public override double HandleNextTick(Tick t) { double mfm = MoneyFlowMultiplier.HandleNextTick(t); double mfv = mfm * t.Volume; ADL += mfv; double a1 = ADL1.HandleNextTick(ADL); double a2 = ADL2.HandleNextTick(ADL); indicatorData.Enqueue(a1 - a2); return(a1 - a2); }
public override double HandleNextTick(Tick t) { double value = Double.NaN; if (prevTick != null) { value = EMA.HandleNextTick(t.Volume * (t.BidClose - prevTick.BidClose)); } prevTick = t; indicatorData.Enqueue(value); return(value); }
public override void HandleNextTick(Tick t) { double emaVal = EMA.HandleNextTick(t); LRValues.Enqueue(emaVal); double[] Y = LRValues.ToArray(); LinearRegression l = new LinearRegression(); l.Model(Y); HighData.Enqueue(EMA[0] + STDEV * l.STDERR); MiddleData.Enqueue(EMA[0]); LowData.Enqueue(EMA[0] - STDEV * l.STDERR); }
public override double HandleNextTick(Tick t) { EMA1.HandleNextTick(t.BidClose); EMA2.HandleNextTick(t.BidClose); double MACD = EMA1[0] - EMA2[0]; indicatorData.Enqueue(MACD); ((EMA)subIndicators["Signal"]).HandleNextTick(MACD); double MACDHist = MACD - subIndicators["Signal"][0]; ((GenericContainer)subIndicators["Histogram"]).HandleNextTick(MACDHist); return(MACD); }