コード例 #1
0
ファイル: ModelANN.cs プロジェクト: w1r2p1/MiDax
        public override void Init()
        {
            base.Init();
            _wma_verylow = new IndicatorEMA(_macD.Index, 2);
            _wma_low     = new IndicatorEMA(_macD.SignalLow.IndicatorLow);
            _wma_low.PublishingEnabled = false;
            _wma_mid = new IndicatorEMA(_macD.SignalLow.IndicatorHigh);
            _wma_mid.PublishingEnabled = false;
            _wma_high = new IndicatorEMA(_macD.SignalHigh.IndicatorHigh);
            _wma_high.PublishingEnabled = false;
            var rsiShort = new IndicatorRSI(_macD.Index, 1, 14);

            rsiShort.PublishingEnabled = false;
            var rsiLong = new IndicatorRSI(_macD.Index, 2, 14);

            rsiLong.PublishingEnabled = false;
            var wmVol = new IndicatorWMVol(_macD.Index, _wma_low, 60, 90);

            wmVol.PublishingEnabled = false;
            _mktIndices.AddRange(_otherIndices);
            //_mktIndicators.Add(_wma_verylow);
            //_mktIndicators.Add(_wma_low);
            //_mktIndicators.Add(_wma_mid);
            //_mktIndicators.Add(_wma_high);
            //_mktIndicators.Add(wmVol);
            //_mktIndicators.Add(new IndicatorWMVol(_index, _wma_mid, 60, 90));
            _mktIndicators.Add(new IndicatorNearestLevel(_index));

            int lastversion = StaticDataConnection.Instance.GetAnnLatestVersion(_annId, _index.Id);

            _annWeights = StaticDataConnection.Instance.GetAnnWeights(_annId, _index.Id, lastversion);
            var signalType = Type.GetType("MidaxLib.SignalANN" + _annId);
            List <Indicator> annIndicators = new List <Indicator>();

            annIndicators.Add(_wma_verylow);
            annIndicators.Add(_wma_low);
            annIndicators.Add(_wma_mid);
            annIndicators.Add(_wma_high);
            annIndicators.Add(rsiShort);
            annIndicators.Add(rsiLong);
            annIndicators.Add(wmVol);
            List <object> signalParams = new List <object>();

            signalParams.Add(_index);
            signalParams.Add(annIndicators);
            signalParams.Add(_annWeights);
            this._ann = (SignalANN)Activator.CreateInstance(signalType, signalParams.ToArray());
            this._mktSignals.Add(this._ann);

            var allIndices = new List <MarketData>();

            allIndices.Add(_index);
            allIndices.AddRange(_otherIndices);
            foreach (var index in allIndices)
            {
                var indicatorLow        = new IndicatorLow(index);
                var indicatorHigh       = new IndicatorHigh(index);
                var indicatorCloseBid   = new IndicatorCloseBid(index);
                var indicatorCloseOffer = new IndicatorCloseOffer(index);
                _mktIndicators.Add(indicatorLow);
                _mktIndicators.Add(indicatorHigh);
                _mktIndicators.Add(indicatorCloseBid);
                _mktIndicators.Add(indicatorCloseOffer);
                _mktEODIndicators.Add(indicatorLow);
                _mktEODIndicators.Add(indicatorHigh);
                _mktEODIndicators.Add(indicatorCloseBid);
                _mktEODIndicators.Add(indicatorCloseOffer);
                _mktEODIndicators.Add(new IndicatorLevelPivot(index));
                _mktEODIndicators.Add(new IndicatorLevelR1(index));
                _mktEODIndicators.Add(new IndicatorLevelR2(index));
                _mktEODIndicators.Add(new IndicatorLevelR3(index));
                _mktEODIndicators.Add(new IndicatorLevelS1(index));
                _mktEODIndicators.Add(new IndicatorLevelS2(index));
                _mktEODIndicators.Add(new IndicatorLevelS3(index));
            }
        }
コード例 #2
0
ファイル: ModelANN.cs プロジェクト: JBetser/MiDax
        public override void Init()
        {
            base.Init();
            _wma_verylow = new IndicatorEMA(_macD.Index, 2);
            _wma_low = new IndicatorEMA(_macD.SignalLow.IndicatorLow);
            _wma_low.PublishingEnabled = false;
            _wma_mid = new IndicatorEMA(_macD.SignalLow.IndicatorHigh);
            _wma_mid.PublishingEnabled = false;
            _wma_high = new IndicatorEMA(_macD.SignalHigh.IndicatorHigh);
            _wma_high.PublishingEnabled = false;
            var rsiShort = new IndicatorRSI(_macD.Index, 1, 14);
            rsiShort.PublishingEnabled = false;
            var rsiLong = new IndicatorRSI(_macD.Index, 2, 14);
            rsiLong.PublishingEnabled = false;
            var wmVol = new IndicatorWMVol(_macD.Index, _wma_low, 60, 90);
            wmVol.PublishingEnabled = false;
            _mktIndices.AddRange(_otherIndices);
            //_mktIndicators.Add(_wma_verylow);
            //_mktIndicators.Add(_wma_low);
            //_mktIndicators.Add(_wma_mid);
            //_mktIndicators.Add(_wma_high);
            //_mktIndicators.Add(wmVol);
            //_mktIndicators.Add(new IndicatorWMVol(_index, _wma_mid, 60, 90));
            _mktIndicators.Add(new IndicatorNearestLevel(_index));

            int lastversion = StaticDataConnection.Instance.GetAnnLatestVersion(_annId, _index.Id);
            _annWeights = StaticDataConnection.Instance.GetAnnWeights(_annId, _index.Id, lastversion);
            var signalType = Type.GetType("MidaxLib.SignalANN" + _annId);
            List<Indicator> annIndicators = new List<Indicator>();
            //annIndicators.Add(_wma_verylow);
            annIndicators.Add(_wma_low);
            //annIndicators.Add(_wma_mid);
            annIndicators.Add(_wma_high);
            annIndicators.Add(rsiShort);
            annIndicators.Add(rsiLong);
            annIndicators.Add(wmVol);
            List<object> signalParams = new List<object>();
            signalParams.Add(_index);
            signalParams.Add(annIndicators);
            signalParams.Add(_annWeights);
            this._ann = (SignalANN)Activator.CreateInstance(signalType, signalParams.ToArray());
            this._mktSignals.Add(this._ann);

            var allIndices = new List<MarketData>();
            allIndices.Add(_index);
            allIndices.AddRange(_otherIndices);
            foreach (var index in allIndices)
            {
                var indicatorLow = new IndicatorLow(index);
                var indicatorHigh = new IndicatorHigh(index);
                var indicatorCloseBid = new IndicatorCloseBid(index);
                var indicatorCloseOffer = new IndicatorCloseOffer(index);
                _mktIndicators.Add(indicatorLow);
                _mktIndicators.Add(indicatorHigh);
                _mktIndicators.Add(indicatorCloseBid);
                _mktIndicators.Add(indicatorCloseOffer);
                _mktEODIndicators.Add(indicatorLow);
                _mktEODIndicators.Add(indicatorHigh);
                _mktEODIndicators.Add(indicatorCloseBid);
                _mktEODIndicators.Add(indicatorCloseOffer);
                _mktEODIndicators.Add(new IndicatorLevelPivot(index));
                _mktEODIndicators.Add(new IndicatorLevelR1(index));
                _mktEODIndicators.Add(new IndicatorLevelR2(index));
                _mktEODIndicators.Add(new IndicatorLevelR3(index));
                _mktEODIndicators.Add(new IndicatorLevelS1(index));
                _mktEODIndicators.Add(new IndicatorLevelS2(index));
                _mktEODIndicators.Add(new IndicatorLevelS3(index));
            }
        }