// 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();
                    }
                }
            }
        }
Пример #2
0
        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);
        }
Пример #3
0
 public override void ReceiveCandle(sCandle pCandle, int pPeriod, string pCBTitle)
 {
     if ((pPeriod == Minutes) && (pCBTitle == "cbx"))
     {
         CandlePatterns.ReceiveTick(pCandle.O, pCandle.H, pCandle.L, pCandle.C);
         DecisionFunction();
     }
 }
Пример #4
0
        public override void ReceiveCandle(sCandle pCandle, int pPeriod, string pCBTitle)
        {
            if ((pPeriod == Minutes) && (pCBTitle == "cbx"))
            {
                Candle = pCandle;

                DecisionFunction();
            }
        }
Пример #5
0
 // called from CandleBuilder
 public override void ReceiveCandle(sCandle pCandle, int pPeriod, string pCBTitle)
 {
     if ((pPeriod == Minutes) && (pCBTitle == "cbx"))
     {
         StochRSI.ReceiveTick(pCandle.C);
         RSISlope.ReceiveTick(StochRSI.Value());
         DecisionFunction();
     }
 }
Пример #6
0
        public void ReceiveTick(double pO, double pH, double pL, double pC)
        {
            sCandle candle = new sCandle();

            candle.O = pO;
            candle.H = pH;
            candle.L = pL;
            candle.C = pC;

            Prices.Add(candle);
        }
Пример #7
0
        // 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"))
            {
                // must manually send candle values to indicator(s) in use
                // that way, same indicator can be used twice with different
                // candle periods, or different values (C, O, avg(H,L,C))

                // after that, call decision function
                DecisionFunction();
            }
        }
Пример #8
0
        // 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"))
            {
                if (cbx.candlecount > PeriodsLong + PeriodsShort)
                {
                    MaxAbsDeriv = -1.0E-25;

                    double  Sum;
                    sCandle Candle;

                    Sum = 0;
                    for (int i = 1; i < PeriodsLong + 1; i++)
                    {
                        Candle = cbx.GetCandle(i);
                        double a = (Candle.H + Candle.L) / 2;
                        Sum += a;

                        Candle = cbx.GetCandle(i + 1);
                        double b = (Candle.H + Candle.L) / 2;

                        Candle = cbx.GetCandle(i + 2);
                        double c = (Candle.H + Candle.L) / 2;

                        double deriv2 = Math.Abs(a - 2 * b + c);
                        if (deriv2 > MaxAbsDeriv)
                        {
                            MaxAbsDeriv = deriv2;
                        }

                        if (i == 1)
                        {
                            Deriv2 = deriv2;
                        }
                    }

                    AvgLong = Sum / PeriodsLong;

                    Sum = 0;
                    for (int i = PeriodsLong + 1; i < PeriodsLong + PeriodsShort + 1; i++)
                    {
                        Candle = cbx.GetCandle(i);
                        Sum   += (Candle.H + Candle.L) / 2;
                    }

                    AvgShort = Sum / PeriodsShort;

                    // after that, call decision function
                    DecisionFunction();
                }
            }
        }
Пример #9
0
        public void ReceiveTick(double pO, double pH, double pL, double pC)
        {
            sCandle candle = new sCandle();

            PreviousCandle = CurrentCandle;

            candle.O = pO;
            candle.H = pH;
            candle.L = pL;
            candle.C = pC;

            CurrentCandle = candle;
        }
Пример #10
0
        public override void ReceiveCandle(sCandle pCandle, int pPeriod, string pCBTitle)
        {
            if ((pPeriod == Minutes) && (pCBTitle == "cbx"))
            {
                Candle = pCandle;

                if (minmax.isPrimed())
                {
                    DecisionFunction();
                }

                // do not include current candle in Min/Max data
                // until after the decision function
                minmax.ReceiveTick(Candle.H);
                minmax.ReceiveTick(Candle.L);
            }
        }
Пример #11
0
        public override void ReceiveCandle(sCandle pCandle, int pPeriod, string pCBTitle)
        {
            if ((pPeriod == Minutes) && (pCBTitle == "cbx"))
            {
                double TP = (pCandle.H + pCandle.L + pCandle.C) / 3;

                Candle = pCandle;

                BBands.ReceiveTick(pCandle.C);
                HMA.ReceiveTick(TP);

                if (BBands.isPrimed() && HMA.isPrimed())
                {
                    DecisionFunction();
                }
            }
        }
Пример #12
0
        public void ReceiveTick(double pO, double pH, double pL, double pC)
        {
            sCandle Candle = new sCandle();

            Candle.O = pO;
            Candle.H = pH;
            Candle.L = pL;
            Candle.C = pC;

            Candles[(tickcount % maxcandles)] = Candle;

            // avoid overflow by restricting range of tickcount
            // when indicator is fully primed
            tickcount++;
            if (tickcount == (3 * maxcandles))
            {
                tickcount = (2 * maxcandles);
            }
        }
Пример #13
0
        public override void ReceiveCandle(sCandle pCandle, int pPeriod, string pCBTitle)
        {
            if ((pPeriod == Minutes) && (pCBTitle == "cbx"))
            {
                Candle = pCandle;
                CCI.ReceiveTick(pCandle.O, pCandle.H, pCandle.L, pCandle.C);
                TCCI.ReceiveTick(pCandle.O, pCandle.H, pCandle.L, pCandle.C);

                // need to put primed values into this indicators
                // not primed right now to decrease down time
                CCIH.Add(CCI.Value());
                TCCIH.Add(CCI.Value());
                CCISlope.ReceiveTick(CCI.Value());

                if (CCI.isPrimed() && TCCI.isPrimed())
                {
                    DecisionFunction();
                }
            }
        }
Пример #14
0
        public void ReceiveTick(double pO, double pH, double pL, double pC)
        {
            Trend.ReceiveTick(pO, pH, pL, pC);

            sCandle Candle = new sCandle();

            Candle.O = pO;
            Candle.H = pH;
            Candle.L = pL;
            Candle.C = pC;

            Candles[(tickcount % CandlesToBuffer)] = Candle;

            // avoid overflow by restricting range of tickcount
            // when indicator is fully primed
            tickcount++;
            if (tickcount == (3 * CandlesToBuffer))
            {
                tickcount = (2 * CandlesToBuffer);
            }
        }
Пример #15
0
 public iTrueRange()
 {
     PreviousCandle = null;
     CurrentCandle  = null;
 }
Пример #16
0
 public override void ReceiveCandle(sCandle pCandle, int pPeriod, string pCBTitle)
 {
 }