예제 #1
0
        public override void Compute(StockData aStockData)
        {
            double[] nFastWillR = TAUtil.WilliamR(aStockData, 10);

            double[] nSlowWillR = TAUtil.WilliamR(aStockData, 260);

            if (nFastWillR[nFastWillR.Length - 1] < -80 && nSlowWillR[nSlowWillR.Length - 1] < -80)
            {
                this.Score  = 1;
                this.Signal = true;
            }
        }
예제 #2
0
        public override void Compute(StockData aStockData)
        {
            List <Stoch> nStochs = TAUtil.Stochastic(aStockData, 14, 3, 3);

            Stoch nCurStoch = nStochs[nStochs.Count - 1];

            if (nCurStoch.SlowK < 20)
            {
                this.Score  = 1;
                this.Signal = true;
            }
        }
예제 #3
0
        public override void Compute(StockData aStockData)
        {
            double[] nSar = TAUtil.SAR(aStockData, 0.02, 0.2);

            double nCurSar   = nSar[nSar.Length - 1];
            double nCurClose = aStockData.DataPoints[nSar.Length - 1].Close;

            if (nCurClose > nCurSar)
            {
                this.Score  = 1;
                this.Signal = true;
            }
        }
예제 #4
0
 public override void Compute(StockData aStockData)
 {
     if (TAUtil.Hammer(aStockData) ||
         TAUtil.InvertedHammer(aStockData) ||
         TAUtil.Piercing(aStockData) ||
         TAUtil.Engulfing(aStockData) > 0 ||
         TAUtil.HaramiCross(aStockData) > 0 ||
         TAUtil.Harami(aStockData) > 0 ||
         TAUtil.CounterAttack(aStockData) > 0)
     {
         this.Score  = 1;
         this.Signal = true;
     }
 }
예제 #5
0
 public override void Compute(StockData aStockData)
 {
     if (TAUtil.HangingMan(aStockData) ||
         TAUtil.ShootingStar(aStockData) ||
         TAUtil.DarkCloud(aStockData) ||
         TAUtil.Engulfing(aStockData) < 0 ||
         TAUtil.HaramiCross(aStockData) < 0 ||
         TAUtil.Harami(aStockData) < 0 ||
         TAUtil.CounterAttack(aStockData) < 0)
     {
         this.Score  = 1;
         this.Signal = true;
     }
 }
예제 #6
0
        public override void Compute(StockData aStockData)
        {
            List <MacdPoint> nMacds = TAUtil.MACD(aStockData, 12, 26, 9);

            MacdPoint nPrevMacd = nMacds[nMacds.Count - 2];
            MacdPoint nCurMacd  = nMacds[nMacds.Count - 1];

            double nPrevMacdLine = nPrevMacd.Macd;
            double nCurMacLine   = nCurMacd.Macd;


            if ((nPrevMacdLine > 0) &&
                (nCurMacLine < 0))
            {
                this.Score  = 1;
                this.Signal = true;
            }
        }
예제 #7
0
        private void DrawMacdGraph(GraphPane myPane, int aFastPeriod, int aShortPeriod, int aSignalPeriod, Color aMacdColor, Color aSignalColor)
        {
            InitializeGraphPane(myPane, "MACD Histogram");
            this.MACDList = TAUtil.MACD(this.Stock, aFastPeriod, aShortPeriod, aSignalPeriod);

            PointPairList nMacdList   = new PointPairList();
            PointPairList nSignalList = new PointPairList();
            PointPairList nHistoList  = new PointPairList();

            for (int i = 0; i < this.MACDList.Count; i++)
            {
                double x = (double)new XDate(this.Stock.DataPoints[i].Date);
                double y = this.MACDList[i].Macd;
                double z = this.MACDList[i].Signal;
                double v = this.MACDList[i].MacdHistogram;
                double w = this.MACDList[i].Bullish;
                nMacdList.Add(x, y);
                nSignalList.Add(x, z);
                nHistoList.Add(x, v, w);
            }

            LineItem myCurve  = myPane.AddCurve("MACD(" + aShortPeriod.ToString() + "," + aFastPeriod.ToString() + ")", nMacdList, aMacdColor);
            LineItem myCurve2 = myPane.AddCurve("Signal(" + aSignalPeriod.ToString() + ")", nSignalList, aSignalColor);
            BarItem  myBar    = myPane.AddBar("MACD Histogram", nHistoList, Color.BlueViolet);

            myCurve.Symbol.IsAntiAlias = true;
            myCurve.Symbol.IsVisible   = false;

            myCurve2.Symbol.IsAntiAlias = true;
            myCurve2.Symbol.IsVisible   = false;

            Fill nFillColors = new Fill(new Color[] { this.FallColor, this.RiseColor });

            nFillColors.RangeMin = 0.5;
            nFillColors.RangeMax = 0.6;
            myBar.Bar.Fill       = nFillColors;
            myBar.Bar.Fill.Type  = FillType.GradientByZ;

            this.AdjustSmallerPane(myPane);

            this.OriginalXAxisScale(myPane);
            this.AutoMacdAxisScale(myPane);
        }
예제 #8
0
        public override void Compute(StockData aStockData)
        {
            double[] n50Sma  = TAUtil.SMA(aStockData, 50);
            double[] n150Sma = TAUtil.SMA(aStockData, 150);

            double nPrev50Sma  = n50Sma[n50Sma.Length - 2];
            double nPrev150Sma = n150Sma[n150Sma.Length - 2];

            double nCur50Sma  = n50Sma[n50Sma.Length - 1];
            double nCur150Sma = n150Sma[n150Sma.Length - 1];

            if ((nCur50Sma < nPrev50Sma) &&
                (nCur150Sma < nPrev150Sma) &&
                (nCur50Sma < nCur150Sma))
            {
                this.Score  = 1;
                this.Signal = true;
            }
        }
예제 #9
0
        private void DrawStochPane(GraphPane myPane, int aFastKPeriod, int aSlowKPeriod, int aSlowDPeriod, Color aSlowKColor, Color aSlowDColor)
        {
            InitializeGraphPane(myPane, "Stochastic");

            myPane.YAxis.Scale.Max = 100;
            myPane.YAxis.Scale.Min = 0;

            this.StochList = TAUtil.Stochastic(this.Stock, aFastKPeriod, aSlowKPeriod, aSlowDPeriod);
            PointPairList nSlowKList = new PointPairList();
            PointPairList nSlowDList = new PointPairList();
            PointPairList nHalfList  = new PointPairList();

            for (int i = 0; i < this.StochList.Count; i++)
            {
                double x = (double)new XDate(this.Stock.DataPoints[i].Date);
                double y = this.StochList[i].SlowK;
                double z = this.StochList[i].SlowD;
                nSlowKList.Add(x, y);
                nSlowDList.Add(x, z);
                nHalfList.Add(x, 50);
            }

            LineItem myCurve  = myPane.AddCurve("Slow K(" + aSlowKPeriod.ToString() + ")", nSlowKList, aSlowKColor);
            LineItem myCurve2 = myPane.AddCurve("Smoothed D(" + aSlowDPeriod.ToString() + ")", nSlowDList, aSlowDColor);
            LineItem myCurve3 = myPane.AddCurve("", nHalfList, Color.LightGray);

            myCurve.Symbol.IsAntiAlias = true;
            myCurve.Symbol.IsVisible   = false;

            myCurve2.Symbol.IsAntiAlias = true;
            myCurve2.Symbol.IsVisible   = false;

            myCurve3.Symbol.IsAntiAlias = true;
            myCurve3.Symbol.IsVisible   = false;
            myCurve3.Line.Style         = System.Drawing.Drawing2D.DashStyle.Dash;
            myCurve3.Line.DashOn        = 10;
            myCurve3.Line.DashOff       = 5;

            this.AdjustSmallerPane(myPane);

            this.OriginalXAxisScale(myPane);
        }
예제 #10
0
        public override void Compute(StockData aStockData)
        {
            List <MacdPoint> nMacds = TAUtil.MACD(aStockData, 12, 26, 9);

            MacdPoint nPrevMacd4 = nMacds[nMacds.Count - 5];
            MacdPoint nPrevMacd3 = nMacds[nMacds.Count - 4];
            MacdPoint nPrevMacd2 = nMacds[nMacds.Count - 3];
            MacdPoint nPrevMacd1 = nMacds[nMacds.Count - 2];
            MacdPoint nCurMacd   = nMacds[nMacds.Count - 1];

            if ((nPrevMacd4.Bullish == 0) &&
                (nPrevMacd3.Bullish == 0) &&
                (nPrevMacd2.Bullish == 0) &&
                (nPrevMacd1.Bullish == 0) &&
                (nCurMacd.Bullish == 1))
            {
                this.Score  = 1;
                this.Signal = true;
            }
        }
예제 #11
0
        public override void Compute(StockData aStockData)
        {
            double[] n20Ema = TAUtil.EMA(aStockData, 20);
            double[] n40Ema = TAUtil.EMA(aStockData, 40);

            double nPrev20Ema = n20Ema[n20Ema.Length - 2];
            double nPrev40Ema = n40Ema[n40Ema.Length - 2];

            double nCur20Ema = n20Ema[n20Ema.Length - 1];
            double nCur40Ema = n40Ema[n40Ema.Length - 1];

            if ((nCur20Ema <= nPrev20Ema) &&
                (nCur40Ema <= nPrev40Ema) &&
                (nPrev40Ema < nPrev20Ema) &&
                (nCur20Ema < nCur40Ema))
            {
                this.Score  = 1;
                this.Signal = true;
            }
        }
예제 #12
0
        private void DrawSmaGraph(GraphPane myPane, int aPeriod, Color aLineColor)
        {
            InitializeGraphPane(myPane, this.Stock.Name);

            double[] nSma = TAUtil.SMA(this.Stock, aPeriod);

            PointPairList list = new PointPairList();

            for (int i = 0; i < nSma.Length; i++)
            {
                double x = (double)new XDate(this.Stock.DataPoints[i].Date);
                double y = nSma[i];

                list.Add(x, y);
            }

            LineItem myCurve = myPane.AddCurve("SMA" + aPeriod.ToString(), list, aLineColor);

            myCurve.Symbol.IsAntiAlias = true;
            myCurve.Symbol.IsVisible   = false;

            this.OriginalXAxisScale(myPane);
            this.AutoCandlestickAxisScale(myPane);
        }