コード例 #1
0
        public OperType Analyse(IStockData prevStock, IStockData stock, IStockData nextStock)
        {
            if ((stock == null) || (prevStock == null) || (nextStock == null))
            {
                return(OperType.NoOper);
            }

            double deltapercent = StockDataCalc.GetRisePercent(stock);
            //double prevPercent = StockDataCalc.GetRisePercent(prevStock);
            double nextPercent = StockDataCalc.GetRisePercent(nextStock);

            if (NumbericHelper.IsSameSign(deltapercent, nextPercent))
            {
                return(OperType.NoOper);
            }

            if ((nextPercent > 0.03) && (nextStock.EndPrice > prevStock.StartPrice) &&
                (nextStock.EndPrice > stock.StartPrice))
            {
                return(OperType.Buy);
            }

            if ((nextPercent < -0.03) && (nextStock.EndPrice < prevStock.StartPrice) &&
                (nextStock.EndPrice < stock.StartPrice))
            {
                return(OperType.Sell);
            }

            return(OperType.NoOper);
        }
コード例 #2
0
ファイル: ShapeScanner.cs プロジェクト: soross/stockanalyzer
        public OperType Analyse(IStockData stock, IStockData prevStock)
        {
            if ((stock == null) || (prevStock == null))
            {
                return(OperType.NoOper);
            }

            double deltapercent = StockDataCalc.GetRisePercent(stock);

            double prevPercent = StockDataCalc.GetRisePercent(prevStock);

            // Only for converse
            if (NumbericHelper.IsSameSign(deltapercent, prevPercent))
            {
                return(OperType.NoOper);
            }

            // ratio should be larger than yesterday
            if (Math.Abs(deltapercent) < Math.Abs(prevPercent))
            {
                return(OperType.NoOper);
            }

            if ((deltapercent > 0.02) && (stock.EndPrice > prevStock.StartPrice))
            {
                return(OperType.Buy);
            }

            if ((deltapercent < -0.02) && (stock.EndPrice < prevStock.StartPrice))
            {
                return(OperType.Sell);
            }

            return(OperType.NoOper);
        }
コード例 #3
0
ファイル: ShapeJudger.cs プロジェクト: soross/stockanalyzer
        public static bool IsDownCross(IStockData data)
        {
            double deltapercent = StockDataCalc.GetRisePercent(data);
            bool   isCross      = ((Math.Abs(deltapercent) < CROSSDELTAPERCENT) &&
                                   (data.MaxPrice > data.StartPrice) &&
                                   (data.MinPrice < data.EndPrice));

            return(isCross && (data.EndPrice < data.StartPrice));
        }
コード例 #4
0
ファイル: ShapeJudger.cs プロジェクト: soross/stockanalyzer
        public static bool IsCross(IStockData data)
        {
            double deltapercent = StockDataCalc.GetRisePercent(data);

            double riseRatio  = StockDataCalc.GetRisePercent(data.StartPrice, data.MaxPrice);
            double downRatio  = StockDataCalc.GetRisePercent(data.StartPrice, data.MinPrice);
            double swingRatio = riseRatio + downRatio;

            return((Math.Abs(deltapercent) < CROSSDELTAPERCENT) &&
                   (data.MaxPrice > data.StartPrice) &&
                   (data.MinPrice < data.EndPrice) &&
                   (swingRatio < CROSSDELTAPERCENT) &&
                   (riseRatio > CROSSSWINGPERCENT));
        }