Hi,

I am relatively new to Quantconnect and I am trying to familiarize myself with the ecosystem. I am trying to start with a basic algorithm to get a feel for the framework of an algorithm on this platform and I am a bit confused regarding Insights used in the AlphaModel and PortfolioCreationModel, particularly the Direction property. The documentation is self explanatory in regards to directional signals, but I am unsure how to construct a sginal that will signify an action regardless of which direction I think a symbol will go. Does anyone have any advice for how to create a signal like this?

For example, lets say I want to rebalance a portfolio when there is a drawdown of 10% or more in SPY. If there is a drawdown of 10% or more, then rebalance the portfolio to a predefined weighting (for the sake of example, lets make it 60/40 SPY/TLT). Due to me not understansing the AlphaModel framework, I simply added the logic to the OnData event handler.

class TestAlgorithm(QCAlgorithm):

def Initialize(self):
self.SetStartDate(2019, 1, 1)
self.SetEndDate(2020, 4, 1)
self.SetCash(10000)

symbols = [
Symbol.Create("SPY", SecurityType.Equity, Market.USA),
Symbol.Create("TLT", SecurityType.Equity, Market.USA)]

self.UniverseSettings.Resolution = Resolution.Daily
self.SetUniverseSelection(ManualUniverseSelectionModel(symbols))


def OnData(self, data):

self.highest_high = self.MAX("SPY", 253, Resolution.Daily, Field.High)
self.latest_close = data["SPY"].Close
drawdown = (self.latest_close - self.highest_high) / self.highest_high

if drawdown < -0.10:
self.Log("SPY drawdown is greater than 10%. Rebalancing portfolio")
# rebalance
...