Jump to content

BarOver Lap - Chop


aotegaoteg

Recommended Posts

Hi, Anyone interested or can help in updating this simple indicator

the indicator is meant to identify choppy ranges in x number of bars

 

however it doesn't seem to plot this, any good C# edu can help in updating this indicator

so it will identify choppy ranges, meaning if a Number of lookback bars,

closes within the high or low range of the previous 5 bars

plot these bar as red.

 

additional, an NT8 conversion will be nice to have.

 

superb

cheers

Bar-Over-lap.zip

Edited by aotegaoteg
Link to comment
Share on other sites

 

Andy do you think chatGPT is able to clean the dlls ? if you know how to do it please explain (from my side is impossible)

 

I thought he was programing a new one with small errors. I don't think it can clean with GPT, but I have seen it correct few mistakes I had programing with EasyLanguage. Again, small stuff. But I hear the 4.0 is much better. I have not tried the 4/Plus yet.

Link to comment
Share on other sites

 

I thought he was programing a new one with small errors. I don't think it can clean with GPT, but I have seen it correct few mistakes I had programing with EasyLanguage. Again, small stuff. But I hear the 4.0 is much better. I have not tried the 4/Plus yet.

 

I have 4Plus at now I don't see any difference (for my use) maybe more faster

Link to comment
Share on other sites

enjoy! FULL NT8 COMPATIBLE

 

BAROVERLPA.thumb.jpg.7978e97df300ec8deab3ccdfccce6181.jpg

 

#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 NinjaTrader.NinjaScript.Indicators;
using System.Windows.Shapes;
using NinjaTrader.Gui.Chart;
using NinjaTrader.NinjaScript.DrawingTools;
#endregion

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Indicators
{
/// <summary>
/// The bar overlap indicator counts the number of bars that overlap with the current bar's range.
/// </summary>
public class BarOverlap : Indicator
{
#region Variables
private int period = 100;
private double numStdDev = 2.0;
private Brush baseColor = Brushes.SlateBlue;
private Brush signalColor = Brushes.Red;
private int plot0Width = 4;
private PlotStyle plot0Style = PlotStyle.Bar;
private DashStyleHelper dash0Style = DashStyleHelper.Solid;
#endregion

protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = "The bar overlap indicator counts the number of bars that overlap with the current bar's range.";
Name = "BarOverlap";

AddPlot(new Stroke(baseColor, plot0Width), plot0Style, "Overlap");


IsOverlay = false;
}
else if (State == State.DataLoaded)
{
// SetPlotAppearance(Plots[0], baseColor, plot0Width, dash0Style);
}
}

protected override void OnBarUpdate()
{
int n = 0;
while (n < CurrentBar)
{
if (Low[0] >= High[n] || High[0] <= Low[n])
break;
n = n + 1;
}
Value[0] = n;

if (Value[0] > SMA(Value, period)[0] + numStdDev * StdDev(Value, period)[0])
PlotBrushes[0][0] = signalColor;
else
PlotBrushes[0][0] = baseColor;
}

private void SetPlotAppearance(Plot plot, Brush brush, int width, DashStyleHelper dashStyle)
{
plot.Pen = new Pen(brush, width) { DashStyle = DashStyleHelperToDashStyle(dashStyle) };
}

private DashStyle DashStyleHelperToDashStyle(DashStyleHelper dashStyleHelper)
{
switch (dashStyleHelper)
{
case DashStyleHelper.Dash:
return DashStyles.Dash;
case DashStyleHelper.DashDot:
return DashStyles.DashDot;
case DashStyleHelper.DashDotDot:
return DashStyles.DashDotDot;
case DashStyleHelper.Dot:
return DashStyles.Dot;
case DashStyleHelper.Solid:
return DashStyles.Solid;
default:
return DashStyles.Solid;
}
}


protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
{
base.OnRender(chartControl, chartScale);
Plots[0].Pen = new Pen(baseColor, plot0Width) { DashStyle = DashStyleHelperToDashStyle(dash0Style) };
}

#region Properties
[browsable(false)]
[XmlIgnore()]
public Series<double> Overlap
{
get { return Values[0]; }
}

[NinjaScriptProperty]
[Display(Name = "NumStdDev", GroupName = "NinjaScriptParameters", Order = 1)]
public double NumStdDev
{
get { return numStdDev; }
set { numStdDev = Math.Max(0, value); }
}

[NinjaScriptProperty]
[Display(Name = "BaseColor", GroupName = "NinjaScriptParameters", Order = 2)]
public Brush BaseColor
{
get { return baseColor; }
set { baseColor = value; }
}

[NinjaScriptProperty]
[Display(Name = "SignalColor", GroupName = "NinjaScriptParameters", Order = 3)]
public Brush SignalColor
{
get { return signalColor; }
set { signalColor = value; }
}

[NinjaScriptProperty]
[Display(Name = "Plot0Width", GroupName = "NinjaScriptParameters", Order = 4)]
public int Plot0Width
{
get { return plot0Width; }
set { plot0Width = Math.Max(1, value); }
}

[NinjaScriptProperty]
[Display(Name = "Plot0Style", GroupName = "NinjaScriptParameters", Order = 5)]
public PlotStyle Plot0Style
{
get { return plot0Style; }
set { plot0Style = value; }
}

[NinjaScriptProperty]
[Display(Name = "Dash0Style", GroupName = "NinjaScriptParameters", Order = 6)]
public DashStyleHelper Dash0Style
{
get { return dash0Style; }
set { dash0Style = value; }
}
#endregion
}
}

Link to comment
Share on other sites

enjoy! FULL NT8 COMPATIBLE

 

[ATTACH=JSON]{"data-align":"none","data-size":"full","title":"BAROVERLPA.jpg","data-attachmentid":810954}[/ATTACH]

 

#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 NinjaTrader.NinjaScript.Indicators;
using System.Windows.Shapes;
using NinjaTrader.Gui.Chart;
using NinjaTrader.NinjaScript.DrawingTools;
#endregion

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Indicators
{
/// <summary>
/// The bar overlap indicator counts the number of bars that overlap with the current bar's range.
/// </summary>
public class BarOverlap : Indicator
{
#region Variables
private int period = 100;
private double numStdDev = 2.0;
private Brush baseColor = Brushes.SlateBlue;
private Brush signalColor = Brushes.Red;
private int plot0Width = 4;
private PlotStyle plot0Style = PlotStyle.Bar;
private DashStyleHelper dash0Style = DashStyleHelper.Solid;
#endregion

protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = "The bar overlap indicator counts the number of bars that overlap with the current bar's range.";
Name = "BarOverlap";

AddPlot(new Stroke(baseColor, plot0Width), plot0Style, "Overlap");


IsOverlay = false;
}
else if (State == State.DataLoaded)
{
// SetPlotAppearance(Plots[0], baseColor, plot0Width, dash0Style);
}
}

protected override void OnBarUpdate()
{
int n = 0;
while (n < CurrentBar)
{
if (Low[0] >= High[n] || High[0] <= Low[n])
break;
n = n + 1;
}
Value[0] = n;

if (Value[0] > SMA(Value, period)[0] + numStdDev * StdDev(Value, period)[0])
PlotBrushes[0][0] = signalColor;
else
PlotBrushes[0][0] = baseColor;
}

private void SetPlotAppearance(Plot plot, Brush brush, int width, DashStyleHelper dashStyle)
{
plot.Pen = new Pen(brush, width) { DashStyle = DashStyleHelperToDashStyle(dashStyle) };
}

private DashStyle DashStyleHelperToDashStyle(DashStyleHelper dashStyleHelper)
{
switch (dashStyleHelper)
{
case DashStyleHelper.Dash:
return DashStyles.Dash;
case DashStyleHelper.DashDot:
return DashStyles.DashDot;
case DashStyleHelper.DashDotDot:
return DashStyles.DashDotDot;
case DashStyleHelper.Dot:
return DashStyles.Dot;
case DashStyleHelper.Solid:
return DashStyles.Solid;
default:
return DashStyles.Solid;
}
}


protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
{
base.OnRender(chartControl, chartScale);
Plots[0].Pen = new Pen(baseColor, plot0Width) { DashStyle = DashStyleHelperToDashStyle(dash0Style) };
}

#region Properties
[browsable(false)]
[XmlIgnore()]
public Series<double> Overlap
{
get { return Values[0]; }
}

[NinjaScriptProperty]
[Display(Name = "NumStdDev", GroupName = "NinjaScriptParameters", Order = 1)]
public double NumStdDev
{
get { return numStdDev; }
set { numStdDev = Math.Max(0, value); }
}

[NinjaScriptProperty]
[Display(Name = "BaseColor", GroupName = "NinjaScriptParameters", Order = 2)]
public Brush BaseColor
{
get { return baseColor; }
set { baseColor = value; }
}

[NinjaScriptProperty]
[Display(Name = "SignalColor", GroupName = "NinjaScriptParameters", Order = 3)]
public Brush SignalColor
{
get { return signalColor; }
set { signalColor = value; }
}

[NinjaScriptProperty]
[Display(Name = "Plot0Width", GroupName = "NinjaScriptParameters", Order = 4)]
public int Plot0Width
{
get { return plot0Width; }
set { plot0Width = Math.Max(1, value); }
}

[NinjaScriptProperty]
[Display(Name = "Plot0Style", GroupName = "NinjaScriptParameters", Order = 5)]
public PlotStyle Plot0Style
{
get { return plot0Style; }
set { plot0Style = value; }
}

[NinjaScriptProperty]
[Display(Name = "Dash0Style", GroupName = "NinjaScriptParameters", Order = 6)]
public DashStyleHelper Dash0Style
{
get { return dash0Style; }
set { dash0Style = value; }
}
#endregion
}
}

 

Please share Barometer NT8 Thanks

Link to comment
Share on other sites

enjoy! FULL NT8 COMPATIBLE

 

[ATTACH=JSON]{"data-align":"none","data-size":"full","title":"BAROVERLPA.jpg","data-attachmentid":810954}[/ATTACH]

 

#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 NinjaTrader.NinjaScript.Indicators;
using System.Windows.Shapes;
using NinjaTrader.Gui.Chart;
using NinjaTrader.NinjaScript.DrawingTools;
#endregion

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Indicators
{
/// <summary>
/// The bar overlap indicator counts the number of bars that overlap with the current bar's range.
/// </summary>
public class BarOverlap : Indicator
{
#region Variables
private int period = 100;
private double numStdDev = 2.0;
private Brush baseColor = Brushes.SlateBlue;
private Brush signalColor = Brushes.Red;
private int plot0Width = 4;
private PlotStyle plot0Style = PlotStyle.Bar;
private DashStyleHelper dash0Style = DashStyleHelper.Solid;
#endregion

protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = "The bar overlap indicator counts the number of bars that overlap with the current bar's range.";
Name = "BarOverlap";

AddPlot(new Stroke(baseColor, plot0Width), plot0Style, "Overlap");


IsOverlay = false;
}
else if (State == State.DataLoaded)
{
// SetPlotAppearance(Plots[0], baseColor, plot0Width, dash0Style);
}
}

protected override void OnBarUpdate()
{
int n = 0;
while (n < CurrentBar)
{
if (Low[0] >= High[n] || High[0] <= Low[n])
break;
n = n + 1;
}
Value[0] = n;

if (Value[0] > SMA(Value, period)[0] + numStdDev * StdDev(Value, period)[0])
PlotBrushes[0][0] = signalColor;
else
PlotBrushes[0][0] = baseColor;
}

private void SetPlotAppearance(Plot plot, Brush brush, int width, DashStyleHelper dashStyle)
{
plot.Pen = new Pen(brush, width) { DashStyle = DashStyleHelperToDashStyle(dashStyle) };
}

private DashStyle DashStyleHelperToDashStyle(DashStyleHelper dashStyleHelper)
{
switch (dashStyleHelper)
{
case DashStyleHelper.Dash:
return DashStyles.Dash;
case DashStyleHelper.DashDot:
return DashStyles.DashDot;
case DashStyleHelper.DashDotDot:
return DashStyles.DashDotDot;
case DashStyleHelper.Dot:
return DashStyles.Dot;
case DashStyleHelper.Solid:
return DashStyles.Solid;
default:
return DashStyles.Solid;
}
}


protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
{
base.OnRender(chartControl, chartScale);
Plots[0].Pen = new Pen(baseColor, plot0Width) { DashStyle = DashStyleHelperToDashStyle(dash0Style) };
}

#region Properties
[browsable(false)]
[XmlIgnore()]
public Series<double> Overlap
{
get { return Values[0]; }
}

[NinjaScriptProperty]
[Display(Name = "NumStdDev", GroupName = "NinjaScriptParameters", Order = 1)]
public double NumStdDev
{
get { return numStdDev; }
set { numStdDev = Math.Max(0, value); }
}

[NinjaScriptProperty]
[Display(Name = "BaseColor", GroupName = "NinjaScriptParameters", Order = 2)]
public Brush BaseColor
{
get { return baseColor; }
set { baseColor = value; }
}

[NinjaScriptProperty]
[Display(Name = "SignalColor", GroupName = "NinjaScriptParameters", Order = 3)]
public Brush SignalColor
{
get { return signalColor; }
set { signalColor = value; }
}

[NinjaScriptProperty]
[Display(Name = "Plot0Width", GroupName = "NinjaScriptParameters", Order = 4)]
public int Plot0Width
{
get { return plot0Width; }
set { plot0Width = Math.Max(1, value); }
}

[NinjaScriptProperty]
[Display(Name = "Plot0Style", GroupName = "NinjaScriptParameters", Order = 5)]
public PlotStyle Plot0Style
{
get { return plot0Style; }
set { plot0Style = value; }
}

[NinjaScriptProperty]
[Display(Name = "Dash0Style", GroupName = "NinjaScriptParameters", Order = 6)]
public DashStyleHelper Dash0Style
{
get { return dash0Style; }
set { dash0Style = value; }
}
#endregion
}
}

 

Please share Barometer NT8 Thanks

any reason why i cannot see the indicator on ninjatrader 8 list to be added to the chart?

Link to comment
Share on other sites

This indicator is disappointing it doesn't indicate when the price is ranging or choppy, meaning if a Number of lookback bars,

closes within the high or low range of the previous 5 bars, it doesn't plot the choppy range

unless im reading this incorrectly

@imfm can this be improved in the code?

Edited by aotegaoteg
Link to comment
Share on other sites

This indicator is disappointing it doesn't indicate when the price is ranging or choppy, meaning if a Number of lookback bars,

closes within the high or low range of the previous 5 bars, it doesn't plot the choppy range

unless im reading this incorrectly

@imfm can this be improved in the code?

 

Yes, if you send me all directions and features clearly explained, I can do it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...