Back

New to programming. Need help with algo

Hello,

I have taken online classes with python. I am excited to say I have started making progress! I still can’t wrap my head around self though. I want to build a very simple algo that buys or sells in a 2 point band around mid. The sell for a 2 point move. So if it’s. Below mid and retraces back to mid (hi + lo) / 2  then it sells. And if it breaks the 2 point band it exits trade. How would I go about designing this?

Update Backtest







Self references the instance of the class itself. So when creating a method or calling methods within the class we use self. For example, SetWarmUp() is a method inside the QCAlgorithm class, so during Initialize(), we call self.SetWarmUp().

With regards to the strategy, this can easily be implemented using Bollinger Bands. Here is a simple strategy below that uses RSI and BollingerBands that can simplified to create the strategy described above.

0


Thank you very much for explaining self and providing the algo. 

0

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