Back

Weird Behavior of Liquidate() and Profits

I can'nt anderstand the way liquidate works. I tried buing and liquidating at the same time and the list of orders seams very strange.

I think I am having a problome anderstanding the behavior of the Liquidate() function.

Thanks in advance.

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 Miriam,

I highly recommend completing the boot camps. They are the best way to learn how Lean works.  You can also use the documentation to learn more about trading and indicators.

Best
Rahul

1

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.


My concern is also how the rescue algorithm loses so much, maybe there is a way to reverse it? And the algorithm will be profitable

Thank you!!

1

Hi Miriam,

We can reverse the strategy by changing the algorithm's market long order inside HandleRenkoClose into a market short order

MarketOrder(pear,-5000);

Looking at the attached backtest which implements this change, we see the strategy still has a negative return. This is because of the fees incurred by placing over 10,000 trades throughout the backtest.

Best,
Derek Melchin

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.


Thanks so much for your reply,
But the reason for the decline is not because of the fees,
Fees are zero and still have minus

Thank you

 

1

Hey Miriam,

The algorithm loses money because the algorithm loses more often than it wins. We can observe this in the overview tab of the backtest report. The rolling statistics section allows us to view the loss rate up to 4 significant digits. Here we can see that the average loss rate is greater than 0.5000. This is what produces the the net return of -0.139%.

Best
Rahul

1

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.


Why can't I see the answers ??

1

Thank you Rahul!
If he loses, when we turn him around he should make a profit, why doesn't it work ???

Thank you very much

1

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