private void Plot_MouseDown(object sender, OxyMouseDownEventArgs e) { if (e.ChangedButton == OxyMouseButton.Left) { MouseMoveState = MoveState.None; } if (!CanCreateRanges || e.ChangedButton != OxyMouseButton.Left || SetRanges.Count == RangeLimit) { return; } _clickStartX = PlotSeries.InverseTransform(e.Position).X; if (Ranges.Count <= SetRanges.Count) { _activeRange = CreateRange(); } else { _activeRange = Ranges[SetRanges.Count]; } SetRanges.Add(_activeRange); _activeRange.MinimumX = _clickStartX; _activeRange.MaximumX = _clickStartX; Model.InvalidatePlot(false); e.Handled = true; MouseMoveState = MoveState.CreatingRange; }
/// <summary> /// Save the indicator data in a serialization friendly way. /// </summary> public override void PrepareForSerialization() { base.PrepareForSerialization(); // Add the indicator for plotting PlotSeries plot38 = new PlotSeries("line"); PlotSeries plot50 = new PlotSeries("line"); PlotSeries plot62 = new PlotSeries("line"); ChartPlots["38% Zone"] = plot38; ChartPlots["50% Zone"] = plot50; ChartPlots["62% Zone"] = plot62; for (int i = 0; i < Data.Dates.Count; i++) { long ticks = UtilityMethods.UnixTicks(Data.Dates[i]); plot38.PlotData.Add(new List <object>() { ticks, Zone38[i] > 0.0 ? (object)Math.Round(Zone38[i], 2) : null }); plot50.PlotData.Add(new List <object>() { ticks, Zone50[i] > 0.0 ? (object)Math.Round(Zone50[i], 2) : null }); plot62.PlotData.Add(new List <object>() { ticks, Zone62[i] > 0.0 ? (object)Math.Round(Zone62[i], 2) : null }); } }
/// <summary> /// Adds data to the created plots for the indicator at the current bar. /// </summary> /// <param name="currentBar"></param> public override void AddToPlots(int currentBar) { base.AddToPlots(currentBar); long ticks = UtilityMethods.UnixTicks(Data.Dates[currentBar]); PlotSeries line = (PlotSeries)ChartPlots[ToString() + " Midline"]; line.PlotData.Add(new List <object>() { ticks, Math.Round(Midline[currentBar], 2) }); line = (PlotSeries)ChartPlots[ToString() + " Upper"]; line.PlotData.Add(new List <object>() { ticks, Math.Round(Upper[currentBar], 2) }); line = (PlotSeries)ChartPlots[ToString() + " Lower"]; line.PlotData.Add(new List <object>() { ticks, Math.Round(Lower[currentBar], 2) }); }
/// <summary> /// Save the indicator data in a serialization friendly way. /// </summary> public override void PrepareForSerialization() { base.PrepareForSerialization(); // Add the indicator for plotting PlotSeries plotDefault = new PlotSeries("line"); PlotSeries plotSignal = new PlotSeries("line"); ChartPlots[ToString() + " Default"] = plotDefault; ChartPlots[ToString() + " Signal"] = plotSignal; for (int i = 0; i < Data.Dates.Count; i++) { long ticks = UtilityMethods.UnixTicks(Data.Dates[i]); plotDefault.PlotData.Add(new List <object>() { ticks, Math.Round(Default[i], 6) }); plotSignal.PlotData.Add(new List <object>() { ticks, Math.Round(Signal[i], 6) }); } }
/// <summary> /// Creates the plots for the data to be added to. /// </summary> public override void CreatePlots() { base.CreatePlots(); // Add the indicator for plotting ChartPlots[ToString()] = new PlotSeries("line"); }
/// <summary> /// Adds data to the created plots for the indicator at the current bar. /// </summary> /// <param name="currentBar"></param> public override void AddToPlots(int currentBar) { base.AddToPlots(currentBar); long ticks = UtilityMethods.UnixTicks(Data.Dates[currentBar]); PlotSeries line = (PlotSeries)ChartPlots["Dmi+"]; line.PlotData.Add(new List <object>() { ticks, Math.Round(DmiPlus[currentBar], 2) }); line = (PlotSeries)ChartPlots["Dmi-"]; line.PlotData.Add(new List <object>() { ticks, Math.Round(DmiMinus[currentBar], 2) }); line = (PlotSeries)ChartPlots["Adx"]; line.PlotData.Add(new List <object>() { ticks, Math.Round(Adx[currentBar], 2) }); }
/// <summary> /// Save the indicator data in a serialization friendly way. /// </summary> public override void PrepareForSerialization() { base.PrepareForSerialization(); // Add the rsi for plotting PlotSeries plotD = new PlotSeries("line"); PlotSeries plotK = new PlotSeries("line"); ChartPlots[ToString() + " %D"] = plotD; ChartPlots[ToString() + " %K"] = plotK; for (int i = 0; i < Data.Dates.Count; i++) { long ticks = UtilityMethods.UnixTicks(Data.Dates[i]); plotD.PlotData.Add(new List <object>() { ticks, Math.Round(D[i], 2) }); plotK.PlotData.Add(new List <object>() { ticks, Math.Round(K[i], 2) }); } }
/// <summary> /// Save the indicator data in a serialization friendly way. /// </summary> public override void PrepareForSerialization() { base.PrepareForSerialization(); // Add the rsi for plotting PlotSeries plotMacd = new PlotSeries("line"); PlotSeries plotAvg = new PlotSeries("line"); PlotSeries plotDiff = new PlotSeries("column"); ChartPlots["Macd"] = plotMacd; ChartPlots["Avg"] = plotAvg; ChartPlots["Diff"] = plotDiff; for (int i = 0; i < Data.Dates.Count; i++) { long dateTicks = UtilityMethods.UnixTicks(Data.Dates[i]); plotMacd.PlotData.Add(new List <object>() { dateTicks, Math.Round(Value[i], 2) }); plotAvg.PlotData.Add(new List <object>() { dateTicks, Math.Round(Avg[i], 2) }); plotDiff.PlotData.Add(new List <object>() { dateTicks, Math.Round(Diff[i], 2) }); } }
/// <summary> /// Save the indicator data in a serialization friendly way. /// </summary> public override void PrepareForSerialization() { base.PrepareForSerialization(); // Add the data plots. PlotSeries plotUpper = new PlotSeries("line"); PlotSeries plotMiddle = new PlotSeries("line"); PlotSeries plotLower = new PlotSeries("line"); ChartPlots[ToString() + "Upper"] = plotUpper; ChartPlots[ToString() + "Middle"] = plotMiddle; ChartPlots[ToString() + "Lower"] = plotLower; for (int i = 0; i < Data.Dates.Count; i++) { long ticks = UtilityMethods.UnixTicks(Data.Dates[i]); plotUpper.PlotData.Add(new List <object>() { ticks, Math.Round(Upper[i], 2) }); plotMiddle.PlotData.Add(new List <object>() { ticks, Math.Round(Middle[i], 2) }); plotLower.PlotData.Add(new List <object>() { ticks, Math.Round(Lower[i], 2) }); } }
private void Plot_MouseMove(object sender, OxyMouseEventArgs e) { if (MouseMoveState == MoveState.None) { return; } var x = PlotSeries.InverseTransform(e.Position).X; if (MouseMoveState == MoveState.MovingRange) { var change = (x - _moveStartX) + _clickStartXOffset; var size = Math.Abs(_clickedRange.MaximumX - _clickedRange.MinimumX); _clickedRange.MinimumX = Math.Max(_moveStartX + change, 0); _clickedRange.MaximumX = _clickedRange.MinimumX + size; //model.Subtitle = string.Format("Integrating from {0:0.00} to {1:0.00}", range.MinimumX, range.MaximumX); } else { _activeRange.MinimumX = Math.Min(x, _clickStartX); _activeRange.MaximumX = Math.Max(x, _clickStartX); } _activeRange.Text = $"{_activeRange.MinimumX / 1000:F0} - {_activeRange.MaximumX / 1000:F0}"; //model.Subtitle = string.Format("Integrating from {0:0.00} to {1:0.00}", range.MinimumX, range.MaximumX); Model.InvalidatePlot(false); e.Handled = true; }
/// <summary> /// Creates the plots for the data to be added to. /// </summary> public override void CreatePlots() { base.CreatePlots(); // Add the indicator for plotting ChartPlots["Atr"] = new PlotSeries("line"); ChartPlots["AtrNormalized"] = new PlotSeries("line"); }
/// <summary> /// Creates the plots for the data to be added to. /// </summary> public override void CreatePlots() { base.CreatePlots(); // Add the indicator for plotting ChartPlots["Ppo"] = new PlotSeries("line"); ChartPlots["PpoSmoothed"] = new PlotSeries("line"); ChartPlots["PpoDiff"] = new PlotSeries("column"); }
/// <summary> /// Creates the plots for the data to be added to. /// </summary> public override void CreatePlots() { base.CreatePlots(); // Add the indicator for plotting ChartPlots["Dmi+"] = new PlotSeries("line"); ChartPlots["Dmi-"] = new PlotSeries("line"); ChartPlots["Adx"] = new PlotSeries("line"); }
static bool Test(string query, PlotSeries series) { var parser = Parser.Parse(query); Console.WriteLine("Testing: {0} = ...", query); var value = (YAMP.PlotValue)parser.Execute(); Console.WriteLine("{0}\n-> correct: {1}", value.Count, series.Number); return(Assert(value.Count, series.Number)); }
/// <summary> /// Creates the plots for the data to be added to. /// </summary> public override void CreatePlots() { base.CreatePlots(); PlotSeries plot = new PlotSeries("line"); PlotSeriesFlag plotFlag = new PlotSeriesFlag(); ChartPlots[ToString()] = plot; ChartPlots[ToString() + "label"] = plotFlag; }
/// <summary> /// Creates the plots for the data to be added to. /// </summary> public override void CreatePlots() { base.CreatePlots(); // Add the indicator for plotting PlotSeries line = new PlotSeries("line"); line.ShouldConnectNulls = true; ChartPlots[ToString()] = line; }
/// <summary> /// Helper function for indicators to add values to a plot so we don't /// have to cut and paste this so much. /// </summary> /// <param name="plotName">Name of plot to add to</param> /// <param name="ticks">Time in ticks of the value</param> /// <param name="value">Value to add</param> protected void AddValueToPlot(string plotName, long ticks, object value) { PlotSeries plot = (PlotSeries)ChartPlots[plotName]; plot.PlotData.Add(new List <object>() { ticks, value }); }
/// <summary> /// Creates the plots for the data to be added to. /// </summary> public override void CreatePlots() { base.CreatePlots(); // Add the indicator for plotting ChartPlots["Ext 1.272"] = new PlotSeries("line") { DashStyle = "ShortDot", ShouldConnectNulls = true }; ChartPlots["Ext 1.618"] = new PlotSeries("line") { DashStyle = "ShortDot", ShouldConnectNulls = true }; ChartPlots["Alt 0.618"] = new PlotSeries("line") { DashStyle = "ShortDot", ShouldConnectNulls = true }; ChartPlots["Alt 1.000"] = new PlotSeries("line") { DashStyle = "ShortDot", ShouldConnectNulls = true }; ChartPlots["Alt 1.618"] = new PlotSeries("line") { DashStyle = "ShortDot", ShouldConnectNulls = true }; ChartPlots["Int 0.382"] = new PlotSeries("line") { DashStyle = "ShortDot", ShouldConnectNulls = true }; ChartPlots["Int 0.500"] = new PlotSeries("line") { DashStyle = "ShortDot", ShouldConnectNulls = true }; ChartPlots["Int 0.618"] = new PlotSeries("line") { DashStyle = "ShortDot", ShouldConnectNulls = true }; ChartPlots["Int 0.786"] = new PlotSeries("line") { DashStyle = "ShortDot", ShouldConnectNulls = true }; ChartPlots["High Best Fit"] = new PlotSeries("line") { ShouldConnectNulls = true }; ChartPlots["Low Best Fit"] = new PlotSeries("line") { ShouldConnectNulls = true }; ChartPlots["All Best Fit"] = new PlotSeries("line") { ShouldConnectNulls = true }; }
/// <summary> /// Creates the plots for the data to be added to. /// </summary> public override void CreatePlots() { base.CreatePlots(); // Add the indicator for plotting PlotSeries plotD = new PlotSeries("line"); PlotSeries plotK = new PlotSeries("line"); ChartPlots["DtOscillator %D"] = plotD; ChartPlots["DtOscillator %K"] = plotK; }
/// <summary> /// Adds data to the created plots for the indicator at the current bar. /// </summary> /// <param name="currentBar"></param> public override void AddToPlots(int currentBar) { base.AddToPlots(currentBar); PlotSeries line = (PlotSeries)ChartPlots[ToString()]; line.PlotData.Add(new List <object>() { UtilityMethods.UnixTicks(Data.Dates[currentBar]), Math.Round(Value[currentBar], 2) }); }
/// <summary> /// Save the indicator data in a serialization friendly way. /// </summary> public override void PrepareForSerialization() { base.PrepareForSerialization(); // Add the rsi for plotting PlotSeries plot = new PlotSeries("line"); ChartPlots["Momentum"] = plot; for (int i = 0; i < Data.Dates.Count; i++) { plot.PlotData.Add(new List <object>() { UtilityMethods.UnixTicks(Data.Dates[i]), Math.Round(Value[i], 2) }); } }
/// <summary> /// Save the indicator data in a serialization friendly way. /// </summary> public override void PrepareForSerialization() { base.PrepareForSerialization(); // Add the rsi for plotting PlotSeries plot = new PlotSeries("column"); ChartPlots[ToString()] = plot; for (int i = 0; i < Data.Dates.Count; i++) { plot.PlotData.Add(new List <object>() { UtilityMethods.UnixTicks(Data.Dates[i]), Found[i] ? 1 : 0 }); } }
/// <summary> /// Adds data to the created plots for the indicator at the current bar. /// </summary> /// <param name="currentBar"></param> public override void AddToPlots(int currentBar) { base.AddToPlots(currentBar); PlotSeries plotD = (PlotSeries)ChartPlots["DtOscillator %D"]; PlotSeries plotK = (PlotSeries)ChartPlots["DtOscillator %K"]; long ticks = UtilityMethods.UnixTicks(Data.Dates[currentBar]); plotD.PlotData.Add(new List <object>() { ticks, Math.Round(SD[currentBar], 2) }); plotK.PlotData.Add(new List <object>() { ticks, Math.Round(SK[currentBar], 2) }); }
/// <summary> /// Save the indicator data in a serialization friendly way. /// </summary> public override void PrepareForSerialization() { base.PrepareForSerialization(); // Add the rsi for plotting PlotSeries plotUp = new PlotSeries("line"); PlotSeries plotDown = new PlotSeries("line"); ChartPlots[ToString() + "High"] = plotUp; ChartPlots[ToString() + "Low"] = plotDown; for (int i = 0; i < Data.Dates.Count; i++) { long ticks = UtilityMethods.UnixTicks(Data.Dates[i]); object upValue = null; if (HighCyclePlot[i] > 0.0) { upValue = HighCyclePlot[i]; } plotUp.PlotData.Add(new List <object>() { ticks, upValue }); object downValue = null; if (LowCyclePlot[i] > 0.0) { downValue = LowCyclePlot[i]; } plotDown.PlotData.Add(new List <object>() { ticks, downValue }); } }
/// <summary> /// Adds data to the created plots for the indicator at the current bar. /// </summary> /// <param name="currentBar"></param> public override void AddToPlots(int currentBar) { base.AddToPlots(currentBar); PlotSeries plot = (PlotSeries)ChartPlots[ToString()]; PlotSeriesFlag plotFlag = (PlotSeriesFlag)ChartPlots[ToString() + "label"]; long ticks = UtilityMethods.UnixTicks(Data.Dates[currentBar]); plot.PlotData.Add(new List <object>() { ticks, FifthWaveValue[currentBar] > 0.0 ? (object)Math.Round(FifthWaveValue[currentBar], 2) : null }); if (WaveLabels[currentBar] != null) { plotFlag.PlotData.Add(new Dictionary <string, object>() { { "x", ticks }, { "title", WaveLabels[currentBar].Label } }); } }
/// <summary> /// Adds data to the created plots for the indicator at the current bar. /// </summary> /// <param name="currentBar"></param> public override void AddToPlots(int currentBar) { base.AddToPlots(currentBar); long ticks = UtilityMethods.UnixTicks(Data.Dates[currentBar]); double value = 0.0; PlotSeries ext127 = (PlotSeries)ChartPlots["Ext 1.272"]; value = External[(int)ExternalType._127][currentBar]; ext127.PlotData.Add(new List <object>() { ticks, value > 0.0 ? (object)Math.Round(value, 2) : null }); PlotSeries ext162 = (PlotSeries)ChartPlots["Ext 1.618"]; value = External[(int)ExternalType._162][currentBar]; ext162.PlotData.Add(new List <object>() { ticks, value > 0.0 ? (object)Math.Round(value, 2) : null }); PlotSeries alt100Wave1 = (PlotSeries)ChartPlots["Alt 1.00(0-1)"]; value = Alternate[(int)AlternateType._100Wave1][currentBar]; alt100Wave1.PlotData.Add(new List <object>() { ticks, value > 0.0 ? (object)Math.Round(value, 2) : null }); PlotSeries alt100Wave3 = (PlotSeries)ChartPlots["Alt 1.00(2-3)"]; value = Alternate[(int)AlternateType._100Wave3][currentBar]; alt100Wave3.PlotData.Add(new List <object>() { ticks, value > 0.0 ? (object)Math.Round(value, 2) : null }); PlotSeries alt382 = (PlotSeries)ChartPlots["Alt 0.382"]; value = Alternate[(int)AlternateType._38][currentBar]; alt382.PlotData.Add(new List <object>() { ticks, value > 0.0 ? (object)Math.Round(value, 2) : null }); PlotSeries alt618 = (PlotSeries)ChartPlots["Alt 0.618"]; value = Alternate[(int)AlternateType._62][currentBar]; alt618.PlotData.Add(new List <object>() { ticks, value > 0.0 ? (object)Math.Round(value, 2) : null }); }