I am trying to implement the following simple breakout strategy using the Framework Algorithm Insight abstraction:
for each asset
- If long position does not exist and today's close is higher than the highest close in the past 50 days, enter long position
- If long position exists and today's close is lower than the lowest close for past 25 days, exit long position
- if short position does not exist and today's close is lower than the lowest close in the past 50 days, enter short position
- if short position exists and today's close is higher than the highest close in the past 25 days,
insights = []
for asset in universe:
if not symbolData.LongPosition and symbolData.LongBreakout:
insights.append(Insight.Price(symbolData.Symbol, self.predictionInterval, InsightDirection.Up))
continue
if symbolData.LongPosition and symbolData.LongExit:
# exit long position above
#insights.append(Insight(????))
continue
if not symbolData.ShortPosition and symbolData.ShortBreakout:
insights.append(Insight.Price(symbolData.Symbol, self.predictionInterval, InsightDirection.Down))
continue
if symbolData.ShortPosition and symbolData.ShortExit:
# exit short position above
#insights.append(Insight(????))
continue