예제 #1
0
        public static void TestGraph(this AbstractIndicator ind, string filename, int length)
        {
            Quantum q = Quantum.ExcelToQuantum(filename, "symbol", 0);

            var           dz    = new DenseMatrix(4 + 1 + ind.SubIndicatorSize, q.Data.Count);
            List <string> names = new List <string>();

            names.Add("symbol");
            names.Add(ind.ToString());
            foreach (var indicator in ind.SubIndicators)
            {
                names.Add(indicator.Key);
            }

            //chartoptions
            ChartOption[] chartOptions = new ChartOption[names.Count];
            chartOptions[0] = new ChartOption()
            {
                Height = 400, YPosition = 0
            };
            chartOptions[1] = new ChartOption()
            {
                Height = 200, YPosition = 1
            };
            for (int i = 2; i < chartOptions.Length; i++)
            {
                chartOptions[i] = new ChartOption()
                {
                    Height = 0, YPosition = 1, Layover = true
                }
            }
            ;

            int counter = 0;

            foreach (Tick tick in q)
            {
                dz[0, counter] = tick.BidOpen;
                dz[1, counter] = tick.BidHigh;
                dz[2, counter] = tick.BidLow;
                dz[3, counter] = tick.BidClose;

                dz[4, counter] = ind.HandleNextTick(tick);

                int icounter = 5;
                foreach (var subind in ind.SubIndicators.Values)
                {
                    dz[icounter, counter] = subind[0];
                    icounter++;
                }

                counter++;
            }


            Visualize.GenerateMultiPaneGraph(names.ToArray(), q.Data.Keys.ToArray(), dz, QSConstants.DEFAULT_DATA_FILEPATH + @"results.html",
                                             chartOptions);

            Console.WriteLine("Done Generating Graph for " + ind.ToString());
        }
예제 #2
0
파일: DWT.cs 프로젝트: yuxi214/QuantSys
 public DWT(int n, int detailLevel, AbstractIndicator indicator = null) : base(n)
 {
     priceData        = new MovingQueue <double>(n);
     st               = new SignalTransform();
     this.detailLevel = detailLevel;
     this.indicator   = indicator;
 }
예제 #3
0
 public PercentileRank(int n, AbstractIndicator indicator = null) : base(n)
 {
     data = new MovingQueue <double>(n);
     if (indicator != null)
     {
         this.indicator = indicator;
     }
 }
예제 #4
0
파일: TEMA.cs 프로젝트: yuxi214/QuantSys
 public TEMA(int n, AbstractIndicator indicator = null)
     : base(n)
 {
     EMA1           = new EMA(n);
     EMA2           = new EMA(n);
     EMA3           = new EMA(n);
     this.indicator = indicator;
 }
예제 #5
0
 public Job_SymbolSet(string[] symbols, string timeframe, int numTicks, AbstractIndicator indicator)
 {
     this.symbols   = symbols;
     this.indicator = indicator;
     this.timeframe = timeframe;
     this.numTicks  = numTicks;
     mktData        = new List <MarketDataEventArg>();
     graphData      = new DenseMatrix(symbols.Length, numTicks);
 }
예제 #6
0
 public AdaptiveSmoothing(int n, double v = 0.7, int t = 3, AbstractIndicator indicator = null)
     : base(n)
 {
     this.indicator = indicator;
     GDS            = new GDEMA[t];
     for (int i = 0; i < t; i++)
     {
         GDS[i] = new GDEMA(n, v, indicator);
     }
 }
예제 #7
0
 public QSPolyMA(int N, AbstractIndicator indicator = null)
     : base(N)
 {
     tickdata       = new MovingQueue <double>(N);
     this.indicator = indicator;
     X = new double[N];
     for (int i = 0; i < X.Count(); i++)
     {
         X[i] = i;
     }
 }
예제 #8
0
        public RSquared(int n, AbstractIndicator indicator = null) : base(n)
        {
            X = new MovingQueue <double>(n);
            Y = new DenseVector(n);
            int counter = 0;

            for (double i = (double)-Y.Count / 2 + 0.5; i < (double)Y.Count / 2; i++)
            {
                Y[counter++] = i;
            }
            this.indicator = indicator;
        }
예제 #9
0
 public Divergence(AbstractIndicator indicator) : base(indicator.Period)
 {
     MA             = new QSPolyMA(indicator.Period);
     this.indicator = indicator;
     subIndicators.Add(indicator.toString(), indicator);
 }
예제 #10
0
파일: GDEMA.cs 프로젝트: yuxi214/QuantSys
 public GDEMA(int n, double v = 1, AbstractIndicator indicator = null) : base(n)
 {
     EMA1           = new EMA(n);
     EMA2           = new EMA(n);
     this.indicator = indicator;
 }
예제 #11
0
        public static void TestGraphLive(this AbstractIndicator ind, string timeframe, string symbol, int length)
        {
            //------------grab data
            FXSession session = new FXSession();

            session.InitializeSession();

            HistoricPriceEngine h = new HistoricPriceEngine(session);

            h.GetLongHistoricPrices(symbol, timeframe, length);

            while (!h.Complete)
            {
                Thread.Sleep(100);
            }
            //-----------------------

            Quantum       q     = h.Data;
            var           dz    = new DenseMatrix(4 + 1 + ind.SubIndicatorSize, q.Data.Count);
            List <string> names = new List <string>();

            names.Add("symbol");
            names.Add(ind.ToString());
            foreach (var indicator in ind.SubIndicators)
            {
                names.Add(indicator.Key);
            }

            //chartoptions
            ChartOption[] chartOptions = new ChartOption[names.Count];
            chartOptions[0] = new ChartOption()
            {
                Height = 400, YPosition = 0
            };
            chartOptions[1] = new ChartOption()
            {
                Height = 200, YPosition = 1
            };
            for (int i = 2; i < chartOptions.Length; i++)
            {
                chartOptions[i] = new ChartOption()
                {
                    Height = 0, YPosition = 1, Layover = true
                }
            }
            ;

            int counter = 0;

            foreach (Tick tick in q)
            {
                dz[0, counter] = tick.BidOpen;
                dz[1, counter] = tick.BidHigh;
                dz[2, counter] = tick.BidLow;
                dz[3, counter] = tick.BidClose;

                dz[4, counter] = ind.HandleNextTick(tick);

                int icounter = 5;
                foreach (var subind in ind.SubIndicators.Values)
                {
                    dz[icounter, counter] = subind[0];
                    icounter++;
                }

                counter++;
            }


            Visualize.GenerateMultiPaneGraph(names.ToArray(), q.Data.Keys.ToArray(), dz, QSConstants.DEFAULT_DATA_FILEPATH + @"results.html",
                                             chartOptions);

            Console.WriteLine("Done Generating Graph for " + ind.ToString());
        }
예제 #12
0
 public KAMA(int n, AbstractIndicator indicator = null) : base(n)
 {
     priceData      = new MovingQueue <double>(n);
     this.indicator = indicator;
 }
예제 #13
0
파일: SMA.cs 프로젝트: yuxi214/QuantSys
 public SMA(int N, AbstractIndicator indicator = null) : base(N)
 {
     tickdata       = new MovingQueue <double>(N);
     this.indicator = indicator;
 }
예제 #14
0
 public EMA(int N, AbstractIndicator indicator = null) : base(N)
 {
     alpha          = 2.0 / (N + 1);
     tickdata       = new MovingQueue <double>(N);
     this.indicator = indicator;
 }
예제 #15
0
 protected void AttachIndicator(string indicatorName, AbstractIndicator i)
 {
     indicatorList.Add(indicatorName, i);
 }
예제 #16
0
파일: ZLEMA.cs 프로젝트: valmac/QuantSys
 public ZLEMA(int n, AbstractIndicator indicator = null) : base(n)
 {
     EMA            = new EMA(n);
     this.indicator = indicator;
     priceData      = new MovingQueue <double>((n - 1) / 2);
 }
예제 #17
0
 public ROC(int n, AbstractIndicator indicator = null) : base(n)
 {
     tickData       = new MovingQueue <double>(n);
     this.indicator = indicator;
 }