Can somebody please explain why the below is not plotting (neither Value[0] nor closeGBPUSD5m[0] work).
public class zUSDtrend : Indicator
{
//private double closeEURUSD5m;
private Series<double> closeGBPUSD5m;
//private double closeUSDJPY5m;
//private double closeEURUSD60m;
//private double closeGBPUSD60m;
//private double closeUSDJPY60m;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Indicator here.";
Name = "zUSDtrend";
Calculate = Calculate.OnBarClose;//PriceChange;
IsOverlay = false;
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;
SMA5mPeriod = 8;
SMA60mPeriod = 8;
AddPlot(Brushes.Orange, "closeGBPUSD5m");
//AddPlot(new Stroke(Brushes.Goldenrod, 2), PlotStyle.Bar, "closeGBPUSD5m");
//AddPlot(Brushes.Orange, "closeEURUSD5m");
//AddPlot(Brushes.Orange, "closeUSDJPY5m");
//AddPlot(Brushes.Orange, "closeGBPUSD60m");
//AddPlot(Brushes.Orange, "closeEURUSD60m");
//AddPlot(Brushes.Orange, "closeUSDJPY60m");
}
else if (State == State.Configure)
{
AddDataSeries("GBPUSD", Data.BarsPeriodType.Minute, 5, Data.MarketDataType.Last);
//AddDataSeries("EURUSD", Data.BarsPeriodType.Minute, 5, Data.MarketDataType.Last);
//AddDataSeries("USDJPY", Data.BarsPeriodType.Minute, 5, Data.MarketDataType.Last);
//AddDataSeries("GBPUSD", Data.BarsPeriodType.Minute, 60, Data.MarketDataType.Last);
//AddDataSeries("EURUSD", Data.BarsPeriodType.Minute, 60, Data.MarketDataType.Last);
//AddDataSeries("USDJPY", Data.BarsPeriodType.Minute, 60, Data.MarketDataType.Last);
}
else if (State == State.DataLoaded)
{
closeGBPUSD5m = new Series<double>(this);
}
}
protected override void OnBarUpdate()
{
//Add your custom indicator logic here.
//if (CurrentBar < 1 + SMA5mPeriod)
//{
closeGBPUSD5m[0] = Closes[1][0];
Print("XXX " + Closes[1][0]);
//Value[0] = Closes[1][0];
//closeEURUSD5m = Closes[2][0];
//closeUSDJPY5m = Closes[3][0];
//closeGBPUSD60m = Closes[4][0];
//closeEURUSD60m = Closes[5][0];
//closeUSDJPY60m = Closes[6][0];
//}
}
#region Properties





. w3schools gets me on track over 90% of the time. And I use Google to get to the right help pages on Ninjatrader. Search using "Ninjatrader help" and the important keywords. Google is much better than searching within the site. (any site really... use site name plus keywords and you're there). Everybody trashes google, but it still works great for me. Bing sends me to the marketplace. They always assume I want to buy stuff.
Comment