SmartQuant Discussion
http://www.smartquant.com/forums/

QtyBought & QtySoldShort
http://www.smartquant.com/forums/viewtopic.php?f=42&t=10458
Page 1 of 1

Author:  hagaih [ Tue Feb 19, 2013 6:57 pm ]
Post subject:  QtyBought & QtySoldShort

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.

Author:  Dr. Anton Fokin [ Tue Feb 19, 2013 8:09 pm ]
Post subject:  Re: QtyBought & QtySoldShort

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

Author:  hagaih [ Tue Feb 19, 2013 9:06 pm ]
Post subject:  Re: QtyBought & QtySoldShort

I just want to measure the highest long & short positions during the strategy execution...

Author:  Dr. Anton Fokin [ Tue Feb 19, 2013 9:25 pm ]
Post subject:  Re: QtyBought & QtySoldShort

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

Author:  hagaih [ Tue Feb 19, 2013 10:45 pm ]
Post subject:  Re: QtyBought & QtySoldShort

You're right. this is more accurate.
10x.

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/