Back

Reducing position size

Hello everyone,

in my current algorithm I need to reduce position size in some cases. I discovered that this is not possible with SetHoldings though. When I'm invested in a stock having used SetHoldings(symbol, x) and then want to reduce the position size to half of my buying power with SetHoldings(symbol, 1/2), it just liquidates the position instead. Why is that? Is there another way to achieve what I need?

Kind regards,

Christian Lauer

Update Backtest








hmm i would also be interested into an answer or maybe is there planed another method/function for people that want to use a dfferent behaviour ...... :)

also this question cames up hear by another guy:

To QC team (or QC community) - a) why is Portfolio.SetCash skewing returns, net profit calculations in backtesting, b) what's the behavior of SetHoldings (by percent); does it liquidate or adjust up/down based on percentage.

https://www.quantconnect.com/forum/discussion/3285/dynamic-rebalancing-with-tax-harvesting
0

I'd be glad for further answers as this is an integral part of my algorithm and if it's not possible I'll have to think of something new.

0

As I didn't get any more answers, I suppose it is not possible. Could someone from the staff please tell me whether you plan to implent it in the future or whether there is a reason why you don't want to have this behaviour?

0

Sorry Christian this question slipped past; can you post a tangible example; reviewing the code shows it should scale down the holdings appropriately.

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Hello Jared,

when trying to reproduce the error, I spotted a line in the code which was causing the problem. Next time I should check my code better.

Kind regards,

Christian Lauer

0

I want to thank everyone for their support of here on this forum at QC.

I am also interested in the ability to reduce a position size.

Has this issue been resloved?

Thank you for your help.

0

Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed