I have coded an example strategy that uses the following concepts:
* rolling window of type tradebar.
* consolidated 15 min bar from 1min data.
* Bolingerband indicator of timeframe consolidated
Error: cannot compare tradebar to decimal with operator >
Is there a required way to compare the decimal components of the tradebar to the decimal price? I tried to pull the components out of the BB to create windows as well but I am missing something.
RollingWindow<TradeBar> _datawindow = new RollingWindow<TradeBar>(Hist);
RollingWindow<BollingerBandState> _bbwindow = new RollingWindow<BollingerBandState>(Hist);
RollingWindow<decimal> _bbupperwindow = new RollingWindow<decimal>(Hist);
RollingWindow<decimal> _bblowerwindow = new RollingWindow<decimal>(Hist);
.
.
.
if ( _datawindow[0].Close < _bbupperwindow[0] && _datawindow[1] > _bbupperwindow[1] && !Portfolio.HoldStock)
Thanks,
Dan
Dan Hill
Note: I typed that last part incorrect. There should be a .Close on the _datawindow[1].
Alexandre Catarino
It was a typo, right?
I believe your algorithm is a version of the project I am attaching, please checkout the adaptiations:
private RollingWindow<TradeBar> Bar; private RollingWindow<BollingerBandState> BBWin;
In OnData:
if (Bar[0].Close < BBWin[0].UpperBand && Bar[1].Close > BBWin[1].UpperBand && !Portfolio.HoldStock) { SetHoldings(_spy, 1); }
Dan Hill
Thanks... I did not see the typo for a few days...lol
Dan Hill
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!