"invalid token 'double' in class, struct, or interface member declaration. This is for "private int setProfitTarget;"
I also still get the definition errors for "tradePrice" and for "trade".
Here is how I now have the code:
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// Enter the description of your strategy here
/// </summary>
[Description("Enter the description of your strategy here")]
public class Test2 : Strategy
{
#region Variables
private double tradePrice;
private double trade = false;
private int rSIPeriod;
private int setProfitTarget;
private int setStopLoss;
#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()
{
Add(RSI(RSIPeriod, 1));
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (CrossAbove(RSI(RSIPeriod, 1), Rsilower, 1))
{
SetStopLoss(CalculationMode.Price, Low[0]);
tradePrice = High[2];
stopPrice = Low[0];
trade = true;
}
// Condition set 2
if (Close[0] > tradePrice && trade)
{
EnterLong();
trade = false;
}
}
#region Properties
[Description("Price at which there will be a trade")]
[GridCategory("Parameters")]
public double tradePrice
{
get { return tradePrice; }
set { double tradePrice = Math.Max(1, value); }
}
[Description("Trade false")]
[GridCategory("Parameters")]
public double trade
{
get { return trade = false; }
set { trade = false = Math.Max(1, value); }
}
[Description("RSI period")]
[GridCategory("Parameters")]
public int RSIPeriod
{
get { return RSIPeriod; }
set { rSIPeriod = Math.Max(1, value); }
}
[Description("Profit")]
[GridCategory("Parameters")]
public int SetProfitTarget
{
get { return setProfitTarget; }
set { setProfitTarget = Math.Max(1, value); }
}
[Description("Loss")]
[GridCategory("Parameters")]
public int SetStopLoss
{
get { return setStopLoss; }
set { setStopLoss = Math.Max(1, value); }
}
#endregion
}
}
Comment