1.- bwAO - this is the whole thing below (really short).... What method do I call upon to process AddChartIndicator for this? I understand it's just median SMA differences on every bar update...But WOULD be very pleasant to add this to the strategy chart.
//This namespace holds Indicators in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Indicators
{
// Changes from Nt7:
// - reduce to 1 plot for the histogram bar then color the bar (was previously 2 colored plots per bar).
// - Used IsRising to color bars instead of calculating difference from first tick.
// Converted to NT8beta5
public class bwAO : Indicator
{
private double ao = 0; // SMA difference
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Awesome Oscillator Technical Indicator (AO) is a 34-period simple moving average, plotted through the middle points of the bars (H+L)/2, which is subtracted from the 5-period simple moving average, built across the central points of the bars (H+L)/2. It shows us quite clearly what’s happening to the market driving force at the present moment.";
Name = "bwAwesomeOscillator";
Calculate = Calculate.OnEachTick; //compatibility with NT7 version
IsOverlay = false;
DisplayInDataBox = true;
DrawOnPricePanel = true;
DrawHorizontalGridLines = true;
DrawVerticalGridLines = true;
PaintPriceMarkers = true;
ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
IsSuspendedWhileInactive = false;
AddPlot(new Stroke(Brushes.Gray, 6), PlotStyle.Bar, "AOBarPlot");
AddPlot(Brushes.Transparent, "AOLinePlot");
AddLine(Brushes.Black, 0, "ZeroLine");
}
}
protected override void OnBarUpdate()
{
ao = SMA(Median,5)[0] - SMA(Median,34)[0]; // Get SMA difference
AOBarPlot[0] = ao; // plot the bar histogram
AOLinePlot[0] = ao; // plot the line on top of the histogram
if (IsRising(AOBarPlot)) // Color Bar based on Current value to initial value
{
PlotBrushes[0][0] = Brushes.Green;
}
else
{
PlotBrushes[0][0] = Brushes.Red;
}
}
#region Properties
[Browsable(false)]
[XmlIgnore]
public Series<double> AOBarPlot
{
get { return Values[0]; }
}
[Browsable(false)]
[XmlIgnore]
public Series<double> AOLinePlot
{
get { return Values[1]; }
}
#endregion
}
}
#region NinjaScript generated code. Neither change nor remove.
namespace NinjaTrader.NinjaScript.Indicators
{
public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
{
private bwAO[] cachebwAO;
public bwAO bwAO()
{
return bwAO(Input);
}
public bwAO bwAO(ISeries<double> input)
{
if (cachebwAO != null)
for (int idx = 0; idx < cachebwAO.Length; idx++)
if (cachebwAO[idx] != null && cachebwAO[idx].EqualsInput(input))
return cachebwAO[idx];
return CacheIndicator<bwAO>(new bwAO(), input, ref cachebwAO);
}
}
}
namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
{
public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
{
public Indicators.bwAO bwAO()
{
return indicator.bwAO(Input);
}
public Indicators.bwAO bwAO(ISeries<double> input )
{
return indicator.bwAO(input);
}
}
}
namespace NinjaTrader.NinjaScript.Strategies
{
public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
{
public Indicators.bwAO bwAO()
{
return indicator.bwAO(Input);
}
public Indicators.bwAO bwAO(ISeries<double> input )
{
return indicator.bwAO(input);
}
}
}
#endregion
#region NinjaScript generated code. Neither change nor remove.
namespace NinjaTrader.NinjaScript.Indicators
{
public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
{
private bwAO[] cachebwAO;
public bwAO bwAO()
{
return bwAO(Input);
}
public bwAO bwAO(ISeries<double> input)
{
if (cachebwAO != null)
for (int idx = 0; idx < cachebwAO.Length; idx++)
if (cachebwAO[idx] != null && cachebwAO[idx].EqualsInput(input))
return cachebwAO[idx];
return CacheIndicator<bwAO>(new bwAO(), input, ref cachebwAO);
}
}
}
namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
{
public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
{
public Indicators.bwAO bwAO()
{
return indicator.bwAO(Input);
}
public Indicators.bwAO bwAO(ISeries<double> input )
{
return indicator.bwAO(input);
}
}
}
namespace NinjaTrader.NinjaScript.Strategies
{
public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
{
public Indicators.bwAO bwAO()
{
return indicator.bwAO(Input);
}
public Indicators.bwAO bwAO(ISeries<double> input )
{
return indicator.bwAO(input);
}
}
}
#endregion
Comment