Back

Stop Loss Reduce only

Hi!

Is it possible to setup stopmarket is a way that only reduces the position? 

for example, if i have a position of +1000, and stop market of -3000, when stopmarket is triggered, i'll end up with a position of -2000.

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.


Hi Armin,

Sure, this is absolutely possible. All you need to do is assign a negative integer to the number of shares argument in self.StopMarketOrder(). You can view more documentation on Trading and Orders here.

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.


Yes but if the new negative order is larger than standing order, position will flip, right?

 

0

I don't know know if that is possible but you could definitley backtest that and let us know. I don't know why you would want to do this. when i originally read your post title, I was tinking you were asking if you could decrease your risk.

say you are Long 2000 shares,

some signal triggers and you want to cut risk so you

Short 1000 shares

Now you are long 1000.

This could protect UnrealizedGains 

0

Hey,

the reasoning behind it is simple: trailing stop loss to close the entire position.

 

0

Armin,

You could place a Stop Market Order that uses the minimum, or maximum, between a group of values. Using this logic, you'll never place an order to sell more than your current long position, or vice verse if you are closing out a short position. I've attached a backtest below that show's how this can be implemented.
 

Although Trailing Stop-Orders are not available as order type yet, a Trailing Stop-Order type will be added soon to LEAN. Follow this issue on GitHub to track the progress and you can see an implementation of a hack to mimic Trailing Stop-Orders here.

 

 

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.


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