Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
0
Tracking Error
0
Treynor Ratio
0
Total Fees
$0.00
import numpy as np
from datetime import timedelta
from NodaTime import DateTimeZone

class BasicTemplateAlgorithm(QCAlgorithm):

    def Initialize(self):

        self.SetStartDate(2018,9, 18)  #Set Start Date
        self.SetEndDate(2018,10,18)    #Set End Date
        self.SetCash(100000)           #Set Strategy Cash
        
        eurusd = self.AddForex("EURUSD", Resolution.Daily, Market.Oanda)
        self.resolution = Resolution.Daily
        self.donch_period = 7
        self.donchian = DonchianChannel("EURUSD", self.donch_period, self.donch_period)
        history = self.History(["EURUSD"], 10, Resolution.Daily)

        for tuple in history.loc["EURUSD"].itertuples():
            bar = QuoteBar(tuple.Index-timedelta(days=1), 
                              eurusd.Symbol, 
                              Bar(tuple.bidopen,tuple.bidhigh,tuple.bidlow, tuple.bidclose),
                              0,
                              Bar(tuple.askopen,tuple.askhigh,tuple.asklow, tuple.askclose),
                              0,
                              timedelta(days=1)
                              )
            self.donchian.Update( bar)
        self.RegisterIndicator(eurusd.Symbol, self.donchian, self.resolution)

    def OnData(self, data):
        if self.donchian.IsReady:
            self.Debug(str(self.donchian.Current.Value))