Below is a link to an example of a scrollable object you may find helpful.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to draw a line using the PlotStyle from a Plot?
Collapse
X
-
Hello NinjaTrader_ChelseaB,Originally posted by NinjaTrader_ChelseaB View PostHello PaulMohn,
Below is a link to an example of a scrollable object you may find helpful.
https://ninjatrader.com/support/foru...906#post786906
Thanks a lot.
This version plots on the correct bars
But it doesn't keep plotting on new bars unless we hit F5/reload the ninjascript on the chart.Code:#region Using declarations using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using System.Windows.Media; using System.Xml.Serialization; using NinjaTrader.Cbi; using NinjaTrader.Gui; using NinjaTrader.Gui.Chart; using NinjaTrader.Gui.SuperDom; using NinjaTrader.Gui.Tools; using NinjaTrader.Data; using NinjaTrader.NinjaScript; using NinjaTrader.Core.FloatingPoint; using NinjaTrader.NinjaScript.DrawingTools; //using SharpDX; //using SharpDX.Direct2D1; //using SharpDX.DirectWrite; #endregion //This namespace holds Indicators in this folder and is required. Do not change it. namespace NinjaTrader.NinjaScript.Indicators { public class _OnRenderPlot : Indicator { private int cBar, cBar1; private double cHigh; private SharpDX.Direct2D1.Brush brushDx; private Point endPoint; private Point startPoint; // Defines the Series object private Series<double> myDoubleSeries, myDoubleSeries1; protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Indicator here."; Name = "_OnRenderPlot"; Calculate = Calculate.OnEachTick; IsOverlay = true; DisplayInDataBox = true; DrawOnPricePanel = true; DrawHorizontalGridLines = true; DrawVerticalGridLines = true; PaintPriceMarkers = true; ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; //Disable this property if your indicator requires custom values that cumulate with each new market data event. //See Help Guide for additional information. IsSuspendedWhileInactive = true; BarsRequiredToPlot = 1; // Adds a blue Dash-Line style plot with 5pixel width and 70% opacity AddPlot(new Stroke(Brushes.Cyan, DashStyleHelper.Dash, 5, 70), PlotStyle.Hash, "MyPlot1"); } else if (State == State.Configure) { } else if (State == State.DataLoaded) { // Create a new Series object and assign it to the variable myDoubleSeries declared in the ‘Variables’ region above myDoubleSeries = new Series<double>(this); myDoubleSeries1 = new Series<double>(this); } } protected override void OnBarUpdate() { if (CurrentBar <21) return; if (State == State.Historical && Count > 10 && Open[0] < Close[0]) { cBar = CurrentBar; cHigh = High[0]; MyPlot1[0] = cHigh; myDoubleSeries[0] = cHigh; } else { //MyPlot1[0] = double.NaN; } if (State == State.Historical && Count > 10 && (CurrentBar - cBar) < 4) { cBar1 = CurrentBar; MyPlot1[0] = cHigh; // Print(" "); // Print("cBar1 " + cBar1 + " " + Time[0]); myDoubleSeries1[0] = cHigh; } } protected override void OnRender(ChartControl chartControl, ChartScale chartScale) { base.OnRender(chartControl, chartScale); SharpDX.Direct2D1.StrokeStyleProperties ssPropsWick = new SharpDX.Direct2D1.StrokeStyleProperties(); ssPropsWick.DashStyle = DashStyleSolidLine; SharpDX.Direct2D1.StrokeStyle solidLine = new SharpDX.Direct2D1.StrokeStyle(RenderTarget.Factory, ssPropsWick); double plotValue = 0; for (int barIndex = ChartBars.FromIndex; barIndex <= ChartBars.ToIndex; barIndex++) { plotValue = myDoubleSeries1.GetValueAt(barIndex); // start point is 10 bars back and 5 ticks up from 2nd to last bar and price startPoint = new Point(ChartControl.GetXByBarIndex(ChartBars, barIndex), chartScale.GetYByValue(plotValue)); // end point is 2nd to last bar and 5 ticks down from price endPoint = new Point(ChartControl.GetXByBarIndex(ChartBars, barIndex+1), chartScale.GetYByValue(plotValue)); SharpDX.Direct2D1.AntialiasMode oldAntialiasMode = RenderTarget.AntialiasMode; RenderTarget.AntialiasMode = SharpDX.Direct2D1.AntialiasMode.PerPrimitive; // draw a line between the start and end point at each plot using the plots SharpDX Brush color and style RenderTarget.DrawLine(startPoint.ToVector2(), endPoint.ToVector2(), Plots[0].BrushDX, Plots[0].Width, solidLine); RenderTarget.AntialiasMode = oldAntialiasMode; } solidLine.Dispose(); } #region Properties [Browsable(false)] [XmlIgnore] public Series<double> MyPlot1 { get { return Values[0]; } } [NinjaScriptProperty] [Display(Name="DashStyle Solid Line", Description="DashStyle Solid Line.", Order=0, GroupName="Plots Lines")] public SharpDX.Direct2D1.DashStyle DashStyleSolidLine { get; set; } #endregion } } #region NinjaScript generated code. Neither change nor remove. namespace NinjaTrader.NinjaScript.Indicators { public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase { private _OnRenderPlot[] cache_OnRenderPlot; public _OnRenderPlot _OnRenderPlot(SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return _OnRenderPlot(Input, dashStyleSolidLine); } public _OnRenderPlot _OnRenderPlot(ISeries<double> input, SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { if (cache_OnRenderPlot != null) for (int idx = 0; idx < cache_OnRenderPlot.Length; idx++) if (cache_OnRenderPlot[idx] != null && cache_OnRenderPlot[idx].DashStyleSolidLine == dashStyleSolidLine && cache_OnRenderPlot[idx].EqualsInput(input)) return cache_OnRenderPlot[idx]; return CacheIndicator<_OnRenderPlot>(new _OnRenderPlot(){ DashStyleSolidLine = dashStyleSolidLine }, input, ref cache_OnRenderPlot); } } } namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns { public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase { public Indicators._OnRenderPlot _OnRenderPlot(SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(Input, dashStyleSolidLine); } public Indicators._OnRenderPlot _OnRenderPlot(ISeries<double> input , SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(input, dashStyleSolidLine); } } } namespace NinjaTrader.NinjaScript.Strategies { public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase { public Indicators._OnRenderPlot _OnRenderPlot(SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(Input, dashStyleSolidLine); } public Indicators._OnRenderPlot _OnRenderPlot(ISeries<double> input , SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(input, dashStyleSolidLine); } } } #endregion
How to get the script to plot on new bars?
This is another problem:
Without barIndex+1 in endPoint it does not plot.Code:// start point is 10 bars back and 5 ticks up from 2nd to last bar and price startPoint = new Point(ChartControl.GetXByBarIndex(ChartBars, barIndex), chartScale.GetYByValue(plotValue)); // end point is 2nd to last bar and 5 ticks down from price endPoint = new Point(ChartControl.GetXByBarIndex(ChartBars, barIndex+1), chartScale.GetYByValue(plotValue));
How to get it to plot without the extra 1 bar plot length (same as the original plot, in solid line)?
Comment
-
Fixed the 1st issue with this version (removed the State == State.Historical && Count > 10 && condition)
Code:#region Using declarations using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using System.Windows.Media; using System.Xml.Serialization; using NinjaTrader.Cbi; using NinjaTrader.Gui; using NinjaTrader.Gui.Chart; using NinjaTrader.Gui.SuperDom; using NinjaTrader.Gui.Tools; using NinjaTrader.Data; using NinjaTrader.NinjaScript; using NinjaTrader.Core.FloatingPoint; using NinjaTrader.NinjaScript.DrawingTools; //using SharpDX; //using SharpDX.Direct2D1; //using SharpDX.DirectWrite; #endregion //This namespace holds Indicators in this folder and is required. Do not change it. namespace NinjaTrader.NinjaScript.Indicators { public class _OnRenderPlot : Indicator { private int cBar, cBar1; private double cHigh; private SharpDX.Direct2D1.Brush brushDx; private Point endPoint; private Point startPoint; // Defines the Series object private Series<double> myDoubleSeries, myDoubleSeries1; protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Indicator here."; Name = "_OnRenderPlot"; Calculate = Calculate.OnEachTick; IsOverlay = true; DisplayInDataBox = true; DrawOnPricePanel = true; DrawHorizontalGridLines = true; DrawVerticalGridLines = true; PaintPriceMarkers = true; ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; //Disable this property if your indicator requires custom values that cumulate with each new market data event. //See Help Guide for additional information. IsSuspendedWhileInactive = true; BarsRequiredToPlot = 1; // Adds a blue Dash-Line style plot with 5pixel width and 70% opacity AddPlot(new Stroke(Brushes.Cyan, DashStyleHelper.Dash, 5, 70), PlotStyle.Hash, "MyPlot1"); } else if (State == State.Configure) { } else if (State == State.DataLoaded) { // Create a new Series object and assign it to the variable myDoubleSeries declared in the ‘Variables’ region above myDoubleSeries = new Series<double>(this); myDoubleSeries1 = new Series<double>(this); } } protected override void OnBarUpdate() { if (CurrentBar <21) return; if (Open[0] < Close[0]) { cBar = CurrentBar; cHigh = High[0]; MyPlot1[0] = cHigh; myDoubleSeries[0] = cHigh; } else { //MyPlot1[0] = double.NaN; } if ((CurrentBar - cBar) < 4) { cBar1 = CurrentBar; MyPlot1[0] = cHigh; // Print(" "); // Print("cBar1 " + cBar1 + " " + Time[0]); myDoubleSeries1[0] = cHigh; } } protected override void OnRender(ChartControl chartControl, ChartScale chartScale) { base.OnRender(chartControl, chartScale); SharpDX.Direct2D1.StrokeStyleProperties ssPropsWick = new SharpDX.Direct2D1.StrokeStyleProperties(); ssPropsWick.DashStyle = DashStyleSolidLine; SharpDX.Direct2D1.StrokeStyle solidLine = new SharpDX.Direct2D1.StrokeStyle(RenderTarget.Factory, ssPropsWick); double plotValue = 0; for (int barIndex = ChartBars.FromIndex; barIndex <= ChartBars.ToIndex; barIndex++) { plotValue = myDoubleSeries1.GetValueAt(barIndex); // start point is 10 bars back and 5 ticks up from 2nd to last bar and price startPoint = new Point(ChartControl.GetXByBarIndex(ChartBars, barIndex), chartScale.GetYByValue(plotValue)); // end point is 2nd to last bar and 5 ticks down from price endPoint = new Point(ChartControl.GetXByBarIndex(ChartBars, barIndex+1), chartScale.GetYByValue(plotValue)); SharpDX.Direct2D1.AntialiasMode oldAntialiasMode = RenderTarget.AntialiasMode; RenderTarget.AntialiasMode = SharpDX.Direct2D1.AntialiasMode.PerPrimitive; // draw a line between the start and end point at each plot using the plots SharpDX Brush color and style RenderTarget.DrawLine(startPoint.ToVector2(), endPoint.ToVector2(), Plots[0].BrushDX, Plots[0].Width, solidLine); RenderTarget.AntialiasMode = oldAntialiasMode; } solidLine.Dispose(); } #region Properties [Browsable(false)] [XmlIgnore] public Series<double> MyPlot1 { get { return Values[0]; } } [NinjaScriptProperty] [Display(Name="DashStyle Solid Line", Description="DashStyle Solid Line.", Order=0, GroupName="Plots Lines")] public SharpDX.Direct2D1.DashStyle DashStyleSolidLine { get; set; } #endregion } } #region NinjaScript generated code. Neither change nor remove. namespace NinjaTrader.NinjaScript.Indicators { public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase { private _OnRenderPlot[] cache_OnRenderPlot; public _OnRenderPlot _OnRenderPlot(SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return _OnRenderPlot(Input, dashStyleSolidLine); } public _OnRenderPlot _OnRenderPlot(ISeries<double> input, SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { if (cache_OnRenderPlot != null) for (int idx = 0; idx < cache_OnRenderPlot.Length; idx++) if (cache_OnRenderPlot[idx] != null && cache_OnRenderPlot[idx].DashStyleSolidLine == dashStyleSolidLine && cache_OnRenderPlot[idx].EqualsInput(input)) return cache_OnRenderPlot[idx]; return CacheIndicator<_OnRenderPlot>(new _OnRenderPlot(){ DashStyleSolidLine = dashStyleSolidLine }, input, ref cache_OnRenderPlot); } } } namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns { public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase { public Indicators._OnRenderPlot _OnRenderPlot(SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(Input, dashStyleSolidLine); } public Indicators._OnRenderPlot _OnRenderPlot(ISeries<double> input , SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(input, dashStyleSolidLine); } } } namespace NinjaTrader.NinjaScript.Strategies { public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase { public Indicators._OnRenderPlot _OnRenderPlot(SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(Input, dashStyleSolidLine); } public Indicators._OnRenderPlot _OnRenderPlot(ISeries<double> input , SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(input, dashStyleSolidLine); } } } #endregion
Comment
-
The 2nd issue remains after double checking:
This does plot the solid line extended 1 bar
This doesn't plot the solid lineCode:// start point is 10 bars back and 5 ticks up from 2nd to last bar and price startPoint = new Point(ChartControl.GetXByBarIndex(ChartBars, barIndex), chartScale.GetYByValue(plotValue)); // end point is 2nd to last bar and 5 ticks down from price endPoint = new Point(ChartControl.GetXByBarIndex(ChartBars, barIndex+1), chartScale.GetYByValue(plotValue));
Code:// start point is 10 bars back and 5 ticks up from 2nd to last bar and price startPoint = new Point(ChartControl.GetXByBarIndex(ChartBars, barIndex), chartScale.GetYByValue(plotValue)); // end point is 2nd to last bar and 5 ticks down from price endPoint = new Point(ChartControl.GetXByBarIndex(ChartBars, barIndex), chartScale.GetYByValue(plotValue));
How to get the 2nd version equivalent to plot (same as the MyPlot1[0] = cHigh; plot)?
Comment
-
Yes, the solid line plot plots on top of the MyPlot1[0] as expected.
But the problem is I don't know how to limit the solid line plot to the bars of the MyPlot1[0], not +1 bar.
How to do that? What way to get the same result as the MyPlot1[0] plot without the forced +1 bar?
The end result should be identical to the MyPlot1[0] plot, but in solid line plot instead of the MyPlot1[0] dash plot.
Same as this output
Last edited by PaulMohn; 08-06-2024, 12:56 PM.
Comment
-
Hello PaulMohn,
If the lines start and end at the same point they should be using the same values, not different values.
"But the problem is I don't know how to limit the solid line plot to the bars of the MyPlot1[0], not +1 bar."
Unfortunately, I don't know what this means.
Are you printing the values and verifying the x and y coordinates are what you expect?
You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.Chelsea B.NinjaTrader Customer Service
Comment
-
This
endPoint 709,114 04/08/2024 18:00:00Code:#region Using declarations using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using System.Windows.Media; using System.Xml.Serialization; using NinjaTrader.Cbi; using NinjaTrader.Gui; using NinjaTrader.Gui.Chart; using NinjaTrader.Gui.SuperDom; using NinjaTrader.Gui.Tools; using NinjaTrader.Data; using NinjaTrader.NinjaScript; using NinjaTrader.Core.FloatingPoint; using NinjaTrader.NinjaScript.DrawingTools; //using SharpDX; //using SharpDX.Direct2D1; //using SharpDX.DirectWrite; #endregion //This namespace holds Indicators in this folder and is required. Do not change it. namespace NinjaTrader.NinjaScript.Indicators { public class _OnRenderPlot : Indicator { private int cBar, cBar1; private double cHigh; private SharpDX.Direct2D1.Brush brushDx; private Point endPoint; private Point startPoint; // Defines the Series object private Series<double> myDoubleSeries, myDoubleSeries1; protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Indicator here."; Name = "_OnRenderPlot"; Calculate = Calculate.OnEachTick; IsOverlay = true; DisplayInDataBox = true; DrawOnPricePanel = true; DrawHorizontalGridLines = true; DrawVerticalGridLines = true; PaintPriceMarkers = true; ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; //Disable this property if your indicator requires custom values that cumulate with each new market data event. //See Help Guide for additional information. IsSuspendedWhileInactive = true; BarsRequiredToPlot = 1; // Adds a blue Dash-Line style plot with 5pixel width and 70% opacity AddPlot(new Stroke(Brushes.Cyan, DashStyleHelper.Dash, 5, 70), PlotStyle.Hash, "MyPlot1"); } else if (State == State.Configure) { } else if (State == State.DataLoaded) { // Create a new Series object and assign it to the variable myDoubleSeries declared in the ‘Variables’ region above myDoubleSeries = new Series<double>(this); myDoubleSeries1 = new Series<double>(this); } } protected override void OnBarUpdate() { if (CurrentBar <21) return; if (Open[0] < Close[0]) { cBar = CurrentBar; cHigh = High[0]; MyPlot1[0] = cHigh; myDoubleSeries[0] = cHigh; } else { //MyPlot1[0] = double.NaN; } if ((CurrentBar - cBar) < 4) { cBar1 = CurrentBar; MyPlot1[0] = cHigh; // Print(" "); // Print("cBar1 " + cBar1 + " " + Time[0]); myDoubleSeries1[0] = cHigh; } } protected override void OnRender(ChartControl chartControl, ChartScale chartScale) { base.OnRender(chartControl, chartScale); SharpDX.Direct2D1.StrokeStyleProperties ssPropsWick = new SharpDX.Direct2D1.StrokeStyleProperties(); ssPropsWick.DashStyle = DashStyleSolidLine; SharpDX.Direct2D1.StrokeStyle solidLine = new SharpDX.Direct2D1.StrokeStyle(RenderTarget.Factory, ssPropsWick); double plotValue = 0; for (int barIndex = ChartBars.FromIndex; barIndex <= ChartBars.ToIndex; barIndex++) { plotValue = myDoubleSeries1.GetValueAt(barIndex); // start point is 10 bars back and 5 ticks up from 2nd to last bar and price startPoint = new Point(ChartControl.GetXByBarIndex(ChartBars, barIndex), chartScale.GetYByValue(plotValue)); // end point is 2nd to last bar and 5 ticks down from price endPoint = new Point(ChartControl.GetXByBarIndex(ChartBars, barIndex+1), chartScale.GetYByValue(plotValue)); Print("startPoint " + startPoint + " " + Time[0]); Print("endPoint " + endPoint + " " + Time[0]); SharpDX.Direct2D1.AntialiasMode oldAntialiasMode = RenderTarget.AntialiasMode; RenderTarget.AntialiasMode = SharpDX.Direct2D1.AntialiasMode.PerPrimitive; // draw a line between the start and end point at each plot using the plots SharpDX Brush color and style RenderTarget.DrawLine(startPoint.ToVector2(), endPoint.ToVector2(), Plots[0].BrushDX, Plots[0].Width, solidLine); RenderTarget.AntialiasMode = oldAntialiasMode; } solidLine.Dispose(); } #region Properties [Browsable(false)] [XmlIgnore] public Series<double> MyPlot1 { get { return Values[0]; } } [NinjaScriptProperty] [Display(Name="DashStyle Solid Line", Description="DashStyle Solid Line.", Order=0, GroupName="Plots Lines")] public SharpDX.Direct2D1.DashStyle DashStyleSolidLine { get; set; } #endregion } } #region NinjaScript generated code. Neither change nor remove. namespace NinjaTrader.NinjaScript.Indicators { public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase { private _OnRenderPlot[] cache_OnRenderPlot; public _OnRenderPlot _OnRenderPlot(SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return _OnRenderPlot(Input, dashStyleSolidLine); } public _OnRenderPlot _OnRenderPlot(ISeries<double> input, SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { if (cache_OnRenderPlot != null) for (int idx = 0; idx < cache_OnRenderPlot.Length; idx++) if (cache_OnRenderPlot[idx] != null && cache_OnRenderPlot[idx].DashStyleSolidLine == dashStyleSolidLine && cache_OnRenderPlot[idx].EqualsInput(input)) return cache_OnRenderPlot[idx]; return CacheIndicator<_OnRenderPlot>(new _OnRenderPlot(){ DashStyleSolidLine = dashStyleSolidLine }, input, ref cache_OnRenderPlot); } } } namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns { public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase { public Indicators._OnRenderPlot _OnRenderPlot(SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(Input, dashStyleSolidLine); } public Indicators._OnRenderPlot _OnRenderPlot(ISeries<double> input , SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(input, dashStyleSolidLine); } } } namespace NinjaTrader.NinjaScript.Strategies { public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase { public Indicators._OnRenderPlot _OnRenderPlot(SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(Input, dashStyleSolidLine); } public Indicators._OnRenderPlot _OnRenderPlot(ISeries<double> input , SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(input, dashStyleSolidLine); } } } #endregion prints
startPoint 709,86 04/08/2024 18:00:00
endPoint 742,86 04/08/2024 18:00:00
startPoint 742,59 04/08/2024 18:00:00
endPoint 775,59 04/08/2024 18:00:00
startPoint 775,38 04/08/2024 18:00:00
endPoint 809,38 04/08/2024 18:00:00
With this output
The superimposed solid line plots an extra bar in the future. How to get it to plot only one bar?
Comment
-
This
printsCode:#region Using declarations using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using System.Windows.Media; using System.Xml.Serialization; using NinjaTrader.Cbi; using NinjaTrader.Gui; using NinjaTrader.Gui.Chart; using NinjaTrader.Gui.SuperDom; using NinjaTrader.Gui.Tools; using NinjaTrader.Data; using NinjaTrader.NinjaScript; using NinjaTrader.Core.FloatingPoint; using NinjaTrader.NinjaScript.DrawingTools; //using SharpDX; //using SharpDX.Direct2D1; //using SharpDX.DirectWrite; #endregion //This namespace holds Indicators in this folder and is required. Do not change it. namespace NinjaTrader.NinjaScript.Indicators { public class _OnRenderPlot : Indicator { private int cBar, cBar1; private double cHigh; private SharpDX.Direct2D1.Brush brushDx; private Point endPoint; private Point startPoint; // Defines the Series object private Series<double> myDoubleSeries, myDoubleSeries1; protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Indicator here."; Name = "_OnRenderPlot"; Calculate = Calculate.OnEachTick; IsOverlay = true; DisplayInDataBox = true; DrawOnPricePanel = true; DrawHorizontalGridLines = true; DrawVerticalGridLines = true; PaintPriceMarkers = true; ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; //Disable this property if your indicator requires custom values that cumulate with each new market data event. //See Help Guide for additional information. IsSuspendedWhileInactive = true; BarsRequiredToPlot = 1; // Adds a blue Dash-Line style plot with 5pixel width and 70% opacity AddPlot(new Stroke(Brushes.Cyan, DashStyleHelper.Dash, 5, 70), PlotStyle.Hash, "MyPlot1"); } else if (State == State.Configure) { } else if (State == State.DataLoaded) { // Create a new Series object and assign it to the variable myDoubleSeries declared in the ‘Variables’ region above myDoubleSeries = new Series<double>(this); myDoubleSeries1 = new Series<double>(this); } } protected override void OnBarUpdate() { if (CurrentBar <21) return; if (Open[0] < Close[0]) { cBar = CurrentBar; cHigh = High[0]; MyPlot1[0] = cHigh; myDoubleSeries[0] = cHigh; } else { //MyPlot1[0] = double.NaN; } if ((CurrentBar - cBar) < 4) { cBar1 = CurrentBar; MyPlot1[0] = cHigh; // Print(" "); // Print("cBar1 " + cBar1 + " " + Time[0]); myDoubleSeries1[0] = cHigh; } } protected override void OnRender(ChartControl chartControl, ChartScale chartScale) { base.OnRender(chartControl, chartScale); SharpDX.Direct2D1.StrokeStyleProperties ssPropsWick = new SharpDX.Direct2D1.StrokeStyleProperties(); ssPropsWick.DashStyle = DashStyleSolidLine; SharpDX.Direct2D1.StrokeStyle solidLine = new SharpDX.Direct2D1.StrokeStyle(RenderTarget.Factory, ssPropsWick); double plotValue = 0; for (int barIndex = ChartBars.FromIndex; barIndex <= ChartBars.ToIndex; barIndex++) { plotValue = myDoubleSeries1.GetValueAt(barIndex); // start point is 10 bars back and 5 ticks up from 2nd to last bar and price startPoint = new Point(ChartControl.GetXByBarIndex(ChartBars, barIndex), chartScale.GetYByValue(plotValue)); // end point is 2nd to last bar and 5 ticks down from price endPoint = new Point(ChartControl.GetXByBarIndex(ChartBars, barIndex), chartScale.GetYByValue(plotValue)); Print("startPoint " + startPoint + " " + Time[0]); Print("endPoint " + endPoint + " " + Time[0]); SharpDX.Direct2D1.AntialiasMode oldAntialiasMode = RenderTarget.AntialiasMode; RenderTarget.AntialiasMode = SharpDX.Direct2D1.AntialiasMode.PerPrimitive; // draw a line between the start and end point at each plot using the plots SharpDX Brush color and style RenderTarget.DrawLine(startPoint.ToVector2(), endPoint.ToVector2(), Plots[0].BrushDX, Plots[0].Width, solidLine); RenderTarget.AntialiasMode = oldAntialiasMode; } solidLine.Dispose(); } #region Properties [Browsable(false)] [XmlIgnore] public Series<double> MyPlot1 { get { return Values[0]; } } [NinjaScriptProperty] [Display(Name="DashStyle Solid Line", Description="DashStyle Solid Line.", Order=0, GroupName="Plots Lines")] public SharpDX.Direct2D1.DashStyle DashStyleSolidLine { get; set; } #endregion } } #region NinjaScript generated code. Neither change nor remove. namespace NinjaTrader.NinjaScript.Indicators { public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase { private _OnRenderPlot[] cache_OnRenderPlot; public _OnRenderPlot _OnRenderPlot(SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return _OnRenderPlot(Input, dashStyleSolidLine); } public _OnRenderPlot _OnRenderPlot(ISeries<double> input, SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { if (cache_OnRenderPlot != null) for (int idx = 0; idx < cache_OnRenderPlot.Length; idx++) if (cache_OnRenderPlot[idx] != null && cache_OnRenderPlot[idx].DashStyleSolidLine == dashStyleSolidLine && cache_OnRenderPlot[idx].EqualsInput(input)) return cache_OnRenderPlot[idx]; return CacheIndicator<_OnRenderPlot>(new _OnRenderPlot(){ DashStyleSolidLine = dashStyleSolidLine }, input, ref cache_OnRenderPlot); } } } namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns { public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase { public Indicators._OnRenderPlot _OnRenderPlot(SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(Input, dashStyleSolidLine); } public Indicators._OnRenderPlot _OnRenderPlot(ISeries<double> input , SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(input, dashStyleSolidLine); } } } namespace NinjaTrader.NinjaScript.Strategies { public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase { public Indicators._OnRenderPlot _OnRenderPlot(SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(Input, dashStyleSolidLine); } public Indicators._OnRenderPlot _OnRenderPlot(ISeries<double> input , SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(input, dashStyleSolidLine); } } } #endregion
startPoint 675,109 04/08/2024 18:00:00
endPoint 675,109 04/08/2024 18:00:00
startPoint 709,80 04/08/2024 18:00:00
endPoint 709,80 04/08/2024 18:00:00
startPoint 742,52 04/08/2024 18:00:00
endPoint 742,52 04/08/2024 18:00:00
startPoint 775,38 04/08/2024 18:00:00
endPoint 775,38 04/08/2024 18:00:00
With this output:
This plot only one bar as intended. But it is only the MyPlot1[0] = cHigh; plot. Which is the dash plot.
My original request was about duplicating this MyPlot1[0] = cHigh; with a solid line.
Comment
-
But the dashed line is not being rendered by OnRender() code.
it is ploted in OnBarUpdate by this code:
if ((CurrentBar - cBar) < 4)
{
cBar1 = CurrentBar;
MyPlot1[0] = cHigh;
How to get these coordinates into this code?Code:protected override void OnBarUpdate() { if (CurrentBar <21) return; if (Open[0] < Close[0]) { cBar = CurrentBar; cHigh = High[0]; MyPlot1[0] = cHigh; myDoubleSeries[0] = cHigh; } else { //MyPlot1[0] = double.NaN; } if ((CurrentBar - cBar) < 4) { cBar1 = CurrentBar; MyPlot1[0] = cHigh; // Print(" "); // Print("cBar1 " + cBar1 + " " + Time[0]); myDoubleSeries1[0] = cHigh; } }
for (int barIndex = ChartBars.FromIndex; barIndex <= ChartBars.ToIndex; barIndex++)
{
plotValue = myDoubleSeries1.GetValueAt(barIndex);
startPoint = new Point(ChartControl.GetXByBarIndex(ChartBars, barIndex), chartScale.GetYByValue(plotValue));
endPoint = new Point(ChartControl.GetXByBarIndex(ChartBars, barIndex+1), chartScale.GetYByValue(plotValue));
RenderTarget.DrawLine(startPoint.ToVector2(), endPoint.ToVector2(), Plots[0].BrushDX,
Plots[0].Width, solidLine);
How would you substitute barIndex+1 to reduce the plot solid line lenght to 1 bar (not 2 bars as currently)?
What is the sharpDX way to specify this lenght other than by barIndex+1/barIndex ?
If it is not possible with the new Point() method, what other method would you suggest?
I thought of using a list but the issue remains:
Code:#region Using declarations using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using System.Windows.Media; using System.Xml.Serialization; using NinjaTrader.Cbi; using NinjaTrader.Gui; using NinjaTrader.Gui.Chart; using NinjaTrader.Gui.SuperDom; using NinjaTrader.Gui.Tools; using NinjaTrader.Data; using NinjaTrader.NinjaScript; using NinjaTrader.Core.FloatingPoint; using NinjaTrader.NinjaScript.DrawingTools; //using SharpDX; //using SharpDX.Direct2D1; //using SharpDX.DirectWrite; #endregion //This namespace holds Indicators in this folder and is required. Do not change it. namespace NinjaTrader.NinjaScript.Indicators { public class _OnRenderPlot : Indicator { private int cBar, cBar1; private double cHigh; private SharpDX.Direct2D1.Brush brushDx; private Point endPoint; private Point startPoint; // Defines the Series object private Series<double> myDoubleSeries, myDoubleSeries1; private Series<int> myIntSeries; private List<int> cbarInts = new List<int>(); private int cbarSingleInt; protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Indicator here."; Name = "_OnRenderPlot"; Calculate = Calculate.OnEachTick; IsOverlay = true; DisplayInDataBox = true; DrawOnPricePanel = true; DrawHorizontalGridLines = true; DrawVerticalGridLines = true; PaintPriceMarkers = true; ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; //Disable this property if your indicator requires custom values that cumulate with each new market data event. //See Help Guide for additional information. IsSuspendedWhileInactive = true; BarsRequiredToPlot = 1; // Adds a blue Dash-Line style plot with 5pixel width and 70% opacity AddPlot(new Stroke(Brushes.Cyan, DashStyleHelper.Dash, 5, 70), PlotStyle.Hash, "MyPlot1"); } else if (State == State.Configure) { } else if (State == State.DataLoaded) { // Create a new Series object and assign it to the variable myDoubleSeries declared in the ‘Variables’ region above myDoubleSeries = new Series<double>(this); myDoubleSeries1 = new Series<double>(this); myIntSeries = new Series<int>(this); cbarInts = new List<int>(); } } protected override void OnBarUpdate() { if (CurrentBar <21) return; if (State == State.Historical && Count > 10 && Open[0] < Close[0]) { cBar = CurrentBar; cHigh = High[0]; MyPlot1[0] = cHigh; myDoubleSeries[0] = cHigh; } else { //MyPlot1[0] = double.NaN; } if (State == State.Historical && Count > 10 && (CurrentBar - cBar) < 4) { cBar1 = CurrentBar; MyPlot1[0] = cHigh; Print(" "); Print("cBar1 " + cBar1 + " " + Time[0]); myDoubleSeries1[0] = cHigh; myIntSeries[0] = cBar1; cbarInts.Add(cBar1); } // Print(" "); //Print("myDoubleSeries0 " +myDoubleSeries[0]); //Print("myDoubleSeries1 " +myDoubleSeries1[0]); } protected override void OnRender(ChartControl chartControl, ChartScale chartScale) { base.OnRender(chartControl, chartScale); SharpDX.Direct2D1.StrokeStyleProperties ssPropsWick = new SharpDX.Direct2D1.StrokeStyleProperties(); ssPropsWick.DashStyle = DashStyleSolidLine; SharpDX.Direct2D1.StrokeStyle solidLine = new SharpDX.Direct2D1.StrokeStyle(RenderTarget.Factory, ssPropsWick); double plotValue = 0; cbarSingleInt = 0; for (int index = 0; index < cbarInts.Count; index++) { Print("cbarInts[index] " + cbarInts[index] + " " + Time[0]); cbarSingleInt = cbarInts[index]; } // for (int barIndex = ChartBars.FromIndex; barIndex <= ChartBars.ToIndex; barIndex++) for (int index = 0; index < cbarInts.Count; index++) { // get the starting and ending bars from what is rendered on the chart // startX = chartControl.GetXByBarIndex(ChartBars, ChartBars.FromIndex); // endX = chartControl.GetXByBarIndex(ChartBars, ChartBars.ToIndex); // plotValue = myDoubleSeries1.GetValueAt(barIndex); //// convert the plot value to the charts "Y" axis point // float chartScaleYValue = chartScale.GetYByValue(plotValue); // // calculate the x and y values for the line to start and end // SharpDX.Vector2 startPoint0 = new SharpDX.Vector2(startX, chartScaleYValue); // SharpDX.Vector2 endPoint0 = new SharpDX.Vector2(endX, chartScaleYValue); // Print(" "); // Print("cBar1 " + cBar1 + " " + Time[0]); plotValue = myDoubleSeries1.GetValueAt(index); // start point is 10 bars back and 5 ticks up from 2nd to last bar and price startPoint = new Point(ChartControl.GetXByBarIndex(ChartBars, cbarSingleInt), chartScale.GetYByValue(plotValue)); // end point is 2nd to last bar and 5 ticks down from price endPoint = new Point(ChartControl.GetXByBarIndex(ChartBars, cbarSingleInt+1), chartScale.GetYByValue(plotValue)); SharpDX.Direct2D1.AntialiasMode oldAntialiasMode = RenderTarget.AntialiasMode; RenderTarget.AntialiasMode = SharpDX.Direct2D1.AntialiasMode.PerPrimitive; // draw a line between the start and end point at each plot using the plots SharpDX Brush color and style RenderTarget.DrawLine(startPoint.ToVector2(), endPoint.ToVector2(), Plots[0].BrushDX, Plots[0].Width, solidLine); RenderTarget.AntialiasMode = oldAntialiasMode; } solidLine.Dispose(); } #region Properties [Browsable(false)] [XmlIgnore] public Series<double> MyPlot1 { get { return Values[0]; } } [NinjaScriptProperty] [Display(Name="DashStyle Solid Line", Description="DashStyle Solid Line.", Order=0, GroupName="Plots Lines")] public SharpDX.Direct2D1.DashStyle DashStyleSolidLine { get; set; } #endregion } } #region NinjaScript generated code. Neither change nor remove. namespace NinjaTrader.NinjaScript.Indicators { public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase { private _OnRenderPlot[] cache_OnRenderPlot; public _OnRenderPlot _OnRenderPlot(SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return _OnRenderPlot(Input, dashStyleSolidLine); } public _OnRenderPlot _OnRenderPlot(ISeries<double> input, SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { if (cache_OnRenderPlot != null) for (int idx = 0; idx < cache_OnRenderPlot.Length; idx++) if (cache_OnRenderPlot[idx] != null && cache_OnRenderPlot[idx].DashStyleSolidLine == dashStyleSolidLine && cache_OnRenderPlot[idx].EqualsInput(input)) return cache_OnRenderPlot[idx]; return CacheIndicator<_OnRenderPlot>(new _OnRenderPlot(){ DashStyleSolidLine = dashStyleSolidLine }, input, ref cache_OnRenderPlot); } } } namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns { public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase { public Indicators._OnRenderPlot _OnRenderPlot(SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(Input, dashStyleSolidLine); } public Indicators._OnRenderPlot _OnRenderPlot(ISeries<double> input , SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(input, dashStyleSolidLine); } } } namespace NinjaTrader.NinjaScript.Strategies { public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase { public Indicators._OnRenderPlot _OnRenderPlot(SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(Input, dashStyleSolidLine); } public Indicators._OnRenderPlot _OnRenderPlot(ISeries<double> input , SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(input, dashStyleSolidLine); } } } #endregion Last edited by PaulMohn; 08-06-2024, 03:16 PM.
Comment
-
NinjaTrader_ChelseaB Hello,
This new version works as expected except it rendres an added erratic plot
in red circle
Comment
-
Code:#region Using declarations using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using System.Windows.Media; using System.Xml.Serialization; using NinjaTrader.Cbi; using NinjaTrader.Gui; using NinjaTrader.Gui.Chart; using NinjaTrader.Gui.SuperDom; using NinjaTrader.Gui.Tools; using NinjaTrader.Data; using NinjaTrader.NinjaScript; using NinjaTrader.Core.FloatingPoint; using NinjaTrader.NinjaScript.DrawingTools; using SharpDX; using SharpDX.Direct2D1; //using SharpDX.DirectWrite; #endregion //This namespace holds Indicators in this folder and is required. Do not change it. namespace NinjaTrader.NinjaScript.Indicators { public class _OnRenderPlot : Indicator { private int cBar, cBar1; private double cHigh; // Defines the Series object private Series<double> myDoubleSeries; protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Indicator here."; Name = "_OnRenderPlot"; Calculate = Calculate.OnEachTick; IsOverlay = true; DisplayInDataBox = true; DrawOnPricePanel = true; DrawHorizontalGridLines = true; DrawVerticalGridLines = true; PaintPriceMarkers = true; ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; //Disable this property if your indicator requires custom values that cumulate with each new market data event. //See Help Guide for additional information. IsSuspendedWhileInactive = true; // Adds a blue Dash-Line style plot with 5pixel width and 70% opacity AddPlot(new Stroke(Brushes.Cyan, DashStyleHelper.Dash, 5, 70), PlotStyle.Hash, "MyPlot1"); } else if (State == State.Configure) { } else if (State == State.DataLoaded) { myDoubleSeries = new Series<double>(this); } } protected override void OnBarUpdate() { if (CurrentBar <21) return; if (Open[0] < Close[0]) { cBar = CurrentBar; cHigh = High[0]; MyPlot1[0] = cHigh; //myDoubleSeries[0] = cHigh; } else { //MyPlot1[0] = double.NaN; } if ((CurrentBar - cBar) < 4) { cBar1 = CurrentBar; MyPlot1[0] = cHigh; // Print(" "); // Print("cBar1 " + cBar1 + " " + Time[0]); myDoubleSeries[0] = cHigh; } } protected override void OnRender(ChartControl chartControl, ChartScale chartScale) { base.OnRender(chartControl, chartScale); SharpDX.Direct2D1.StrokeStyleProperties ssPropsWick = new SharpDX.Direct2D1.StrokeStyleProperties(); ssPropsWick.DashStyle = DashStyleSolidLine; SharpDX.Direct2D1.StrokeStyle solidLine = new SharpDX.Direct2D1.StrokeStyle(RenderTarget.Factory, ssPropsWick); SharpDX.Direct2D1.AntialiasMode oldAntialiasMode = RenderTarget.AntialiasMode; RenderTarget.AntialiasMode = SharpDX.Direct2D1.AntialiasMode.PerPrimitive; Vector2 point0 = new Vector2(); Vector2 point1 = new Vector2(); Vector2 point2 = new Vector2(); Vector2 point3 = new Vector2(); for (int barIndex = ChartBars.FromIndex; barIndex <= ChartBars.ToIndex; barIndex++) { double plotValue0 = 0, plotValue1 = 0; float valY0, xHeight0, x0, barWidth0, xWidth0, valY1, xHeight1, x1, barWidth1, xWidth1; plotValue0 = myDoubleSeries.GetValueAt(barIndex); valY0 = chartScale.GetYByValue(plotValue0); x0 = chartControl.GetXByBarIndex(ChartBars, barIndex); barWidth0 = (float)chartControl.BarWidth; point0.X = x0 - barWidth0; point0.Y = valY0; point1.X = x0 + barWidth0; point1.Y = valY0; xHeight0 = 10.0f; xWidth0 = (point1.X - point0.X); bool Cond0 = ( plotValue1 != double.NaN && plotValue0 != double.NaN && ( plotValue1 != plotValue0 ) || (plotValue1 == plotValue0 )); if ( Cond0 ) { new RectangleF(point0.X, point0.Y, xWidth0, xHeight0); RenderTarget.DrawLine(point0, point1, Plots[0].BrushDX, Plots[0].Width, solidLine); } plotValue1 = myDoubleSeries.GetValueAt(barIndex-1); valY1 = chartScale.GetYByValue(plotValue1); x1 = chartControl.GetXByBarIndex(ChartBars, barIndex-1); point2.X = x1 + barWidth0; point2.Y = valY1; point3.X = x0 - barWidth0; point3.Y = valY1; xHeight1 = 10.0f; xWidth1 = (point3.X - point2.X); bool Cond1 = ( plotValue1 != double.NaN && plotValue0 != double.NaN && plotValue1 == plotValue0 && !( plotValue1 != plotValue0 )); if ( Cond1 ) { new RectangleF(point2.X, point2.Y, xWidth1, xHeight1); RenderTarget.DrawLine(point2, point3, Plots[0].BrushDX, Plots[0].Width, solidLine); } } RenderTarget.AntialiasMode = oldAntialiasMode; solidLine.Dispose(); } #region Properties [Browsable(false)] [XmlIgnore] public Series<double> MyPlot1 { get { return Values[0]; } } [NinjaScriptProperty] [Display(Name="DashStyle Solid Line", Description="DashStyle Solid Line.", Order=0, GroupName="Plots Lines")] public SharpDX.Direct2D1.DashStyle DashStyleSolidLine { get; set; } #endregion } } #region NinjaScript generated code. Neither change nor remove. namespace NinjaTrader.NinjaScript.Indicators { public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase { private _OnRenderPlot[] cache_OnRenderPlot; public _OnRenderPlot _OnRenderPlot(SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return _OnRenderPlot(Input, dashStyleSolidLine); } public _OnRenderPlot _OnRenderPlot(ISeries<double> input, SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { if (cache_OnRenderPlot != null) for (int idx = 0; idx < cache_OnRenderPlot.Length; idx++) if (cache_OnRenderPlot[idx] != null && cache_OnRenderPlot[idx].DashStyleSolidLine == dashStyleSolidLine && cache_OnRenderPlot[idx].EqualsInput(input)) return cache_OnRenderPlot[idx]; return CacheIndicator<_OnRenderPlot>(new _OnRenderPlot(){ DashStyleSolidLine = dashStyleSolidLine }, input, ref cache_OnRenderPlot); } } } namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns { public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase { public Indicators._OnRenderPlot _OnRenderPlot(SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(Input, dashStyleSolidLine); } public Indicators._OnRenderPlot _OnRenderPlot(ISeries<double> input , SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(input, dashStyleSolidLine); } } } namespace NinjaTrader.NinjaScript.Strategies { public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase { public Indicators._OnRenderPlot _OnRenderPlot(SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(Input, dashStyleSolidLine); } public Indicators._OnRenderPlot _OnRenderPlot(ISeries<double> input , SharpDX.Direct2D1.DashStyle dashStyleSolidLine) { return indicator._OnRenderPlot(input, dashStyleSolidLine); } } } #endregion
Comment
-
Hello NinjaTrader_ChelseaB
Code:plotValue0 19581 plotValue1 19580 plotValue0 19581 plotValue1 19581 plotValue0 19577.25 plotValue1 19581 plotValue0 19577.25 plotValue1 19577.25 plotValue0 19175 plotValue1 19577.25
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
558 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
324 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
545 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment