SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Sat Feb 29, 2020 12:42 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed Jun 29, 2011 4:11 pm 
Offline

Joined: Mon Dec 06, 2010 2:15 am
Posts: 47
Hi Guys,

What I would like to be able to do is have the code monitor multiple independly measured positions within the same underlying and trading context. Is there a way to notate to the OnPositionClosed () or OnStopExecuted () which one of the current positions caused the event handler to fire?
For example, if I have two stops, both below the price, each with a different followup action, could I use two OnStopEcexuted () event handlers and assign one to fire with the first stop and the other two fire with the second stop.
Ideally I would be able to have a number of event handlers each providing a different bit of code logic and each independently set to fire for a separately tracked event. What would be the best way to acheive this, or what is the design pattern most often used to resolve this need?

Thanks!


Top
 Profile  
 
PostPosted: Wed Jun 29, 2011 4:47 pm 
Offline

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

it's not possible to have two different handlers, but you can distinguish between different stops using Stop parameter of OnStopExecuted...

Code:
OnStopExecuted(Stop stop)
{
  if (stop == stop1)
     // do this

  if (stop == stop2)
    // do that
}


Regards,
Anton


Top
 Profile  
 
PostPosted: Wed Jun 29, 2011 5:21 pm 
Offline

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

Thank you for the clarification, and the quick reply as well!
Hopefully others may find it useful as well.

Cheers!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 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:  
cron
Powered by phpBB® Forum Software © phpBB Group