I can't understand why this is happening for one and not for the other. I can set trail percentages and profit percentages, and have them execute the strategy perfectly. However, for optimization purposes, I want to be able to change those around, and thus I have to create #region Properties entries for both. It works for everything, except for profit target, however there don't seem to be any differences, aside from different name.
public class PersonalStrat : Strategy
{
private double stopLossPct = 0.020; // Default setting for StopLossPct
private double profitTargetPct = 0.020; // 5% profit target expected
.... and so on with strategy...
#region Properties
[Range(0.01, double.MaxValue)]
[NinjaScriptProperty]
[Display(Name="ProfitTargetPct", Description="Define how much of profit to stop at", Order=6, GroupName="Parameters")]
public double profitTargetPct
{
get { return profitTargetPct; }
set { profitTargetPct = Math.Max(0.010, value); }
}
[Range(0.001, double.MaxValue)]
[NinjaScriptProperty]
[Display(Name="StopLossPct", Description="Define stop loss percent", Order=5, GroupName="Parameters")]
public double StopLossPct
{
get { return stopLossPct; }
set { stopLossPct = Math.Max(0.010, value); }
}... and so on...
If I remove this bit below, the strategy works as intended with a 2% profit target for executions. However then I cannot optimize it. If I leave it in, it's not showing up in parameters, as I'm getting "The type of 'NinjaTrader.NinjaScript.Strategies.PersonalStrat' already contains a definition for 'profitTargetPct') - and it points to THE LINE SHOWN BELOW...But then why I don't get the same issue for stopLossPct and others.
"[Range(0.01, double.MaxValue)]
[NinjaScriptProperty]
[Display(Name="ProfitTargetPct", Description="Define how much of profit to stop at", Order=6, GroupName="Parameters")]
public double profitTargetPct <<<--------- THIS LINE
{
get { return profitTargetPct; }
set { profitTargetPct = Math.Max(0.010, value); }
}"
Thank you for any ideas
Comment