Overall Statistics Total Trades0Average Win0%Average Loss0%Compounding Annual Return0%Drawdown0%Expectancy0Net Profit0%Sharpe Ratio0Probabilistic Sharpe Ratio0%Loss Rate0%Win Rate0%Profit-Loss Ratio0Alpha0Beta0Annual Standard Deviation0Annual Variance0Information Ratio0Tracking Error0Treynor Ratio0Total Fees\$0.00Estimated Strategy Capacity\$0Lowest Capacity Asset
```# This code is provided for informational purposes only.
# Do NOT trade using it or you WILL loose money.

from SimpleLinearRegressionChannel import SimpleLinearRegressionChannel

class SimpleLinearRegressionChannelAlgorithm(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2021, 12, 9)
self.SetEndDate(2021, 12, 10)
self.SetCash(100000)

self.slrc = SimpleLinearRegressionChannel(self, 30, 30, 2.0)

self.SetWarmUp(self.slrc.WarmUpPeriod, Resolution.Minute)

def OnData(self, data):
if data.ContainsKey(self.pair) and data[self.pair] is not None:
if self.Time.hour == 18 and self.Time.minute == 30:
self.slrc.Reset()
self.Debug("HasRun")
else:
self.slrc.Update(data[self.pair])
else:
return

return

# Since our indicator is ready, we can use it to compare the current bar with the simple linear regression projection.
(low, mid, high) = self.slrc.GetProjection()

bar = data[self.pair]

#Plot points
#if 19 <= self.Time.hour < 20:
self.Plot("Pricing", "Price", bar.Close)
self.Plot("Pricing", "LowerChannel", low)
self.Plot("Pricing", "LinearReg-Extension", mid)
self.Plot("Pricing", "HigherChannel", high)

#self.Debug(f"({low}, {mid}, {high})")
```