コード例 #1
0
        public void Analyse(TechnicalNet.RealData.StockHistory data, int today)
        {
            double finalClose = data.Closes[today];
            double fromAgoClose = data.Closes[today - N];
            double ratio = ((((finalClose - fromAgoClose)) / fromAgoClose) / N) * 100;

            Val = Math.Tanh(ratio);
        }
コード例 #2
0
        public override double PredictValue(TechnicalNet.RealData.StockHistory stockHistory, int today, int daysInFuture)
        {
            int N = Math.Min(daysInFuture, today - 1);

            double todayCloseL = Math.Log(stockHistory.Closes[today]);
            double fromAgoCloseL = Math.Log(stockHistory.Closes[today - N]);
            double slope = (todayCloseL - fromAgoCloseL) / (double)N;

            return Math.Exp(todayCloseL + (slope * (double)daysInFuture));
        }
コード例 #3
0
        public void Analyse(TechnicalNet.RealData.StockHistory stock, int today)
        {
            double dmplus = 0;
            double dmminus = 0;
            double alpha = 0.1;

            for (int i = today; i > 50; i--)
            {
                double upmove = stock.Highs[i] - stock.Highs[i - 1];
                double downmove = stock.Lows[i - 1] - stock.Lows[i];
                if (upmove > downmove && upmove > 0)
                    dmplus = alpha * upmove + (1 - alpha) * dmplus;
                else dmplus = 0;
                if (downmove > upmove && downmove > 0)
                    dmminus = alpha * downmove + (1 - alpha) * dmminus;
            }

            double diplus = (100 * dmplus) / stock.ATR[today];
            double diminus = (100 * dmplus) / stock.ATR[today];
        }
コード例 #4
0
        public void Analyse(TechnicalNet.RealData.StockHistory stock, int today)
        {
            double[] data1 = new double[stock.Count];
            data1[0] = stock.Closes[0];
            double[] data2 = new double[stock.Count];
            data2[0] = stock.Closes[0];

            for (int i = 1; i < stock.Count; i++)
                data1[i] = ((1 - Rate1) * stock.Closes[i]) + (Rate1 * data1[i - 1]);
            for (int i = 1; i < stock.Count; i++)
                data2[i] = ((1 - Rate2) * stock.Closes[i]) + (Rate2 * data2[i - 1]);

            Val = 0D;

            for (int i = 1; i < today; i++)
            {
                if ((data1[i - 1] < data2[i - 1]) && (data1[i] > data2[i]))
                    Val = -1D;
                if ((data1[i - 1] > data2[i - 1]) && (data1[i] < data2[i]))
                    Val = 1D;
            }
        }
コード例 #5
0
ファイル: Graph.cs プロジェクト: JasonCrease/TechnicalNet
        public Graph(TechnicalNet.RealData.StockHistory stockHistory, List<TechnicalNet.Metrics.IMetric> metrics)
        {
            m_StockHistory = stockHistory;
            m_Metrics = metrics;
            Bitmap = new Bitmap(BitmapWidth, BitmapHeight);
            m_Graphics = Graphics.FromImage(Bitmap);

            yMin = stockHistory.Opens.Min();
            yMax = stockHistory.Opens.Max();
            xMin = stockHistory.StartDate.Ticks;
            xMax = stockHistory.EndDate.Ticks;
            yRange = yMax - yMin;

            GraphHeight = BitmapHeight - (MarginVertical * 2);
            GraphWidth = BitmapWidth - (MarginHorizontal * 2);

            HorizontalStretch = ((double)GraphWidth / 250D);

            DrawLeftAxis();
            DrawBottomAxis();
            DrawValues();
            DrawMetrics();
            DrawCutoff();
        }
コード例 #6
0
 public abstract double PredictValue(TechnicalNet.RealData.StockHistory stockHistory, int today, int daysInFuture);
コード例 #7
0
 public void Analyse(TechnicalNet.RealData.StockHistory stock, int today)
 {
     throw new NotImplementedException();
 }
コード例 #8
0
 public override double PredictValue(TechnicalNet.RealData.StockHistory stockHistory, int today, int daysInFuture)
 {
     return stockHistory.Closes[today];
 }
コード例 #9
0
 public void Analyse(TechnicalNet.RealData.StockHistory data)
 {
     Val = (new System.Random()).NextDouble() - 0.5D;
 }