SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Sat Dec 14, 2019 3:59 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: ClosePosition()
PostPosted: Fri Oct 17, 2008 4:12 pm 
Offline

Joined: Wed Jan 09, 2008 12:19 pm
Posts: 49
Hi,

Does ClosePosition mean it closes out everything including limit and stop order that I sent ?

Thanks.


Last edited by octrout on Sun Oct 19, 2008 1:36 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 18, 2008 5:37 pm 
Offline

Joined: Thu Jun 08, 2006 3:56 pm
Posts: 537
Location: BC Canada
No, I think ClosePosition just closes the position. It seems to me that you are responsible for removing orders yourself. If you think about it, OQ must leave all Limit/Stop orders alone, because for all OQ knows, those are orders that you want to use to get _into_ a new position.

You have to remember which orders you have outstanding (store them in a variable), and then cancel them yourself. Something like:

Code:
Order limit;
..
limit = LimitOrder (...);
limit.Send();


// when you want to cancel them
if (limit != null)
  limit.Cancel();
limit = null;


Top
 Profile  
 
 Post subject: Re: ClosePosition()
PostPosted: Mon Oct 20, 2008 1:00 pm 
Offline
Site Admin

Joined: Thu Jul 17, 2003 10:39 am
Posts: 1478
octrout wrote:
Hi,

Does ClosePosition mean it closes out everything including limit and stop order that I sent ?

Thanks.


No, this function sends a market order to close current position of the instrument only. It does not affect other orders.

_________________
SmartQuant Development Team


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 02, 2008 2:35 am 
Offline

Joined: Mon Nov 24, 2008 8:44 pm
Posts: 36
Is there a way to close two positions (two different instruments) in the portfolio at the same barslide event?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 02, 2008 12:54 pm 
Offline

Joined: Wed Oct 08, 2003 1:06 pm
Posts: 833
Hi,

Yes, you can use the following sample to close positions on instr1 and instr2:
Code:
Sell(instr1 , Portfolio.Positions[instr1].Qty);
Sell(instr2 , Portfolio.Positions[instr2].Qty);


Regards,
Sergey.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 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