Exemple #1
0
        public static double Value(TimeSeries input, int index, int length, double shift, BarData option)
        {
            if (index < length - 1 + input.FirstIndex)
            {
                return(double.NaN);
            }
            double num = SMA.Value(input, index, length, option);

            return(num + num * (shift / 100.0));
        }
Exemple #2
0
 public static double Value(TimeSeries input, int index, int length1, int length2, BarData option)
 {
     if (index >= length1 - 1 + input.FirstIndex && index >= length2 - 1 + input.FirstIndex)
     {
         return(SMA.Value(input, index, length1, option) - SMA.Value(input, index, length2, option));
     }
     else
     {
         return(double.NaN);
     }
 }
Exemple #3
0
 public static double Value(TimeSeries input, int index, int length, double k, BarData option)
 {
     if (index >= length - 1 + input.FirstIndex)
     {
         return(SMA.Value(input, index, length, option) + k * SMD.Value(input, index, length, option));
     }
     else
     {
         return(double.NaN);
     }
 }
Exemple #4
0
        public static double Value(TimeSeries input, int index, int length1, int length2)
        {
            if (index < length1 - 1 + input.FirstIndex || index < length2 - 1 + input.FirstIndex)
            {
                return(double.NaN);
            }
            DoubleSeries doubleSeries = new DoubleSeries();

            for (int index1 = index; index1 > index - Math.Max(length1, length2); --index1)
            {
                doubleSeries.Add(input.GetDateTime(index1), input[index1, BarData.Volume]);
            }
            return(SMA.Value((TimeSeries)doubleSeries, length1 - 1, length1, BarData.Close) - SMA.Value((TimeSeries)doubleSeries, length2 - 1, length2, BarData.Close));
        }
Exemple #5
0
        public static double Value(TimeSeries input, int index, int length, BarData option)
        {
            if (index < length - 1 + input.FirstIndex)
            {
                return(double.NaN);
            }
            double num1 = 0.0;
            double num2 = SMA.Value(input, index, length, option);

            for (int index1 = index; index1 > index - length; --index1)
            {
                num1 += (num2 - input[index1, option]) * (num2 - input[index1, option]);
            }
            return(num1 / (double)length);
        }
Exemple #6
0
        public static double Value(TimeSeries input, int index, int length)
        {
            if (index < length + input.FirstIndex)
            {
                return(double.NaN);
            }
            double num1 = 0.0;

            for (int index1 = index - length + 1; index1 <= index; ++index1)
            {
                num1 += TR.Value(input, index1);
            }
            double num2 = num1 / (double)length;

            return(SMA.Value(input, index, length, BarData.Typical) - num2);
        }
 public ChartColorManagerForm()
 {
     this.InitializeComponent();
     this.colorEditor.Init();
     this.AddProperty("ChartBackColor", "Back Color", this.chart.ChartBackColor);
     this.AddProperty("CanvasColor", "Fore Color", this.chart.CanvasColor);
     this.AddProperty("BorderColor", "Border", this.chart.BorderColor);
     this.AddProperty("SplitterColor", "Splitter", this.chart.SplitterColor);
     this.AddProperty("CandleUpColor", "Candle Up", this.chart.CandleUpColor);
     this.AddProperty("CandleDownColor", "Candle Down", this.chart.CandleDownColor);
     this.AddProperty("DefaultLineColor", "Line", this.chart.DefaultLineColor);
     this.AddProperty("VolumeColor", "Volume", this.chart.VolumeColor);
     this.AddProperty("DateTipRectangleColor", "DateTime Tip Area", this.chart.DateTipRectangleColor);
     this.AddProperty("DateTipTextColor", "DateTime Tip Text", this.chart.DateTipTextColor);
     this.AddProperty("ValTipRectangleColor", "Value Tip Area", this.chart.ValTipRectangleColor);
     this.AddProperty("ValTipTextColor", "Value Text Area", this.chart.ValTipTextColor);
     this.AddProperty("CrossColor", "Cross Color", this.chart.CrossColor);
     this.AddProperty("BottomAxisLabelColor", "Bottom Axis Label", this.chart.BottomAxisLabelColor);
     this.AddProperty("BottomAxisGridColor", "Bottom Axis Grid", this.chart.BottomAxisGridColor);
     this.AddProperty("RightAxisGridColor", "Right Axis Grid", this.chart.RightAxisGridColor);
     this.AddProperty("RightAxisTextColor", "Right Axis Text", this.chart.RightAxisTextColor);
     this.AddProperty("RightAxisMajorTicksColor", "Right Axis Major Ticks", this.chart.RightAxisMajorTicksColor);
     this.AddProperty("RightAxisMinorTicksColor", "Right Axis Minor Ticks", this.chart.RightAxisMinorTicksColor);
     this.AddProperty("ItemTextColor", "Transaction Text", this.chart.ItemTextColor);
     this.AddProperty("SelectedItemTextColor", "Selected Transaction Text", this.chart.SelectedItemTextColor);
     this.AddProperty("SelectedTransactionHighlightColor", "Selected Transaction Highlight", this.chart.SelectedTransactionHighlightColor);
     this.ltvColorProperties.Items[0].Selected = true;
     BarSeries barSeries = this.GenerateSeries();
     this.chart.Reset();
     this.chart.SetMainSeries((DoubleSeries)barSeries, true);
     this.chart.AddPad();
     SMA sma = new SMA((TimeSeries)barSeries, 14);
     sma.Name = "Line";
     this.chart.DrawDefaultColoredSeries((DoubleSeries)sma, 2, (SimpleDSStyle)0, SmoothingMode.AntiAlias);
     Instrument instrument = Activator.CreateInstance(typeof(Instrument), true) as Instrument;
     instrument.Symbol = "Symbol";
     Transaction transaction1 = new Transaction(((TimeSeries)barSeries).GetDateTime(barSeries.Count - 5), Side.Buy, 100.0, instrument, barSeries[barSeries.Count - 5].Low);
     Transaction transaction2 = new Transaction(((TimeSeries)barSeries).GetDateTime(barSeries.Count - 20), Side.Sell, 100.0, instrument, barSeries[barSeries.Count - 20].High);
     this.chart.DrawTransaction(transaction1, 0);
     this.chart.DrawTransaction(transaction2, 0);
     this.chart.EnsureVisible(transaction1);
     foreach (ChartColorTemplate template in Global.ChartManager.ColorTemplates.All.Values)
         this.ltvTemplates.Items.Add((ListViewItem)new ChartColorTemplateViewItem(template));
     if (this.ltvTemplates.Items.Count <= 0)
         return;
     this.ltvTemplates.Items[0].Selected = true;
 }
Exemple #8
0
 public static double Value(DoubleSeries input, int index, int length)
 {
     return(SMA.Value(input, index, length, BarData.Close));
 }