SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Tue Dec 10, 2019 12:08 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: QtyBought & QtySoldShort
PostPosted: Tue Feb 19, 2013 6:57 pm 
Offline

Joined: Tue Sep 06, 2011 7:12 pm
Posts: 9
Hello,
Is it fair to say that if I want to know what are the Max Buy & Short positions during my execution the solution for me would be something like -

public override void OnPositionChanged()
{
if (Position != null)
{
MaxBuyPos = Math.Max(MaxBuyPos, (int)Position.QtyBought);
MaxShortPos = Math.Max(MaxShortPos, (int)Position.QtySoldShort);
}
}

10x.


Top
 Profile  
 
PostPosted: Tue Feb 19, 2013 8:09 pm 
Offline

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

what is exactly Max Buy and Short positions?

QtyBought and QtySoldShort indicate how much you bought, sold and sold short building up your position. For example if you execute market orders to buy 100 and sell 200, then you are short 100 (your position), you bought 100, sold 100 and sold short 100.

Regards,
Anton


Top
 Profile  
 
PostPosted: Tue Feb 19, 2013 9:06 pm 
Offline

Joined: Tue Sep 06, 2011 7:12 pm
Posts: 9
I just want to measure the highest long & short positions during the strategy execution...


Top
 Profile  
 
PostPosted: Tue Feb 19, 2013 9:25 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6816
I don't think QtyBought, QtySoldShort would help you then. I suggest you trace max long/short position in OnPositionChanged, something like

if (HasPosition)
{
if (Position.Side == PositionSide.Long)
if (Position.Qty > maxLong)
maxLong = Position.Qty

if (Position.Side == PositionSide.Short)
if (Position.Qty > maxShort)
maxShort = Position.Qty
}

Regards,
Anton


Top
 Profile  
 
PostPosted: Tue Feb 19, 2013 10:45 pm 
Offline

Joined: Tue Sep 06, 2011 7:12 pm
Posts: 9
You're right. this is more accurate.
10x.


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