I am trying to basically follow a bottom point as if using a trailing stop in reverse. Once the market moves up a certain percentage, it would trigger a buy signal. Thanks in advance for any help - hopefully I don't sound dumb.
QUANTCONNECT COMMUNITY
I am trying to basically follow a bottom point as if using a trailing stop in reverse. Once the market moves up a certain percentage, it would trigger a buy signal. Thanks in advance for any help - hopefully I don't sound dumb.
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.
Adam W
Some of the built-in indicators here may be helpful.
Would be quite simple to code your own Indicator as well. Simple logic without any indicators would follow something like:
def Initialize(self): self.lowestSPY = 999 # Lowest observed price self.buyThreshold = 0.1 # Percent change from lowest price to trigger buy def OnData(self, data): close = data['SPY'].Close # Reset the lowest price if close < self.lowestSPY: self.lowestSPY = close return # Measure how much price changed from lowest price pctChange = ( close / self.lowestSPY ) - 1.0 # Buy SPY when triggered if pctChange > self.buyThreshold: self.SetHoldings('SPY', 1)
Â
Samuel Schoening
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!