NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > Application Technical Support > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

Reply
 
Thread Tools Display Modes
Old 04-06-2012, 11:33 PM   #1
d1g1talfr3ak
Junior Member
 
Join Date: Nov 2011
Posts: 11
Thanks: 0
Thanked 1 time in 1 post
Default Incorrect recursive properties error

Okay... when I compile my strategy I get the message:

"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
d1g1talfr3ak is offline  
Reply With Quote
Old 04-07-2012, 07:56 AM   #2
koganam
Senior Member
 
Join Date: Feb 2008
Location: Durham, North Carolina, USA
Posts: 3,356
Thanks: 24
Thanked 1,304 times in 1,067 posts
Send a message via Skype™ to koganam
Default

That looks like it is trying to define the (object)order's StopType from order, which would be recursive.

I think it might be more correct to simply define the startegy's StopType property as an unadorned integer, and then assign that value to the correct order property inside the code.
koganam is offline  
Reply With Quote
The following user says thank you to koganam for this post:
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error in strategy - incorrect entries and exits on next bar Zigman Strategy Development 4 04-02-2012 11:01 AM
Recursive Property Error ?? AresBowman Strategy Development 3 06-17-2010 11:23 AM
Funny error when changing chart properties noincomenojobnoassets Version 7 Beta General Questions & Bug Reports 4 04-20-2010 04:25 AM
recursive parameter error junkone General Programming 2 11-20-2008 07:08 AM
Recursive Properties zoltran General Programming 3 05-07-2008 01:29 AM


All times are GMT -6. The time now is 08:31 AM.