I've read a couple forums on how to write this, and ended up here: https://ninjatrader.com/support/foru...t-plots?t=4991
This is for NT8: When I compile it, I get the following error: tickentry already contains a definition for "entryindication" Thank you for your help. I dont know how to place the code in a zipfile so I just pasted it here. sorry for the inconvenience.
//This namespace holds Indicators in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Indicators
{
public class TickEntry : Indicator
{
private Series<bool> EntryIndication;
private double exposedVariable;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Will generate a signal for Blackbird to place a trade when current bar's tick count is less than x ticks";
Name = "TickEntry";
Calculate = Calculate.OnEachTick;
CountDown = true;
TickEntry = 100;
IsOverlay = false;
DisplayInDataBox = true;
DrawOnPricePanel = false;
DrawHorizontalGridLines = false;
DrawVerticalGridLines = false;
PaintPriceMarkers = false;
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;
}
else if (State == State.Configure)
{
EntryIndication =new Series<bool>(this);
}
}
protected override void OnBarUpdate()
{
double periodValue = (BarsPeriod.BarsPeriodType == BarsPeriodType.Tick) ? BarsPeriod.Value : BarsPeriod.BaseBarsPeriodValue;
double tickCount = ShowPercent ? CountDown ? (1 - Bars.PercentComplete) * 100 : Bars.PercentComplete * 100 : CountDown ? periodValue - Bars.TickCount : Bars.TickCount;
string tick1 = (BarsPeriod.BarsPeriodType == BarsPeriodType.Tick
|| ((BarsPeriod.BarsPeriodType == BarsPeriodType.HeikenAshi || BarsPeriod.BarsPeriodType == BarsPeriodType.Volumetric) && BarsPeriod.BaseBarsPeriodType == BarsPeriodType.Tick) ? ((CountDown
? NinjaTrader.Custom.Resource.TickCounterTicksRemain ing + tickCount : NinjaTrader.Custom.Resource.TickCounterTickCount + tickCount) + (ShowPercent ? "%" : ""))
: NinjaTrader.Custom.Resource.TickCounterBarError);
if (CurrentBar == 0)
{
ChkLevel = (BarsPeriod.BarsPeriodType == BarsPeriodType.HeikenAshi && BarsPeriod.BaseBarsPeriodType == BarsPeriodType.Tick) ? BarsPeriod.BaseBarsPeriodValue : BarsPeriod.Value;
// Tick Counter is less than Tick Entry
if (TickEntry < chklevel)
/* This condition is considered so we set "EntryIndication" object to true */
EntryIndication[0] = (true);
}
exposedVariable = Close[0];
}
#region Properties
// Creating public properties that access our internal Series<bool> allows external access to this indicator's Series<bool>
[Browsable(false)]
[XmlIgnore]
public Series<bool> EntryIndication
{
get { return EntryIndication; } // Allows our public EntryIndication Series<bool> to access and expose our interal bearIndication Series<bool>
}
public double ExposedVariable
{
// We need to call the Update() method to ensure our exposed variable is in up-to-date.
get { Update(); return exposedVariable; }
}
#endregion
}
}
#region NinjaScript generated code. Neither change nor remove.
namespace NinjaTrader.NinjaScript.Indicators
{
public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
{
private TickEntry[] cacheTickEntry;
public TickEntry TickEntry()
{
return TickEntry(Input);
}
public TickEntry TickEntry(ISeries<double> input)
{
if (cacheTickEntry != null)
for (int idx = 0; idx < cacheTickEntry.Length; idx++)
if (cacheTickEntry[idx] != null && cacheTickEntry[idx].EqualsInput(input))
return cacheTickEntry[idx];
return CacheIndicator<TickEntry>(new TickEntry(), input, ref cacheTickEntry);
}
}
}
namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
{
public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
{
public Indicators.TickEntry TickEntry()
{
return indicator.TickEntry(Input);
}
public Indicators.TickEntry TickEntry(ISeries<double> input )
{
return indicator.TickEntry(input);
}
}
}
namespace NinjaTrader.NinjaScript.Strategies
{
public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
{
public Indicators.TickEntry TickEntry()
{
return indicator.TickEntry(Input);
}
public Indicators.TickEntry TickEntry(ISeries<double> input )
{
return indicator.TickEntry(input);
}
}
}
#endregion
Comment