And precisely:
If I place it in the namespace GG, then Ninjatrader changes the line of its namespace into "NinjaTrader.NinjaScript.Indicators.GG" which is ok.
But then it doesn't compile because apparently the Ninja Generated Code forgets to specify that the class is in the namespace GG of NinjaTrader.NinjaScript.Indicators.
I figured out that the offending line in the Ninja Generated Code is triggered by the enumerator being placed in the namespace NinjaTrader.NinjaScript namespace.
It seems to me that I have to place the enumerator in this namespace because it has to be seen globally and also by the cache of MarketAnalyzerColumns and Strategies
The error is "The type or namespace name "AATest could not be found" in the indicator cache section.
Can someone clarify?
Best
G
On the Ninja generated code at line 50 it says. GG is missing !
namespace NinjaTrader.NinjaScript.Indicators
{
public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
{
private AATest[] cacheAATest;
public AATest AATest(AATest2Tag colorBars)
{
I attached it as a zip but the code is here also: This code compiles correctly
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace NinjaTrader.NinjaScript
{
public enum AATest2Tag
{
Neither = 0, Body = 1, Outline = 2, BodyAndOutline = 3
}
}
namespace NinjaTrader.NinjaScript.Indicators
{
public class AATest : Indicator
{
protected override void OnStateChange()
{
switch (State)
{
case State.SetDefaults:
Name = "AATest";
Description = "AATest";
break;
case State.DataLoaded:
break;
}
}
protected override void OnBarUpdate()
{
}
[NinjaScriptProperty]
[Display(Name = "ColorBars", Description = "", GroupName = "Plot Colors", Order = 1)]
public AATest2Tag ColorBars { get { return this.colorBars; } set { this.colorBars = value; } } //{ get; set ; }
private AATest2Tag colorBars = AATest2Tag.Neither;
}
}
The code once moved into the GG folder becomes as follows and does not compile !
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace NinjaTrader.NinjaScript
{
public enum AATest2Tag
{
Neither = 0, Body = 1, Outline = 2, BodyAndOutline = 3
}
}
namespace NinjaTrader.NinjaScript.Indicators.GG
{
public class AATest : Indicator
{
protected override void OnStateChange()
{
switch (State)
{
case State.SetDefaults:
Name = "AATest";
Description = "AATest";
break;
case State.DataLoaded:
break;
}
}
protected override void OnBarUpdate()
{
}
[NinjaScriptProperty]
[Display(Name = "ColorBars", Description = "", GroupName = "Plot Colors", Order = 1)]
public AATest2Tag ColorBars { get { return this.colorBars; } set { this.colorBars = value; } } //{ get; set ; }
private AATest2Tag colorBars = AATest2Tag.Neither;
}
}
#region NinjaScript generated code. Neither change nor remove.
namespace NinjaTrader.NinjaScript.Indicators
{
public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
{
private AATest[] cacheAATest;
public AATest AATest(AATest2Tag colorBars)
{
return AATest(Input, colorBars);
}
public AATest AATest(ISeries<double> input, AATest2Tag colorBars)
{
if (cacheAATest != null)
for (int idx = 0; idx < cacheAATest.Length; idx++)
if (cacheAATest[idx] != null && cacheAATest[idx].ColorBars == colorBars && cacheAATest[idx].EqualsInput(input))
return cacheAATest[idx];
return CacheIndicator<AATest>(new AATest(){ ColorBars = colorBars }, input, ref cacheAATest);
}
}
}
namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
{
public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
{
public Indicators.AATest AATest(AATest2Tag colorBars)
{
return indicator.AATest(Input, colorBars);
}
public Indicators.AATest AATest(ISeries<double> input , AATest2Tag colorBars)
{
return indicator.AATest(input, colorBars);
}
}
}
namespace NinjaTrader.NinjaScript.Strategies
{
public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
{
public Indicators.AATest AATest(AATest2Tag colorBars)
{
return indicator.AATest(Input, colorBars);
}
public Indicators.AATest AATest(ISeries<double> input , AATest2Tag colorBars)
{
return indicator.AATest(input, colorBars);
}
}
}
#endregion

Comment