// CandleBuilders call this function when registered with them // and a new candle is built // one distinguished calling CandleBuilder by handle in candle and period public override void ReceiveCandle(sCandle pCandle, int pPeriod, string pCBTitle) { if ((pPeriod == Minutes) && (pCBTitle == "cbx")) { HMA.ReceiveTick(pCandle.C); FMA.ReceiveTick(pCandle.C); CCI.ReceiveTick(pCandle.O, pCandle.H, pCandle.L, pCandle.C); //BBands.ReceiveTick(pCandle.C); //StochRSI.ReceiveTick(pCandle.C); if (HMA.Value() != 0) { Derivatives.ReceiveTick(HMA.Value()); BBands.ReceiveTick(HMA.Value()); StochRSI.ReceiveTick(HMA.Value()); } if ((cbx.candlecount > 3) && (Derivatives.isPrimed()) && (StochRSI.isPrimed())) { double deriv2; double deriv1; Derivatives.Value(out deriv1, out deriv2); Deriv1.Add(deriv1); Deriv2.Add(deriv2); if (Deriv2.tickcount > 2) { DecisionFunction(); } } } }
public void ReceiveCandle(sCandle pCandle) { Candle = pCandle; ATR.ReceiveTick(pCandle.O, pCandle.H, pCandle.L, pCandle.C); BB.ReceiveTick(pCandle.C); CCI.ReceiveTick(pCandle.O, pCandle.H, pCandle.L, pCandle.C); Derivatives.ReceiveTick(pCandle.C); EMA.ReceiveTick(pCandle.C); FMA.ReceiveTick(pCandle.C); HMA.ReceiveTick(pCandle.C); MACD.ReceiveTick(pCandle.C); Momemtum.ReceiveTick(pCandle.C); RSI.ReceiveTick(pCandle.C); Renko.ReceiveTick(pCandle.C); SMA.ReceiveTick(pCandle.C); STARCBands.ReceiveTick(pCandle.O, pCandle.H, pCandle.L, pCandle.C); STDDEV.ReceiveTick(pCandle.C); Slope.ReceiveTick(pCandle.C); StochRSI.ReceiveTick(pCandle.C); Stochastics.ReceiveTick(pCandle.O, pCandle.H, pCandle.L, pCandle.C); Stub.ReceiveTick(pCandle.C); Trend.ReceiveTick(pCandle.O, pCandle.H, pCandle.L, pCandle.C); TrueRange.ReceiveTick(pCandle.O, pCandle.H, pCandle.L, pCandle.C); WMA.ReceiveTick(pCandle.C); }
public static void TestHMA() { iFMA FMA = new iFMA(10); for (int i = 0; i < 10; i++) { FMA.ReceiveTick(i); } double v = FMA.Value(); // should be 9.5 if (Math.Abs(9.5 - v) < 0.000001) { Framework.Logger(2, "FMA Returns correct value: 9.5"); } }