I'm trying to do a ?: construction, and it just won't go! Here's a simplified boildown, I would truly appreciate your help with this.
//This namespace holds Strategies in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Strategies
{
public class TESTING : Strategy
{
private Series<double> test;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
... THE USUAL STUFF HERE...
}
else if (State == State.Configure)
{
}
else if (State == State.DataLoaded)
{
test = new Series<double>(this, MaximumBarsLookBack.Infinite);
}
else if (State == State.Transition)
{
double test = (Close[0] > Close[1]) ? High[0] : ((Close[0] == Close[1]) ? Close[0] : Low[0]);
}
}
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 1)
return;
// Set 1
if (test[0] > test[1])
{
EnterLongLimit(Convert.ToInt32(DefaultQuantity), (Close[0] + (-2 * TickSize)) , "");
}
// Set 2
if (test[0] < test[1])
{
ExitLong(Convert.ToInt32(DefaultQuantity), "", "");
}
Comment