예제 #1
0
        /// <summary>
        /// The mean reversion is the theory suggesting that prices and returns eventually move back towards the mean or average.
        /// </summary>
        public Mean_Reversion_Indicator Mean_Reversion_Indicator(IDataSeries input, System.Boolean isLongEnabled, System.Boolean isShortEnabled, System.Int32 bollinger_Period, System.Double bollinger_Standard_Deviation, System.Int32 momentum_Period, System.Int32 rSI_Period, System.Int32 rSI_Smooth, System.Int32 rSI_Level_Low, System.Int32 rSI_Level_High, System.Int32 momentum_Level_Low, System.Int32 momentum_Level_High)
        {
            var indicator = CachedCalculationUnits.GetCachedIndicator <Mean_Reversion_Indicator>(input, i => i.IsLongEnabled == isLongEnabled && i.IsShortEnabled == isShortEnabled && i.Bollinger_Period == bollinger_Period && Math.Abs(i.Bollinger_Standard_Deviation - bollinger_Standard_Deviation) <= Double.Epsilon && i.Momentum_Period == momentum_Period && i.RSI_Period == rSI_Period && i.RSI_Smooth == rSI_Smooth && i.RSI_Level_Low == rSI_Level_Low && i.RSI_Level_High == rSI_Level_High && i.Momentum_Level_Low == momentum_Level_Low && i.Momentum_Level_High == momentum_Level_High);

            if (indicator != null)
            {
                return(indicator);
            }

            indicator = new Mean_Reversion_Indicator
            {
                BarsRequired        = BarsRequired,
                CalculateOnBarClose = CalculateOnBarClose,
                Input                        = input,
                IsLongEnabled                = isLongEnabled,
                IsShortEnabled               = isShortEnabled,
                Bollinger_Period             = bollinger_Period,
                Bollinger_Standard_Deviation = bollinger_Standard_Deviation,
                Momentum_Period              = momentum_Period,
                RSI_Period                   = rSI_Period,
                RSI_Smooth                   = rSI_Smooth,
                RSI_Level_Low                = rSI_Level_Low,
                RSI_Level_High               = rSI_Level_High,
                Momentum_Level_Low           = momentum_Level_Low,
                Momentum_Level_High          = momentum_Level_High
            };
            indicator.SetUp();

            CachedCalculationUnits.AddIndicator2Cache(indicator);

            return(indicator);
        }
        protected override void OnStartUp()
        {
            base.OnStartUp();

            //Init our indicator to get code access
            this._Mean_Reversion_Indicator = new Mean_Reversion_Indicator();
        }
        protected override void OnStart()
        {
            base.OnStart();

            //Init our indicator to get code access
            this._Mean_Reversion_Indicator = new Mean_Reversion_Indicator();

            this.ErrorOccured   = false;
            this.WarningOccured = false;
        }
        protected override void OnStartUp()
        {
            base.OnStartUp();

            //Print("OnStartUp" + Bars[0].Time);

            //Init our indicator to get code access
            this._Mean_Reversion_Indicator = new Mean_Reversion_Indicator();

            //Initalize statistic data list if this feature is enabled
            if (this.StatisticBacktesting)
            {
                this._StatisticContainer = new StatisticContainer();
            }
        }
예제 #5
0
        protected override void OnStart()
        {
            base.OnStart();

            //Print("OnStartUp" + Bars[0].Timestamp);

            //Init our indicator to get code access
            this._Mean_Reversion_Indicator = new Mean_Reversion_Indicator();

            ////todo Initalize statistic data list if this feature is enabled
            //if (this.StatisticBacktesting)
            //{
            //    this._StatisticContainer = new StatisticContainer();
            //}

            this.ErrorOccured   = false;
            this.WarningOccured = false;
        }