I am running through the Ninjascript at link http://www.ninjatrader-support.com/H...BarsSinceEntry. When I compile, I get a Compile error CS0102. My Code is shown below. Can you please show me what I am doing wrong. Thanks
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
#endregion
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// RSI WITH STOP LOSS AND PROFIT TARGET
/// </summary>
[Description("RSI WITH STOP LOSS AND PROFIT TARGET")]
public class TUTORIAL2 : Strategy
{
#region Variables
// Wizard generated variables
private int RSIPERIOD = 14; // Default setting for RSIPERIOD
private int RSISMOOTH = 3; // Default setting for RSISMOOTH
private int PROFITTARGET = 12; // Default setting for PROFITTARGET
private int STOPLOSS = 6; // Default setting for STOPLOSS
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
CalculateOnBarClose = true;
//This will ad the RSI indicator to the chart for visualisation
Add(RSI(RSIPeriod, RSISmooth));
//Add stop loss and profit target
SetStopLoss(CalculationMode.Ticks, StopLoss);
SetProfitTarget(CalculationMode.Ticks, ProfitTarget);
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (CurrentBar < RSIPeriod)
return;
if (CrossAbove(RSIPeriod, RSISmooth,20, 1))
EnterLong();
}
#region Properties
[Description("RSI PERIOD")]
[Category("Parameters")]
public int RSIPERIOD
{
get { return rSIPERIOD; }
set { rSIPERIOD = Math.Max(1, value); }
}
[Description("RSI SMOOTH")]
[Category("Parameters")]
public int RSISMOOTH
{
get { return rSISMOOTH; }
set { rSISMOOTH = Math.Max(1, value); }
}
[Description("PROFIT TARGET OFFSET")]
[Category("Parameters")]
public int PROFITTARGET
{
get { return pROFITTARGET; }
set { pROFITTARGET = Math.Max(1, value); }
}
[Description("STOP LOSS OFFSET")]
[Category("Parameters")]
public int STOPLOSS
{
get { return sTOPLOSS; }
set { sTOPLOSS = Math.Max(1, value); }
}
#endregion
}
}
Comment