I have coded a few indicators in TOS (thinkscript/thinkorswim) - not a Developer - and I am trying to transfer them over to Ninjatrader. I am doing the transfer step by step and checking along the way. The problem I have run into is the inability to plot an custom indicator (even if it is a standard one). I can change colors of bars....I can draw lines/texts but I cannot get a simple indicator code to draw. I need to figure this out to move on to the more complicated stuff.
I am getting no coding errors....it compiles. Trying to simply draw this just to start before I move on.....I want to plot this:
PriceH[0] = EMA(High, 4)[0];
PriceL[0] = EMA(Low, 4)[0];
My Code has the following:
public class BigT_FT_DayTrade_V2 : Indicator
{
private Series<double> trend;
private Series<double> PriceH;
private Series<double> PriceL;
and
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
.......(standard stuff here).....
IsSuspendedWhileInactive = true;
BarsRequiredToPlot = 20;
Period = 20;
MaximumBarsLookBack = MaximumBarsLookBack.Infinite;
AddPlot(new Stroke(Brushes.Yellow), PlotStyle.HLine, "PriceH");
AddPlot(new Stroke(Brushes.Orange), PlotStyle.HLine, "PriceL");
and
else if (State == State.DataLoaded)
{
trend = new Series<double>(this, MaximumBarsLookBack.Infinite);
PriceH = new Series<double>(this, MaximumBarsLookBack.Infinite);
PriceL = new Series<double>(this, MaximumBarsLookBack.Infinite);
and
protected override void OnBarUpdate()
{
if (CurrentBar < Period)
return;
and farther down.....
trend[0] = 0;
PriceH[0] = EMA(High, 4)[0];
PriceL[0] = EMA(Low, 4)[0];
Comment