Snippet from the top of my code. The last 2 lines at the bottom in red before the //break\\ throw up the CS0021 error. The lines after the break in red throw up CS0021. Help please! :-)
using NinjaTrader.NinjaScript;
using NinjaTrader.NinjaScript.Strategies;
using NinjaTrader.NinjaScript.Indicators;
using NinjaTrader.Data;
using NinjaTrader.NinjaScript.DrawingTools;
using System.Windows.Media;
namespace NinjaTrader.NinjaScript.Strategies
{
public class EnhancedQuadStochasticStrategy : Strategy
{
// Declare Stochastics indicators
private Stochastics stoch1;
private Stochastics stoch2;
private Stochastics stoch3;
private Stochastics stoch4;
// Trend/volume indicators
private VWAP vwap;
private EMA ema9;
private EMA ema20;
private ADX adx;
private SMA volumeSMA;
// Configurable parameters
private int volumeSMAPeriod = 20;
private int adxThreshold = 25;
private int confirmationBars = 2;
// Visual/sound settings
private SolidColorBrush buyArrowColor = Brushes.Lime;
private SolidColorBrush sellArrowColor = Brushes.Red;
private string longSound = "Alert2.wav";
private string shortSound = "Alert3.wav";
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = "Enhanced Quad Stochastic Strategy with Fakeout Filters";
Name = "EnhancedQuadStochasticStrategy";
Calculate = Calculate.OnBarClose;
EntriesPerDirection = 1;
IsExitOnSessionCloseStrategy = true;
ExitOnSessionCloseSeconds = 30;
BarsRequiredToTrade = 20;
}
else if (State == State.Configure)
{
AddDataSeries(Data.BarsPeriodType.Minute, 1);
}
else if (State == State.DataLoaded)
{
stoch1 = Stochastics(5, 3, 3);
stoch2 = Stochastics(14, 3, 3);
stoch3 = Stochastics(21, 5, 5);
stoch4 = Stochastics(50, 10, 10);
vwap = VWAP(BarsArray[1]);
ema9 = EMA(9);
ema20 = EMA(20);
adx = ADX(14);
volumeSMA = SMA(Volume, volumeSMAPeriod);
}
}
protected override void OnBarUpdate()
{
if (CurrentBar < 50) return;
// Skip first 15 mins and last 30 mins of session
if (Times[0][0].TimeOfDay.TotalMinutes < 15 * 60 + 30 ||
Times[0][0].TimeOfDay.TotalMinutes > 16 * 60 - 30) return;
// Long entry conditions (using Values[0] for %K, Values[1] for %D)
bool isLongSignal =
stoch1.Values[0][0] > stoch1.Values[1][0] &&
stoch2.Values[0][0] > stoch2.Values[1][0] &&
stoch3.Values[0][0] > stoch3.Values[1][0] &&
stoch4.Values[0][0] > stoch4.Values[1][0] &&
stoch1.Values[0][0] < 20 && stoch2.Values[0][0] < 20 && stoch3.Values[0][0] < 20 && stoch4.Values[0][0] < 20 &&
Close[0] > ema9[0] && ema9[0] > ema20[0] &&
Close[0] > vwap.VWAP[0] &&
adx.ADX[0] > adxThreshold &&
/////////////// BREAK \\\\\\\\\\\\\\
if (isLong && (Close[i] < ema9[i] || Close[i] < vwap.VWAP[i]))
return false;
if (!isLong && (Close[i] > ema9[i] || Close[i] > vwap.VWAP[i]))
return false;

Comment