Overall Statistics Total Trades 152 Average Win 1.76% Average Loss -1.04% Compounding Annual Return 66.867% Drawdown 12.800% Expectancy 0.671 Net Profit 67.072% Sharpe Ratio 1.887 Loss Rate 38% Win Rate 62% Profit-Loss Ratio 1.69 Alpha 1.298 Beta -53.662 Annual Standard Deviation 0.232 Annual Variance 0.054 Information Ratio 1.818 Tracking Error 0.232 Treynor Ratio -0.008 Total Fees \$0.00
```from clr import AddReference
from System import *
from QuantConnect import *
from QuantConnect.Algorithm import *
from QuantConnect.Indicators import *
import numpy as np
from datetime import timedelta, datetime
import decimal

class RegressionChannelAlgorithm(QCAlgorithm):

def Initialize(self):

self.SetCash(1000)
self.SetStartDate(2018,4,9)
self.SetEndDate(2019,4,9)
slowperiod = 240
self.SetWarmUp(slowperiod)
for symbol in self.symbols:
self._spy = equity.Symbol
#self._holdings = equity.Holdings
self.ema1 = self.EMA("USDCAD", 10, Resolution.Daily) #[1],[3]
self.sma1 = IndicatorExtensions.Minus(self.ema1, self.ema2)

self.ema3 = self.EMA("EURNZD", 10, Resolution.Daily) #[0].[2]
self.ema4 = self.EMA("NZDUSD", 10, Resolution.Daily)
self.sma2 = IndicatorExtensions.Minus(self.ema3, self.ema4)

self.ema5 = self.EMA("GBPCHF", 50, Resolution.Hour) #[4],[5]
self.ema6 = self.EMA("EURGBP", 50, Resolution.Hour)
self.sma3 = IndicatorExtensions.Minus(self.ema5, self.ema6)

'''
'''
def OnData(self, data):
if self.IsWarmingUp: return
if (not self.ema1.IsReady) or (not data.ContainsKey(self.symbols[0])) or (not data.ContainsKey(self.symbols[1])): return

tolerance = decimal.Decimal(0.0100)
tolerance2 = decimal.Decimal(0.0175)
tolerance3 = decimal.Decimal(0.0070)
lavern2 = (self.Securities["EURNZD"].Price - self.Securities["NZDUSD"].Price)
lavern3 = (self.Securities["GBPCHF"].Price - self.Securities["EURGBP"].Price)

if not self.Portfolio[self.symbols[1]].Invested and lavern <= (self.sma1.Current.Value - tolerance):
self.MarketOrder(self.symbols[1], 3000)
self.MarketOrder(self.symbols[3], -3000)
if self.Portfolio[self.symbols[1]].Invested and lavern >= (self.sma1.Current.Value + tolerance):
self.MarketOrder(self.symbols[1], -3000)
self.MarketOrder(self.symbols[3], 3000)

if not self.Portfolio[self.symbols[0]].Invested and lavern2 <= (self.sma2.Current.Value - tolerance2):
self.MarketOrder(self.symbols[0], -3000)
self.MarketOrder(self.symbols[2], 3000)
if not self.Portfolio[self.symbols[0]].Invested and lavern2 >= (self.sma2.Current.Value + tolerance2):
self.MarketOrder(self.symbols[0], 3000)
self.MarketOrder(self.symbols[2], -3000)
if self.Portfolio[self.symbols[0]].Invested:
if (self.sma2.Current.Value + 0.0005) >= lavern2 >= (self.sma2.Current.Value - 0.0005):
self.Liquidate(self.symbols[0])
self.Liquidate(self.symbols[2])
self.Log("Unsettled Cash is: " + str(self.Portfolio.Cash))
'''
if not self.Portfolio[self.symbols[4]].Invested and lavern3 <= (self.sma3.Current.Value - tolerance3):
self.MarketOrder(self.symbols[4], -3000)
self.MarketOrder(self.symbols[5], 3000)
if not self.Portfolio[self.symbols[4]].Invested and lavern3 >= (self.sma3.Current.Value + tolerance3):
self.MarketOrder(self.symbols[4], 3000)
self.MarketOrder(self.symbols[5], -3000)
if self.Portfolio[self.symbols[4]].Invested:
if (self.sma3.Current.Value + 0.0015) >= lavern3 >= (self.sma3.Current.Value - 0.0015):
self.Liquidate(self.symbols[4])
self.Liquidate(self.symbols[5])
'''
'''

'''
def OnEndOfDay(self):
'''