Back

Total Return strategy questions

We are trying to build a total return momentum strategy using a methodology that will facilitate live trading. I understand the "dataDataNormalizationMode.TotalReturn" does not facilitate live trading, and that it does not activate cash dividends for long positions.

I understand the better way is to use Raw prices and to activate Dividend Events, and to create indicators for each symbol we want to rank (equal to Raw Price Plus Accumulated Dividends) and to rank these 'compound symbols,' in our security selection process.

Once securities are Ranked by Total Return, on the basis of Raw Price Plus Cash Dividends, we then need to be able to buy the underlying symbols using Raw Price and to have cash dividends come into the portfolio automatically.

However, the code we have now in our abbreviated project, attached, contains a dividend activation code sample received from QC (beginning on code line 48), which only activates dividends for one symbol, SPY, and our attempts to address the multiple symbols in our symbols lists (SymbolList1 and SymbolList2) have not worked: you can't just copy and paste the dividend event activation code for multiple symbols.

How do you spell HELP?

If someone would be kind enough to take a look at our approach here and to put us on the right path we would appreciate that very much! What we are trying to do follows.

1. We need to activate dividends for a LIST of sticks.
2. We need to build compound symbols for each stock in our lists that is equal to appreciation plus accumulated dividends, giving us Total Return values.
3. Then we need to be able to trade the symbols underlying these compound symbols based on Raw prices with cash dividends paid into the portfolio.

In this project these lists are SymbolList1 and SymbolList2, beginning on code line 87.

It is important for us to capture the total return of our holdings, appreciation plus cash dividends. And we need to be able to Rank the underlying symbols based on their Total Return as part of the security selection process.

The performance available from such an approach has been independently verified and tested. We are just attempting to build this algorithm on QC to improve our control of strategy testing, and to facilitate our trading on IB; also because the QC platform and community are so damn cool!

Thank you!
Update Backtest








Project backtest with code, inadvertently deleted, follows. Sorry about that!
0


Hey @John,

Please, let me give you a word of advice, if you need help with an +400-lines-of-code algorithm, better share a well documented code. A well documented code is a courtesy to the one who will read the code and is a powerful tool for yourself.

Best, JJ
2

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.


In C#, anytime we're able to accomplish getting something to work a single item and we want it to work with multiple items, the first thought that goes through my mind is this should be a class. The class can encapsulate the logic/behavior required to perform the specific task. Once it is defined in an encapsulated class it should be easy to instantiate more of these for each set of input parameters.

In this case it sounds like the input parameters are different symbols and the data this class needs to receive is the Dividend data. So I've quickly defined a TotalReturnData class that does just that. He has an OnData(Dividend) method which will update his internal _sumOfDividends state. He then exposes the raw closing price indicator and an indicator for the total return close.

Hope this helps!
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.


Hey @John, any luck so far?
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.


Masterful job. We are making great progress with our implementation thanks to your insightful suggestions.

Ranking stocks based on total returns is no longer a mystery. And cash dividends arrive in the portfolio like magic!

Thank you.
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