SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Mon Oct 19, 2020 6:12 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Fri Sep 16, 2011 6:57 pm 
Offline

Joined: Mon Dec 06, 2010 2:15 am
Posts: 47
Hello All,

Working some relative simple code chunks. Running Windows 7 64B and OpenQuant latest update.

The following piece of code is causing the whole OpenQuant program to stop working and quit.
I was looking for where in my code this problem may be originating, and after searching everywhere, if I isolate the four lines noted below, the program runs as expected. Is this possible? Seems to be throwing some sort of loop but it debugs fine in VS.

Thanks for the assistance.
Red

---------------------------------------
public override void OnPositionValueChanged()
{
// if (HasPosition)
// {
// pnL = Position.GetPnL();
// }
if (pnL >= pnlAdd)


Top
 Profile  
 
PostPosted: Fri Sep 16, 2011 7:01 pm 
Offline

Joined: Mon Dec 06, 2010 2:15 am
Posts: 47
followup. Using Position.GetPNL(); insdie the OnPositionValueChanged call appears to be part of the problem, so I'm wondering if there is a workaround to keep this within this event call?

Thanks
R


Top
 Profile  
 
PostPosted: Fri Sep 16, 2011 7:12 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
Hi,

any error message?

Regards,
Anton


Top
 Profile  
 
PostPosted: Fri Sep 16, 2011 8:15 pm 
Offline

Joined: Mon Dec 06, 2010 2:15 am
Posts: 47
Here is the error message:
---------------------------------


An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll


-----------------------------
This time I debugged with VS and the exception was for this line:

Cross cross = sma1.Crosses(sma2, bar);

The whole this just strange, I'll keep working on it.

Red


Top
 Profile  
 
PostPosted: Fri Sep 16, 2011 8:29 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
Hi,

when I see stack overflow exception, the very first idea that comes into my head is infinite recursion. I suggest you check your code for something like

Code:
int a = 10;

public int A
{
  get { return A; }
}

Console.WriteLine("A = " + A);


Cheers,
Anton


Top
 Profile  
 
PostPosted: Fri Sep 16, 2011 9:50 pm 
Offline

Joined: Mon Dec 06, 2010 2:15 am
Posts: 47
will do, thank you!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group