Back

Trailing Orders

Hi folks,
I'm thinking in develop a class to manage trailing orders. The draft idea is to instantiate a the class at every entry, the object will manage the stop loss price, the exit price and execute the orders.
But first I'd like to know; Is a good implementation? Am I doing some kind of shotgun surgeon?
Thanks in advance. JJ
Update Backtest






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.



@Levi; Now orders are disconnected from order tickets. The algorithm "requests" and order, and you get a ticket for the request which you can cancel or update directly. This didn't affect 99% of people but you're right it does break this algorithm.

We split it up because the transactions handler who processes the orders and the algorithm are on different threads. If you were to modify the order directly it can cause cross threading issues and kill an algorithm.

As such; the actual order isn't really used in the same sense anymore. Its a system of order tickets and order requests. You can submit a create-request, update-request and cancel-request. The order is tracked with its ticket.

You could tweak this to get it working I think? Theres no reason why you can't have a order ticket being updated to implement the trailing stop. See here for how to do it.  

 

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.


@Levi,

@Jared already gave you a great answer. Just in case, here is a strategy with an implementation of a trailing stop loss; however I'm not sure that strategy still works.

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