"Your strategy likely holds one or more recursive properties which could cause Ninjatrader to crash..."
Before you tell me I probably have my property lowercased or with the same name as one of my variables... let me assure you I do not. I have searched the threads and seen where other people had this error and it was always due to some novice programming mistake.
Here is my setup:
I have a class CoreOrder that encapsulates all the variables and methods for an order.
I then also have CoreStrat, which is my base class for all my strategies.
Now, in my CoreOrder class I have a variable:
private int stopType = 1; // 0=fixed, 1=trailing
It also has a property:
[Description("Stop Type: 0=fixed, 1=trailing")]
public int StopType
{
get { return stopType; }
set { stopType = value; }
}
Now, in order to have the option to choose which stop type, I must have a property in my strategy that is shown in the property grid control.
I have the following:
[Description("Order Stop Type: 0=fixed, 1=trailing")]
[GridCategory("Order Exit Parameters")]
[RefreshProperties(RefreshProperties.All)]
public int StopType
{
get { return order.StopType; }
set { order.StopType = value; }
}
Where the variable order is an instance of my CoreOrder object which has already been instantiated. There is nothing recursive about it. I was wondering if the NinjaScript compiler does some regex matching or something to check that the property name and variable used inside are not of the same case or something and maybe it's incorrectly finding the field of the same name and thinking it's recursive? Is this a bug in the Ninjascript compiler?
If you had something like:
propertyName = "StopType";
and propertyTarget = "order.StopType";
and did a check like
if ( System.Text.RegularExpressions.Regex.IsMatch(prope rtyTarget,propertyName,RegexOptions.None) )
{
// throw error about recursive properties
}
Then it would incorrectly identify my setup as recursive.
If it is something I am doing wrong, I'd like to know and how the correct way to do it.
Thanks,
Josh
Comment