Hello fellow geeks,
I'm fresh from boot-camp (noob alert) and didn't find anything helpful in the community.
I'm writing a strategy that I've successfully implemented in MT5 but here I got to a dead end…I've set my bot to buy some stocks at the end of every month. The goal here is to hold each stock for a year and then liquidate after 245 trading days (from the day of purchase) if the trade is a loss, or wait to hit 265 and then sell, if the trade is in profit (tax-optimized).
All the tutorials and docs I've been through talk in detail about how to liquidate on OnSecuritiesChanged() but nothing really on how to get the data of any opened position.
I know you guys have a ton more experience than me… any suggestions?
Mak K
Hi Alberto,
This is how you can check if your position is in profit or loss and check if the current day was x days ago from your buy day. Let me know if you have any more questions!
Vladimir
Alberto_Papel
-> any suggestions?
1.Can you share successfully implemented in MT5 code?
2.Can you share your attempts to reproduce it QC API?
3.What is your definition of profit (tax-optimized)?
Alberto_Papel
Mak K Thanks a lot for your help.
I'll try to make it part of my algorithm and make it work. I'll post my code as I build it through trial & error.
😊
Alberto_Papel
Mak K also, noob question
I'm using this link as the most extensive and organized docs for CQAlgo…
https://lean-api-docs.netlify.app/index.html
Is there anything else more user friendly out there?
Jared Broad
Currently yes sorry that is the best source, but 3 of us are working hard on the new docs!
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.
Alberto_Papel
Thanks Jared Broad
I really like the passion that transpire through the community from the QC team.
Writing the Docs sounds like a daunting task! All the best, look forward to see it :)
Alberto_Papel
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!