Stock

using System.Collections.Generic;
using System.Runtime.Serialization;
using TigerTrade.Chart.Indicators.Common;
 
namespace TigerTrade.Chart.Indicators.Custom.Sources
{
    [DataContract(Name = "StockSourceDemo",
        Namespace = "http://schemas.datacontract.org/2004/07/TigerTrade.Chart.Indicators.Custom.Sources")]
    [IndicatorSource("StockDemo", Type = typeof(StockSourceDemo))]
    public sealed class StockSourceDemo : IndicatorSourceBase
    {
        public StockSourceDemo()
        {
            SelectedSeries = "Close";
        }
 
        public override IEnumerable<string> GetSeriesList()
        {
            return new List<string>
            {
                "Open",
                "High",
                "Low",
                "Close",
                "Median",
                "Typical",
                "POC",
                "Trades",
                "Volume",
                "Bid",
                "Ask",
                "Delta",
                "OpenInterest",
                "OIChange",
                "OIBidChange",
                "OIAskChange"
            };
        }
 
        public override double[] GetSeries(IndicatorsHelper helper)
        {
            switch (SelectedSeries)
            {
                case "Open":
 
                    return helper.Open;
 
                case "High":
 
                    return helper.High;
 
                case "Low":
 
                    return helper.Low;
 
                case "Close":
 
                    return helper.Close;
 
                case "Median":
 
                    return helper.MedianPrice();
 
                case "Typical":
 
                    return helper.TypicalPrice();
 
                case "POC":
 
                    return helper.Poc;
 
                case "Trades":
 
                    return helper.Trades;
 
                case "Volume":
 
                    return helper.Volume;
 
                case "Bid":
 
                    return helper.Bid;
 
                case "Ask":
 
                    return helper.Ask;
 
                case "Delta":
 
                    return helper.Delta;
 
                case "OpenInterest":
 
                    return helper.OpenPos;
 
                case "OIChange":
 
                    return helper.OpenPosChg;
 
                case "OIAskChange":
 
                    return helper.OpenPosAskChg;
 
                case "OIBidChange":
 
                    return helper.OpenPosBidChg;
            }
 
            return null;
        }
 
        public override void CopySettings(IndicatorSourceBase source)
        {
            if (source is StockSourceDemo s)
            {
                SelectedSeries = s.SelectedSeries;
            }
        }
 
        public override string ToString()
        {
            return !string.IsNullOrEmpty(SelectedSeries) ? SelectedSeries : "None";
        }
    }
}

Last updated