Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new Stochastics Indicator from the specified periods.
        /// </summary>
        /// <param name="name">The name of this indicator.</param>
        /// <param name="period">The period given to calculate the Fast %K</param>
        /// <param name="kPeriod">The K period given to calculated the Slow %K</param>
        /// <param name="dPeriod">The D period given to calculated the Slow %D</param>
        public Stochastic(string name, int period, int kPeriod, int dPeriod)
            : base(name)
        {
            _maximum = new Maximum(name + "_Max", period);
            _mininum = new Minimum(name + "_Min", period);
            _sumFastK = new Sum(name + "_SumFastK", kPeriod);
            _sumSlowK = new Sum(name + "_SumD", dPeriod);

            FastStoch = new FunctionalIndicator<IBaseDataBar>(name + "_FastStoch",
                input => ComputeFastStoch(period, input),
                fastStoch => _maximum.IsReady,
                () => _maximum.Reset()
                );

            StochK = new FunctionalIndicator<IBaseDataBar>(name + "_StochK",
                input => ComputeStochK(period, kPeriod, input),
                stochK => _maximum.IsReady,
                () => _maximum.Reset()
                );

            StochD = new FunctionalIndicator<IBaseDataBar>(name + "_StochD",
                input => ComputeStochD(period, kPeriod, dPeriod),
                stochD => _maximum.IsReady,
                () => _maximum.Reset()
                );
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MSAStrategy" /> class.
        /// </summary>
        /// <param name="smoothedSeries">The smoothed series.</param>
        /// <param name="previousDaysN">How many daily means will be used to estimate the thresholds.</param>
        /// <param name="runsPerDay">How many runs will be used to estimate the daily mean.</param>
        /// <param name="minRunThreshold">The minimum run threshold.</param>
        /// <param name="DailyIndicatorReset">if set to <c>true</c> [daily indicator reset].</param>
        public MSAStrategy(IndicatorBase<IndicatorDataPoint> smoothedSeries, int previousDaysN = 3, int runsPerDay = 5, decimal minRunThreshold = 0.0001m, bool DailyIndicatorReset = true)
        {
            _runsPerDay = runsPerDay;
            _actualRun = 1m;
            _turnAround = false;
            _minRunThreshold = minRunThreshold;
            _dailyIndicatorReset = DailyIndicatorReset;

            _smoothedSeries = smoothedSeries;
            _smoothedSeriesROC = new RateOfChange(1).Of(_smoothedSeries);
            _SSROCRW = new RollingWindow<IndicatorDataPoint>(2);

            _todayRuns = new List<decimal>();
            _previousDaysDownwardRuns = new RollingWindow<decimal>(previousDaysN);
            _previousDaysUpwardRuns = new RollingWindow<decimal>(previousDaysN);

            ActualSignal = OrderSignal.doNothing;
            Position = StockState.noInvested;

            _smoothedSeriesROC.Updated += (object sender, IndicatorDataPoint updated) =>
                {
                    if (_smoothedSeriesROC.IsReady) _SSROCRW.Add(updated);
                    if (_SSROCRW.IsReady) RunStrategy();
                    if (_SSROCRW.IsReady && IsReady) CheckSignal();
                };
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the CommodityChannelIndex class
 /// </summary>
 /// <param name="name">The name of this indicator</param>
 /// <param name="period">The period of the standard deviation and moving average (middle band)</param>
 /// <param name="movingAverageType">The type of moving average to be used</param>
 public CommodityChannelIndex(string name, int period, MovingAverageType movingAverageType = MovingAverageType.Simple)
     : base(name)
 {
     MovingAverageType = movingAverageType;
     TypicalPriceAverage = movingAverageType.AsIndicator(name + "_TypicalPriceAvg", period);
     TypicalPriceMeanDeviation = new MeanAbsoluteDeviation(name + "_TypicalPriceMAD", period);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the RelativeStrengthIndex class with the specified name and period
 /// </summary>
 /// <param name="name">The name of this indicator</param>
 /// <param name="period">The period used for up and down days</param>
 /// <param name="movingAverageType">The type of moving average to be used for computing the average gain/loss values</param>
 public RelativeStrengthIndex(string name, int period, MovingAverageType movingAverageType = MovingAverageType.Wilders)
     : base(name)
 {
     MovingAverageType = movingAverageType;
     AverageGain = movingAverageType.AsIndicator(name + "Up", period);
     AverageLoss = movingAverageType.AsIndicator(name + "Down", period);
 }
        /// <summary>
        /// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
        /// </summary>
        /// <seealso cref="QCAlgorithm.SetStartDate(System.DateTime)"/>
        /// <seealso cref="QCAlgorithm.SetEndDate(System.DateTime)"/>
        /// <seealso cref="QCAlgorithm.SetCash(decimal)"/>
        public override void Initialize()
        {
            SetStartDate(2009, 01, 01);
            SetEndDate(2015, 01, 01);

            AddSecurity(SecurityType.Equity, Symbol, Resolution.Minute);

            int count = 6;
            int offset = 5;
            int period = 15;

            // define our sma as the base of the ribbon
            var sma = new SimpleMovingAverage(period);

            _ribbon = Enumerable.Range(0, count).Select(x =>
            {
                // define our offset to the zero sma, these various offsets will create our 'displaced' ribbon
                var delay = new Delay(offset*(x+1));

                // define an indicator that takes the output of the sma and pipes it into our delay indicator
                var delayedSma = delay.Of(sma);

                // register our new 'delayedSma' for automaic updates on a daily resolution
                RegisterIndicator(Symbol, delayedSma, Resolution.Daily, data => data.Value);

                return delayedSma;
            }).ToArray();
        }
 public KenCandleStickDeterminer(IndicatorBase indicator, int trendWeight, Func<int, double> stocFunc,  Action<string> logger = null)
 {
     _indicator = indicator;
     _trendWeight = trendWeight;
     _loggerDelegate = logger;
     _stocFunc = stocFunc;
     CalculateTrendLines();
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RegressionChannel"/> class.
 /// </summary>
 /// <param name="name">The name of this indicator</param>
 /// <param name="period">The number of data points to hold in the window</param>
 /// <param name="k">The number of standard deviations specifying the distance between the linear regression and upper or lower channel lines</param>
 public RegressionChannel(string name, int period, decimal k)
     : base(name)
 {
     _standardDeviation = new StandardDeviation(period);
     LinearRegression = new LeastSquaresMovingAverage(name + "_LinearRegression", period);
     LowerChannel = LinearRegression.Minus(_standardDeviation.Times(k), name + "_LowerChannel");
     UpperChannel = LinearRegression.Plus(_standardDeviation.Times(k), name + "_UpperChannel");
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the BollingerBands class
 /// </summary>
 /// <param name="name">The name of this indicator</param>
 /// <param name="period">The period of the standard deviation and moving average (middle band)</param>
 /// <param name="k">The number of standard deviations specifying the distance between the middle band and upper or lower bands</param>
 /// <param name="movingAverageType">The type of moving average to be used</param>
 public BollingerBands(String name, int period, decimal k, MovingAverageType movingAverageType = MovingAverageType.Simple)
     : base(name)
 {
     MovingAverageType = movingAverageType;
     StandardDeviation = new StandardDeviation(name + "_StandardDeviation", period);
     MiddleBand = movingAverageType.AsIndicator(name + "_MiddleBand", period);
     LowerBand = MiddleBand.Minus(StandardDeviation.Times(k), name + "_LowerBand");
     UpperBand = MiddleBand.Plus(StandardDeviation.Times(k), name + "_UpperBand");
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Creates a new AverageTrueRange indicator using the specified period and moving average type
        /// </summary>
        /// <param name="name">The name of this indicator</param>
        /// <param name="period">The smoothing period used to smooth the true range values</param>
        /// <param name="movingAverageType">The type of smoothing used to smooth the true range values</param>
        public AverageTrueRange(string name, int period, MovingAverageType movingAverageType = MovingAverageType.Wilders)
            : base(name)
        {
            _smoother = movingAverageType.AsIndicator(string.Format("{0}_{1}", name, movingAverageType), period);

            IBaseDataBar previous = null;
            TrueRange = new FunctionalIndicator<IBaseDataBar>(name + "_TrueRange", currentBar =>
            {
                // in our ComputeNextValue function we'll just call the ComputeTrueRange
                var nextValue = ComputeTrueRange(previous, currentBar);
                previous = currentBar;
                return nextValue;
            }   // in our IsReady function we just need at least one sample
            , trueRangeIndicator => trueRangeIndicator.Samples >= 1
            );
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Initializes a new instance of the KeltnerChannels class
        /// </summary>
        /// <param name="name">The name of this indicator</param>
        /// <param name="period">The period of the average true range and moving average (middle band)</param>
        /// <param name="k">The number of multiples specifying the distance between the middle band and upper or lower bands</param>
        /// <param name="movingAverageType">The type of moving average to be used</param>
        public KeltnerChannels(string name, int period, decimal k, MovingAverageType movingAverageType = MovingAverageType.Simple)
            : base(name)
        {
            _k = k;

            //Initialise ATR and SMA
            AverageTrueRange = new AverageTrueRange(name + "_AverageTrueRange", period, MovingAverageType.Simple);
            MiddleBand = movingAverageType.AsIndicator(name + "_MiddleBand", period);

            //Compute Lower Band
            LowerBand = new FunctionalIndicator<TradeBar>(name + "_LowerBand",
                input => ComputeLowerBand(),
                lowerBand => MiddleBand.IsReady,
                () => MiddleBand.Reset()
                );

            //Compute Upper Band
            UpperBand = new FunctionalIndicator<TradeBar>(name + "_UpperBand",
                input => ComputeUpperBand(),
                upperBand => MiddleBand.IsReady,
                () => MiddleBand.Reset()
                );
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Creates a new AverageTrueRange indicator using the specified period and moving average type
 /// </summary>
 /// <param name="name">The name of this indicator</param>
 /// <param name="period">The smoothing period used to smooth the true range values</param>
 /// <param name="movingAverageType">The type of smoothing used to smooth the true range values</param>
 public AverageTrueRange(string name, int period, MovingAverageType movingAverageType = MovingAverageType.Wilders)
     : base(name)
 {
     _smoother = movingAverageType.AsIndicator(string.Format("{0}_{1}", name, movingAverageType), period);
 }
Ejemplo n.º 12
0
 private static void RunTestIndicator(IndicatorBase<IndicatorDataPoint> indicator)
 {
     TestHelper.TestIndicator(indicator, "spy_t3.txt", "T3_5", (ind, expected) => Assert.AreEqual(expected, (double)ind.Current.Value, 2e-2));
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Gets the historical data of a bar indicator for the specified symbol. The exact number of bars will be returned.
        /// The symbol must exist in the Securities collection.
        /// </summary>
        /// <param name="indicator">Indicator</param>
        /// <param name="symbol">The symbol to retrieve historical data for</param>
        /// <param name="start">The start time in the algorithm's time zone</param>
        /// <param name="end">The end time in the algorithm's time zone</param>
        /// <param name="resolution">The resolution to request</param>
        /// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to the Value property of BaseData (x => x.Value)</param>
        /// <returns>pandas.DataFrame of historical data of a bar indicator</returns>
        public PyObject Indicator(IndicatorBase <TradeBar> indicator, Symbol symbol, DateTime start, DateTime end, Resolution?resolution = null, Func <IBaseData, TradeBar> selector = null)
        {
            var history = History(new[] { symbol }, start, end, resolution);

            return(Indicator(indicator, history, selector));
        }
Ejemplo n.º 14
0
        public int[] Get(Type type, SubType subType, bool pvp, bool affectingOpposite = false)
        {
            int value1 = 0;
            int value2 = 0;

            lock (Indicators)
            {
                IndicatorBase[] items = new IndicatorBase[Indicators.Count + 5];
                Indicators.CopyTo(items);
                foreach (IndicatorBase buff in items.Where(s => s != null && s.Start.AddMilliseconds(s.Duration * 100) > DateTime.Now && !s.Disabled))
                {
                    List <BCardEntry> tmp = buff.DirectBuffs;
                    if (buff.Delay != -1 && buff.Start.AddMilliseconds(buff.Delay * 100) < DateTime.Now)
                    {
                        tmp = tmp.Concat(buff.DelayedBuffs).ToList();
                    }
                    if (!pvp)
                    {
                        tmp = tmp.Where(s => !s.PVPOnly).ToList();
                    }
                    foreach (BCardEntry entry in tmp.Where(s => s.Type.Equals(type) && s.SubType.Equals(subType) && s.AffectingOpposite.Equals(affectingOpposite)))
                    {
                        value1 += entry.Value1;
                        value2 += entry.Value2;
                    }
                }
            }

            // Not yet implemented

            #region Equipment

            //switch (type)
            //{
            //    #region Damage
            //    case BCard.Type.Damage:
            //        switch (subType)
            //        {
            //            case BCard.SubType.Increase:

            // break; case BCard.SubType.IncreaseMelee:

            // break; case BCard.SubType.IncreaseDistance:

            // break; case BCard.SubType.IncreaseMagic:

            // break; case BCard.SubType.IncreaseLevel:

            // break; case BCard.SubType.IncreasePercentage:

            // break; case BCard.SubType.IncreaseMeleePercentage:

            // break; case BCard.SubType.IncreaseDistancePercentage:

            // break; case BCard.SubType.IncreaseMagicPercentage:

            // break; case BCard.SubType.IncreasePercentageChance:

            // break; case BCard.SubType.IncreaseMeleePercentageChance:

            // break; case BCard.SubType.IncreaseDistancePercentageChance:

            // break; case BCard.SubType.IncreaseMagicPercentageChance:

            // break; default: Logger.Error(new NotImplementedException("BCard.SubType not
            // implemented for this BCard.Type!")); break; } break; #endregion

            // #region Defense case BCard.Type.Defense: switch (subType) { case BCard.SubType.Increase:

            // break; case BCard.SubType.IncreaseMelee:

            // break; case BCard.SubType.IncreaseDistance:

            // break; case BCard.SubType.IncreaseMagic:

            // break; case BCard.SubType.IncreaseLevel:

            // break; case BCard.SubType.IncreasePercentage:

            // break; case BCard.SubType.IncreaseMeleePercentage:

            // break; case BCard.SubType.IncreaseDistancePercentage:

            // break; case BCard.SubType.IncreaseMagicPercentage:

            // break; case BCard.SubType.IncreasePercentageChance:

            // break; case BCard.SubType.IncreaseMeleePercentageChance:

            // break; case BCard.SubType.IncreaseDistancePercentageChance:

            // break; case BCard.SubType.IncreaseMagicPercentageChance:

            // break; default: Logger.Error(new NotImplementedException("BCard.SubType not
            // implemented for this BCard.Type!")); break; } break; #endregion

            //    default:
            //        Logger.Error(new NotImplementedException("BCard.Type not implemented!"));
            //        break;
            //}

            #endregion

            return(new[] { value1, value2 });
        }
Ejemplo n.º 15
0
        protected override bool InternalInit(Selection selection, IDataProvider dataProvider)
        {
            _selection    = selection;
            _dataProvider = dataProvider;
            Series.ForEach(s => s.Values.Clear());

            if (Smoothing == MovingAverageType.EMA)
            {
                MA1 = new ExponentialMovingAverage
                {
                    Period = Period1,
                    Type   = Type
                };
                MA2 = new ExponentialMovingAverage
                {
                    Period = Period2,
                    Type   = Type
                };
            }
            else if (Smoothing == MovingAverageType.SMA)
            {
                MA1 = new SimpleMovingAverage
                {
                    Period = Period1,
                    Type   = Type
                };
                MA2 = new SimpleMovingAverage
                {
                    Period = Period2,
                    Type   = Type
                };
            }
            else if (Smoothing == MovingAverageType.SSMA)
            {
                MA1 = new SmoothedMovingAverage
                {
                    Period = Period1,
                    Type   = Type
                };
                MA2 = new SmoothedMovingAverage
                {
                    Period = Period2,
                    Type   = Type
                };
            }
            else if (Smoothing == MovingAverageType.LWMA)
            {
                MA1 = new LinearWeightedMovingAverage
                {
                    Period = Period1,
                    Type   = Type
                };
                MA2 = new LinearWeightedMovingAverage
                {
                    Period = Period2,
                    Type   = Type
                };
            }

            MA1.Init(selection, dataProvider);
            MA2.Init(selection, dataProvider);

            InternalCalculate();

            return(true);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Initialize the data and resolution you require for your strategy
        /// </summary>
        public override void Initialize()
        {
            //Initialize
            SetStartDate(2013, 1, 1);
            SetEndDate(2014, 12, 31);
            SetCash(25000);

            //Add as many securities as you like. All the data will be passed into the event handler:
            AddSecurity(SecurityType.Equity, _symbol, Resolution.Daily);

            //Add the Custom Data:
            AddData <Quandl>(_customSymbol);

            //Set up default Indicators, these indicators are defined on the Value property of incoming data (except ATR and AROON which use the full TradeBar object)
            _indicators = new Indicators
            {
                BB    = BB(_symbol, 20, 1, MovingAverageType.Simple, Resolution.Daily),
                RSI   = RSI(_symbol, 14, MovingAverageType.Simple, Resolution.Daily),
                ATR   = ATR(_symbol, 14, MovingAverageType.Simple, Resolution.Daily),
                EMA   = EMA(_symbol, 14, Resolution.Daily),
                SMA   = SMA(_symbol, 14, Resolution.Daily),
                MACD  = MACD(_symbol, 12, 26, 9, MovingAverageType.Simple, Resolution.Daily),
                AROON = AROON(_symbol, 20, Resolution.Daily),
                MOM   = MOM(_symbol, 20, Resolution.Daily),
                MOMP  = MOMP(_symbol, 20, Resolution.Daily),
                STD   = STD(_symbol, 20, Resolution.Daily),
                MIN   = MIN(_symbol, 14, Resolution.Daily), // by default if the symbol is a tradebar type then it will be the min of the low property
                MAX   = MAX(_symbol, 14, Resolution.Daily)  // by default if the symbol is a tradebar type then it will be the max of the high property
            };

            // Here we're going to define indicators using 'selector' functions. These 'selector' functions will define what data gets sent into the indicator
            //  These functions have a signature like the following: decimal Selector(BaseData baseData), and can be defined like: baseData => baseData.Value
            //  We'll define these 'selector' functions to select the Low value
            //
            //  For more information on 'anonymous functions' see: http://en.wikipedia.org/wiki/Anonymous_function
            //                                                     https://msdn.microsoft.com/en-us/library/bb397687.aspx
            //
            _selectorIndicators = new Indicators
            {
                BB   = BB(_symbol, 20, 1, MovingAverageType.Simple, Resolution.Daily, Field.Low),
                RSI  = RSI(_symbol, 14, MovingAverageType.Simple, Resolution.Daily, Field.Low),
                EMA  = EMA(_symbol, 14, Resolution.Daily, Field.Low),
                SMA  = SMA(_symbol, 14, Resolution.Daily, Field.Low),
                MACD = MACD(_symbol, 12, 26, 9, MovingAverageType.Simple, Resolution.Daily, Field.Low),
                MOM  = MOM(_symbol, 20, Resolution.Daily, Field.Low),
                MOMP = MOMP(_symbol, 20, Resolution.Daily, Field.Low),
                STD  = STD(_symbol, 20, Resolution.Daily, Field.Low),
                MIN  = MIN(_symbol, 14, Resolution.Daily, Field.High), // this will find the 14 day min of the high property
                MAX  = MAX(_symbol, 14, Resolution.Daily, Field.Low),  // this will find the 14 day max of the low property

                // ATR and AROON are special in that they accept a TradeBar instance instead of a decimal, we could easily project and/or transform the input TradeBar
                // before it gets sent to the ATR/AROON indicator, here we use a function that will multiply the input trade bar by a factor of two
                ATR   = ATR(_symbol, 14, MovingAverageType.Simple, Resolution.Daily, SelectorDoubleTradeBar),
                AROON = AROON(_symbol, 20, Resolution.Daily, SelectorDoubleTradeBar)
            };

            //Custom Data Indicator:
            _rsiCustom = RSI(_customSymbol, 14, MovingAverageType.Simple, Resolution.Daily);
            _minCustom = MIN(_customSymbol, 14, Resolution.Daily);
            _maxCustom = MAX(_customSymbol, 14, Resolution.Daily);

            // in addition to defining indicators on a single security, you can all define 'composite' indicators.
            // these are indicators that require multiple inputs. the most common of which is a ratio.
            // suppose we seek the ratio of BTC to SPY, we could write the following:
            var spyClose = Identity(_symbol);
            var btcClose = Identity(_customSymbol);

            // this will create a new indicator whose value is BTC/SPY
            _ratio = btcClose.Over(spyClose);
            // we can also easily plot our indicators each time they update using th PlotIndicator function
            PlotIndicator("Ratio", _ratio);
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Registers the consolidator to receive automatic updates as well as configures the indicator to receive updates
 /// from the consolidator.
 /// </summary>
 /// <param name="symbol">The symbol to register against</param>
 /// <param name="indicator">The indicator to receive data from the consolidator</param>
 /// <param name="resolution">The resolution at which to send data to the indicator, null to use the same resolution as the subscription</param>
 public void RegisterIndicator(Symbol symbol, IndicatorBase <TradeBar> indicator, Resolution?resolution = null)
 {
     RegisterIndicator <TradeBar>(symbol, indicator, resolution);
 }
 public void ComparesAgainstExternalData(IndicatorBase <TradeBar> indicator, string columnName, string testFileName)
 {
     TestHelper.TestIndicator(indicator, testFileName, columnName, Assertion);
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Creates and registers a new consolidator to receive automatic at the specified resolution as well as configures
 /// the indicator to receive updates from the consolidator.
 /// </summary>
 /// <param name="symbol">The symbol to register against</param>
 /// <param name="indicator">The indicator to receive data from the consolidator</param>
 /// <param name="resolution">The resolution at which to send data to the indicator, null to use the same resolution as the subscription</param>
 /// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to the Value property of BaseData (x => x.Value)</param>
 public void RegisterIndicator(string symbol, IndicatorBase <IndicatorDataPoint> indicator, Resolution?resolution = null, Func <BaseData, decimal> selector = null)
 {
     RegisterIndicator(symbol, indicator, ResolveConsolidator(symbol, resolution), selector ?? (x => x.Value));
 }
 private static void RunTestIndicator(IndicatorBase <IndicatorDataPoint> indicator)
 {
     TestHelper.TestIndicator(indicator, "spy_t3.txt", "T3_5", (ind, expected) => Assert.AreEqual(expected, (double)ind.Current.Value, 2e-2));
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Registers the consolidator to receive automatic updates as well as configures the indicator to receive updates
 /// from the consolidator.
 /// </summary>
 /// <param name="symbol">The symbol to register against</param>
 /// <param name="indicator">The indicator to receive data from the consolidator</param>
 /// <param name="resolution">The resolution at which to send data to the indicator, null to use the same resolution as the subscription</param>
 /// <param name="selector">Selects a value from the BaseData send into the indicator, if null defaults to a cast (x => (T)x)</param>
 public void RegisterIndicator <T>(string symbol, IndicatorBase <T> indicator, Resolution?resolution, Func <BaseData, T> selector)
     where T : BaseData
 {
     RegisterIndicator(symbol, indicator, ResolveConsolidator(symbol, resolution), selector);
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Compare the specified indicator against external data using the spy_with_indicators.txt file.
 /// The 'Close' column will be fed to the indicator as input
 /// </summary>
 /// <param name="indicator">The indicator under test</param>
 /// <param name="targetColumn">The column with the correct answers</param>
 /// <param name="epsilon">The maximum delta between expected and actual</param>
 public static void TestIndicator(IndicatorBase <IndicatorDataPoint> indicator, string targetColumn, double epsilon = 1e-3)
 {
     TestIndicator(indicator, "spy_with_indicators.txt", targetColumn, (i, expected) => Assert.AreEqual(expected, (double)i.Current.Value, epsilon));
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Compare the specified indicator against external data using the specificied comma delimited text file.
 /// The 'Close' column will be fed to the indicator as input
 /// </summary>
 /// <param name="indicator">The indicator under test</param>
 /// <param name="externalDataFilename"></param>
 /// <param name="targetColumn">The column with the correct answers</param>
 /// <param name="epsilon">The maximum delta between expected and actual</param>
 public static void TestIndicator(IndicatorBase <TradeBar> indicator, string externalDataFilename, string targetColumn, double epsilon = 1e-3)
 {
     TestIndicator(indicator, externalDataFilename, targetColumn, (i, expected) => Assert.AreEqual(expected, (double)i.Current.Value, epsilon, "Failed at " + i.Current.Time.ToString("o")));
 }
Ejemplo n.º 24
0
        /// <summary>
        /// Gets the historical data of an indicator for the specified symbol. The exact number of bars will be returned.
        /// The symbol must exist in the Securities collection.
        /// </summary>
        /// <param name="indicator">Indicator</param>
        /// <param name="symbol">The symbol to retrieve historical data for</param>
        /// <param name="start">The start time in the algorithm's time zone</param>
        /// <param name="end">The end time in the algorithm's time zone</param>
        /// <param name="resolution">The resolution to request</param>
        /// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to the Value property of BaseData (x => x.Value)</param>
        /// <returns>pandas.DataFrame of historical data of an indicator</returns>
        public PyObject Indicator(IndicatorBase <IndicatorDataPoint> indicator, Symbol symbol, DateTime start, DateTime end, Resolution?resolution = null, Func <IBaseData, decimal> selector = null)
        {
            var history = History <IBaseData>(symbol, start, end, resolution);

            return(Indicator(indicator, history, selector));
        }
Ejemplo n.º 25
0
 /// <summary>
 /// Registers the consolidator to receive automatic updates as well as configures the indicator to receive updates
 /// from the consolidator.
 /// </summary>
 /// <param name="symbol">The symbol to register against</param>
 /// <param name="indicator">The indicator to receive data from the consolidator</param>
 /// <param name="resolution">The resolution at which to send data to the indicator, null to use the same resolution as the subscription</param>
 /// <param name="selector">Selects a value from the BaseData send into the indicator, if null defaults to a cast (x => (T)x)</param>
 public void RegisterIndicator(Symbol symbol, IndicatorBase <IBaseDataBar> indicator, Resolution?resolution, Func <IBaseData, IBaseDataBar> selector)
 {
     RegisterIndicator <IBaseDataBar>(symbol, indicator, resolution, selector);
 }
Ejemplo n.º 26
0
 private static void RunTestIndicator(IndicatorBase<IndicatorDataPoint> indicator, string field, decimal variance)
 {
     TestHelper.TestIndicator(indicator, "spy_swiss.txt", field, (actual, expected) => { AssertResult(expected, actual.Current.Value, variance); });
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Registers the consolidator to receive automatic updates as well as configures the indicator to receive updates
 /// from the consolidator.
 /// </summary>
 /// <param name="symbol">The symbol to register against</param>
 /// <param name="indicator">The indicator to receive data from the consolidator</param>
 /// <param name="resolution">The resolution at which to send data to the indicator, null to use the same resolution as the subscription</param>
 /// <param name="selector">Selects a value from the BaseData send into the indicator, if null defaults to a cast (x => (T)x)</param>
 public void RegisterIndicator(Symbol symbol, IndicatorBase <TradeBar> indicator, TimeSpan?resolution, Func <IBaseData, TradeBar> selector)
 {
     RegisterIndicator <TradeBar>(symbol, indicator, resolution, selector);
 }
Ejemplo n.º 28
0
 private void RunTestIndicator(IndicatorBase indicator, string field, double variance)
 {
     TestHelper.TestIndicator(indicator, TestFileName, field, (actual, expected) => { AssertResult(expected, actual.Current.Value, variance); });
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Registers the consolidator to receive automatic updates as well as configures the indicator to receive updates
 /// from the consolidator.
 /// </summary>
 /// <param name="symbol">The symbol to register against</param>
 /// <param name="indicator">The indicator to receive data from the consolidator</param>
 /// <param name="consolidator">The consolidator to receive raw subscription data</param>
 /// <param name="selector">Selects a value from the BaseData send into the indicator, if null defaults to a cast (x => (T)x)</param>
 public void RegisterIndicator(Symbol symbol, IndicatorBase <TradeBar> indicator, IDataConsolidator consolidator, Func <IBaseData, TradeBar> selector)
 {
     RegisterIndicator <TradeBar>(symbol, indicator, consolidator, selector);
 }
Ejemplo n.º 30
0
 public void ComparesAgainstExternalData(IndicatorBase<TradeBar> indicator, string columnName, string testFileName)
 {
     TestHelper.TestIndicator(indicator, testFileName, columnName, Assertion);
 }
Ejemplo n.º 31
0
 /// <summary>
 /// Creates and registers a new consolidator to receive automatic at the specified resolution as well as configures
 /// the indicator to receive updates from the consolidator.
 /// </summary>
 /// <param name="symbol">The symbol to register against</param>
 /// <param name="indicator">The indicator to receive data from the consolidator</param>
 /// <param name="resolution">The resolution at which to send data to the indicator, null to use the same resolution as the subscription</param>
 public void RegisterIndicator(string symbol, IndicatorBase <IndicatorDataPoint> indicator, Resolution?resolution = null)
 {
     RegisterIndicator(symbol, indicator, ResolveConsolidator(symbol, resolution), x => x.Value);
 }
Ejemplo n.º 32
0
        /// <summary>
        /// Gets the historical data of a bar indicator for the specified symbol. The exact number of bars will be returned.
        /// The symbol must exist in the Securities collection.
        /// </summary>
        /// <param name="indicator">Indicator</param>
        /// <param name="symbol">The symbol to retrieve historical data for</param>
        /// <param name="span">The span over which to retrieve recent historical data</param>
        /// <param name="resolution">The resolution to request</param>
        /// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to the Value property of BaseData (x => x.Value)</param>
        /// <returns>pandas.DataFrame of historical data of a bar indicator</returns>
        public PyObject Indicator(IndicatorBase <IBaseDataBar> indicator, Symbol symbol, TimeSpan span, Resolution?resolution = null, Func <IBaseData, IBaseDataBar> selector = null)
        {
            var history = History(new[] { symbol }, span, resolution);

            return(Indicator(indicator, history, selector));
        }
Ejemplo n.º 33
0
        /// <summary>
        /// Gets the historical data of an indicator for the specified symbol. The exact number of bars will be returned.
        /// The symbol must exist in the Securities collection.
        /// </summary>
        /// <param name="symbol">The symbol to retrieve historical data for</param>
        /// <param name="periods">The number of bars to request</param>
        /// <param name="resolution">The resolution to request</param>
        /// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to the Value property of BaseData (x => x.Value)</param>
        /// <returns>pandas.DataFrame of historical data of an indicator</returns>
        public PyObject Indicator(IndicatorBase <IndicatorDataPoint> indicator, Symbol symbol, int period, Resolution?resolution = null, Func <IBaseData, decimal> selector = null)
        {
            var history = History(new[] { symbol }, period, resolution);

            return(Indicator(indicator, history, selector));
        }
Ejemplo n.º 34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DonchianChannel"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="upperPeriod">The period for the upper channel.</param>
 /// <param name="lowerPeriod">The period for the lower channel</param>
 public DonchianChannel(string name, int upperPeriod, int lowerPeriod)
     : base(name)
 {
     UpperBand = new Maximum(name + "_UpperBand", upperPeriod);
     LowerBand = new Minimum(name + "_LowerBand", lowerPeriod);
 }
Ejemplo n.º 35
0
 /// <summary>
 /// Возможность удаления индикатора (имеются ли зависимости от удаляемого объекта)
 /// </summary>
 /// <param name="indic">Индикатор</param>
 /// <returns>true - удаление возможно</returns>
 public bool CanRemoveIndicator(IndicatorBase indic)
 {
     return(!_depManager.AnyDependsFrom(indic));
 }
Ejemplo n.º 36
0
 /// <summary>
 /// Registers the consolidator to receive automatic updates as well as configures the indicator to receive updates
 /// from the consolidator.
 /// </summary>
 /// <param name="symbol">The symbol to register against</param>
 /// <param name="indicator">The indicator to receive data from the consolidator</param>
 /// <param name="resolution">The resolution at which to send data to the indicator, null to use the same resolution as the subscription</param>
 public void RegisterIndicator <T>(string symbol, IndicatorBase <T> indicator, Resolution?resolution = null)
     where T : BaseData
 {
     RegisterIndicator(symbol, indicator, ResolveConsolidator(symbol, resolution));
 }
Ejemplo n.º 37
0
            public SyncedDataSeries(IndicatorBase indicator, int primaryInstrument, int syncedInstrument, ISeries <double> dataArray, IndicatorBase syncedIndicator, MaximumBarsLookBack maxLookback) : base(syncedIndicator, maxLookback)
            {
                IndBase                   = indicator;
                PrimaryInstrument         = primaryInstrument;
                SyncedInstrument          = syncedInstrument;
                SynchronizedBarCount      = 0;
                SynchronizedBarCountToday = 0;
                DataArray                 = dataArray;
                DataStarted               = false;
//				lastSyncWasToUnclosedBar = false;
                LastDataTime = DateTime.MinValue;
                primaryInstrumentCurrentBarTime = DateTime.MinValue;
                syncedInstrumentCurrentBarTime  = DateTime.MinValue;
                primaryInstrumentCurrentBar     = -1;
                syncedInstrumentCurrentBar      = -1;

                switch (IndBase.BarsPeriods[PrimaryInstrument].BarsPeriodType)
                {
                case BarsPeriodType.Day:
                case BarsPeriodType.Week:
                case BarsPeriodType.Month:
                case BarsPeriodType.Year:
                    dailyBars = true;
                    break;

                case BarsPeriodType.Minute:
                case BarsPeriodType.Second:
                {
                    dailyBars = false;
                    break;
                }

                default:
                    throw new ArgumentException("SyncedDataSeries: Instrument Period must be time-based (Minute,Day,Week,Month,Year,or Second).");
                    break;
                }
                if (IndBase.BarsPeriods[PrimaryInstrument].BarsPeriodType != IndBase.BarsPeriods[SyncedInstrument].BarsPeriodType)
                {
                    throw new ArgumentException("SyncedDataSeries: Primary and Synced Intruments must both have the same Period Type.");
                }
                if (IndBase.BarsPeriods[PrimaryInstrument].Value != IndBase.BarsPeriods[SyncedInstrument].Value)
                {
                    throw new ArgumentException("SyncedDataSeries: Primary and Synced Intruments must both have the same Period Value.");
                }

                Synced = new Series <bool>(syncedIndicator);                    // Not syncing to primary instrument of instantiating indicator;
                // So create a new BoolSeries synced to the master instrument
            }
Ejemplo n.º 38
0
 /// <summary>
 /// Simplified version of QCAlgorithm.RegisterIndicator
 /// </summary>
 /// <param name="indicator">The indicator to receive data from the consolidator</param>
 /// <param name="consolidator">The consolidator to receive raw subscription data</param>
 public void RegisterIndicator(IndicatorBase<IndicatorDataPoint> indicator, IDataConsolidator consolidator)
 {
     consolidator.DataConsolidated += (sender, consolidated) =>
     {
         indicator.Update(consolidated.EndTime, consolidated.Value);
     };
 }
Ejemplo n.º 39
0
 public SyncedDataSeries(IndicatorBase indicator, int primaryInstrument, int syncedInstrument, ISeries <double> dataArray, IndicatorBase syncedIndicator) :
     this(indicator, primaryInstrument, syncedInstrument, dataArray, syncedIndicator, indicator.MaximumBarsLookBack)
 {
 }
 /// <summary>
 /// Initializes a new instance of the SimpleMovingAverage class with the specified name and period
 /// </summary>
 /// <param name="name">The name of this indicator</param>
 /// <param name="period">The period of the SMA</param>
 public SimpleMovingAverage(string name, int period)
     : base(name, period)
 {
     RollingSum = new Sum(name + "_Sum", period);
 }
Ejemplo n.º 41
0
    private WtSchemeBuilder addBuilder(IndicatorBase indic)
    {
      UltraTab ut = ultraTabControl1.Tabs.Add();
      ut.Text = indic.ToString();
      ut.Tag = indic;

      WtSchemeBuilder builder = new WtSchemeBuilder();
      builder.Dock = DockStyle.Fill;

      ut.TabPage.Controls.Add(builder);

      builder.Create(indic);

      return builder;
    }
Ejemplo n.º 42
0
 /// <summary>
 /// Gets the historical data of a bar indicator for the specified symbol. The exact number of bars will be returned. 
 /// The symbol must exist in the Securities collection.
 /// </summary>
 /// <param name="symbol">The symbol to retrieve historical data for</param>
 /// <param name="periods">The number of bars to request</param>
 /// <param name="resolution">The resolution to request</param>
 /// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to the Value property of BaseData (x => x.Value)</param>
 /// <returns>pandas.DataFrame of historical data of a bar indicator</returns>
 public PyObject Indicator(IndicatorBase<TradeBar> indicator, Symbol symbol, int period, Resolution? resolution = null, Func<IBaseData, TradeBar> selector = null)
 {
     var history = History<TradeBar>(symbol, period, resolution);
     return Indicator(indicator, history, selector);
 }
Ejemplo n.º 43
0
 protected void RegisterIndicator(Symbol symbol, IndicatorBase <IndicatorDataPoint> indicator, TimeSpan?resolution = null, Func <IBaseData, decimal> selector = null)
 {
     Algo.RegisterIndicator(symbol, indicator, resolution);
 }
Ejemplo n.º 44
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AverageDirectionalIndex"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="period">The period.</param>
        public AverageDirectionalIndex(string name, int period)
            : base(name)
        {
            _period = period;

            TrueRange = new FunctionalIndicator<IBaseDataBar>(name + "_TrueRange",
                currentBar =>
                {
                    var value = ComputeTrueRange(currentBar);
                    return value;
                },
                isReady => _previousInput != null
                );

            DirectionalMovementPlus = new FunctionalIndicator<IBaseDataBar>(name + "_PositiveDirectionalMovement",
                currentBar =>
                {
                    var value = ComputePositiveDirectionalMovement(currentBar);
                    return value;
                },
                isReady => _previousInput != null
                );


            DirectionalMovementMinus = new FunctionalIndicator<IBaseDataBar>(name + "_NegativeDirectionalMovement",
                currentBar =>
                {
                    var value = ComputeNegativeDirectionalMovement(currentBar);
                    return value;
                },
                isReady => _previousInput != null
                );

            PositiveDirectionalIndex = new FunctionalIndicator<IndicatorDataPoint>(name + "_PositiveDirectionalIndex",
                input => ComputePositiveDirectionalIndex(),
                positiveDirectionalIndex => DirectionalMovementPlus.IsReady && TrueRange.IsReady,
                () =>
                {
                    DirectionalMovementPlus.Reset();
                    TrueRange.Reset();
                }
                );

            NegativeDirectionalIndex = new FunctionalIndicator<IndicatorDataPoint>(name + "_NegativeDirectionalIndex",
                input => ComputeNegativeDirectionalIndex(),
                negativeDirectionalIndex => DirectionalMovementMinus.IsReady && TrueRange.IsReady,
                () =>
                {
                    DirectionalMovementMinus.Reset();
                    TrueRange.Reset();
                }
                );

            SmoothedTrueRange = new FunctionalIndicator<IndicatorDataPoint>(name + "_SmoothedTrueRange",
                    currentBar => ComputeSmoothedTrueRange(period),
                    isReady => _previousInput != null
                );


            SmoothedDirectionalMovementPlus = new FunctionalIndicator<IndicatorDataPoint>(name + "_SmoothedDirectionalMovementPlus",
                    currentBar => ComputeSmoothedDirectionalMovementPlus(period),
                    isReady => _previousInput != null
                );

            SmoothedDirectionalMovementMinus = new FunctionalIndicator<IndicatorDataPoint>(name + "_SmoothedDirectionalMovementMinus",
                    currentBar => ComputeSmoothedDirectionalMovementMinus(period),
                    isReady => _previousInput != null
                );
        }
Ejemplo n.º 45
0
 /// <summary>
 /// Gets the historical data of an indicator for the specified symbol. The exact number of bars will be returned. 
 /// The symbol must exist in the Securities collection.
 /// </summary>
 /// <param name="indicator">Indicator</param>
 /// <param name="symbol">The symbol to retrieve historical data for</param>
 /// <param name="span">The span over which to retrieve recent historical data</param>
 /// <param name="resolution">The resolution to request</param>
 /// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to the Value property of BaseData (x => x.Value)</param>
 /// <returns>pandas.DataFrame of historical data of an indicator</returns>
 public PyObject Indicator(IndicatorBase<IndicatorDataPoint> indicator, Symbol symbol, TimeSpan span, Resolution? resolution = null, Func<IBaseData, decimal> selector = null)
 {
     var history = base.History<IBaseData>(symbol, span, resolution);
     return Indicator(indicator, history, selector);
 }
Ejemplo n.º 46
0
        /// <summary>
        /// Initialize the data and resolution you require for your strategy
        /// </summary>
        public override void Initialize()
        {
            //Initialize
            SetStartDate(2013, 1, 1);
            SetEndDate(2014, 12, 31);
            SetCash(25000);

            //Add as many securities as you like. All the data will be passed into the event handler:
            AddSecurity(SecurityType.Equity, _symbol, Resolution.Minute);

            //Add the Custom Data:
            AddData<Bitcoin>("BTC");

            //Set up default Indicators, these indicators are defined on the Value property of incoming data (except ATR and AROON which use the full TradeBar object)
            _indicators = new Indicators
            {
                BB = BB(_symbol, 20, 1, MovingAverageType.Simple, Resolution.Daily),
                RSI = RSI(_symbol, 14, MovingAverageType.Simple, Resolution.Daily),
                ATR = ATR(_symbol, 14, MovingAverageType.Simple, Resolution.Daily),
                EMA = EMA(_symbol, 14, Resolution.Daily),
                SMA = SMA(_symbol, 14, Resolution.Daily),
                MACD = MACD(_symbol, 12, 26, 9, MovingAverageType.Simple, Resolution.Daily),
                AROON = AROON(_symbol, 20, Resolution.Daily),
                MOM = MOM(_symbol, 20, Resolution.Daily),
                MOMP = MOMP(_symbol, 20, Resolution.Daily),
                STD = STD(_symbol, 20, Resolution.Daily),
                MIN = MIN(_symbol, 14, Resolution.Daily), // by default if the symbol is a tradebar type then it will be the min of the low property
                MAX = MAX(_symbol, 14, Resolution.Daily)  // by default if the symbol is a tradebar type then it will be the max of the high property
            };

            // Here we're going to define indicators using 'selector' functions. These 'selector' functions will define what data gets sent into the indicator
            //  These functions have a signature like the following: decimal Selector(BaseData baseData), and can be defined like: baseData => baseData.Value
            //  We'll define these 'selector' functions to select the Low value
            //
            //  For more information on 'anonymous functions' see: http://en.wikipedia.org/wiki/Anonymous_function
            //                                                     https://msdn.microsoft.com/en-us/library/bb397687.aspx
            //
            _selectorIndicators = new Indicators
            {
                BB = BB(_symbol, 20, 1, MovingAverageType.Simple, Resolution.Daily, Field.Low),
                RSI = RSI(_symbol, 14, MovingAverageType.Simple, Resolution.Daily, Field.Low),
                EMA = EMA(_symbol, 14, Resolution.Daily, Field.Low),
                SMA = SMA(_symbol, 14, Resolution.Daily, Field.Low),
                MACD = MACD(_symbol, 12, 26, 9, MovingAverageType.Simple, Resolution.Daily, Field.Low),
                MOM = MOM(_symbol, 20, Resolution.Daily, Field.Low),
                MOMP = MOMP(_symbol, 20, Resolution.Daily, Field.Low),
                STD = STD(_symbol, 20, Resolution.Daily, Field.Low),
                MIN = MIN(_symbol, 14, Resolution.Daily, Field.High), // this will find the 14 day min of the high property
                MAX = MAX(_symbol, 14, Resolution.Daily, Field.Low),  // this will find the 14 day max of the low property

                // ATR and AROON are special in that they accept a TradeBar instance instead of a decimal, we could easily project and/or transform the input TradeBar
                // before it gets sent to the ATR/AROON indicator, here we use a function that will multiply the input trade bar by a factor of two
                ATR = ATR(_symbol, 14, MovingAverageType.Simple, Resolution.Daily, SelectorDoubleTradeBar),
                AROON = AROON(_symbol, 20, Resolution.Daily, SelectorDoubleTradeBar)
            };

            //Custom Data Indicator:
            _rsiCustom = RSI(_customSymbol, 14, MovingAverageType.Simple, Resolution.Daily);
            _minCustom = MIN(_customSymbol, 14, Resolution.Daily);
            _maxCustom = MAX(_customSymbol, 14, Resolution.Daily);

            // in addition to defining indicators on a single security, you can all define 'composite' indicators.
            // these are indicators that require multiple inputs. the most common of which is a ratio.
            // suppose we seek the ratio of BTC to SPY, we could write the following:
            var spyClose = Identity(_symbol);
            var btcClose = Identity(_customSymbol);
            // this will create a new indicator whose value is BTC/SPY
            _ratio = btcClose.Over(spyClose);
            // we can also easily plot our indicators each time they update using th PlotIndicator function
            PlotIndicator("Ratio", _ratio);
        }
Ejemplo n.º 47
0
 /// <summary>
 /// Gets the historical data of a bar indicator for the specified symbol. The exact number of bars will be returned. 
 /// The symbol must exist in the Securities collection.
 /// </summary>
 /// <param name="indicator">Indicator</param>
 /// <param name="symbol">The symbol to retrieve historical data for</param>
 /// <param name="span">The span over which to retrieve recent historical data</param>
 /// <param name="resolution">The resolution to request</param>
 /// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to the Value property of BaseData (x => x.Value)</param>
 /// <returns>pandas.DataFrame of historical data of a bar indicator</returns>
 public PyObject Indicator(IndicatorBase<TradeBar> indicator, Symbol symbol, TimeSpan span, Resolution? resolution = null, Func<IBaseData, TradeBar> selector = null)
 {
     var history = base.History<TradeBar>(symbol, span, resolution);
     return Indicator(indicator, history, selector);
 }
Ejemplo n.º 48
0
        private static IEnumerable<CategoricalDataPoint> GetDataPoints(IndicatorBase indicator, object xCategory)
        {
            yield return GetDataPoint(indicator.DataPoints, xCategory);

            var bollinger = indicator as BollingerBandsIndicator;
            if (bollinger != null)
            {
                yield return GetDataPoint(bollinger.LowerBandDataPoints, xCategory);
            }
        }
Ejemplo n.º 49
0
 /// <summary>
 /// Gets the historical data of a bar indicator for the specified symbol. The exact number of bars will be returned. 
 /// The symbol must exist in the Securities collection.
 /// </summary>
 /// <param name="indicator">Indicator</param>
 /// <param name="symbol">The symbol to retrieve historical data for</param>
 /// <param name="start">The start time in the algorithm's time zone</param>
 /// <param name="end">The end time in the algorithm's time zone</param>
 /// <param name="resolution">The resolution to request</param>
 /// <param name="selector">Selects a value from the BaseData to send into the indicator, if null defaults to the Value property of BaseData (x => x.Value)</param>
 /// <returns>pandas.DataFrame of historical data of a bar indicator</returns>
 public PyObject Indicator(IndicatorBase<IBaseDataBar> indicator, Symbol symbol, DateTime start, DateTime end, Resolution? resolution = null, Func<IBaseData, IBaseDataBar> selector = null)
 {
     var history = History<IBaseDataBar>(symbol, start, end, resolution);
     return Indicator(indicator, history, selector);
 }
 private static void RunTestIndicator(IndicatorBase <IndicatorDataPoint> indicator, string field, decimal variance)
 {
     TestHelper.TestIndicator(indicator, "spy_swiss.txt", field, (actual, expected) => { AssertResult(expected, actual.Current.Value, variance); });
 }
Ejemplo n.º 51
0
    internal void Create(IndicatorBase indic_)
    {
      m_indic = indic_;

      //addWtScheme();
    }