Overall Statistics
Total Trades
37
Average Win
0.01%
Average Loss
0%
Compounding Annual Return
-0.032%
Drawdown
0.300%
Expectancy
0
Net Profit
-0.015%
Sharpe Ratio
-0.057
Probabilistic Sharpe Ratio
20.852%
Loss Rate
0%
Win Rate
100%
Profit-Loss Ratio
0
Alpha
0
Beta
-0.009
Annual Standard Deviation
0.004
Annual Variance
0
Information Ratio
-0.022
Tracking Error
0.018
Treynor Ratio
0.028
Total Fees
$0.00
from Alphas.EmaCrossAlphaModel import EmaCrossAlphaModel
from datetime import datetime,timedelta
import numpy as np
from System.Collections.Generic import List
from QuantConnect.Data.UniverseSelection import*
from System import *


#class ResistanceMultidimensionalReplicator(QCAlgorithm):
class ScheduledEventsAlgorithm(QCAlgorithm):
    def Initialize(self):
        self.SetStartDate(2020, 1, 1)  # Set Start Date
        self.SetEndDate(2020, 6, 22) # Set end date
        self.SetCash(1000000)  # Set Strategy Cash
        self.forex = self.AddForex("USDCAD", Resolution.Minute, Market.Oanda)
        self.SetBrokerageModel(BrokerageName.OandaBrokerage)
        self.EMA8 = self.EMA("USDCAD", 8, Resolution.Minute)
        self.EMA55 = self.EMA("USDCAD", 55, Resolution.Minute)
        self.SetBenchmark("USDCAD")
        self.SetWarmUp(55)
        self.Schedule.On(self.DateRules.Every(DayOfWeek.Monday), self.TimeRules.At(0, 24), self.SpecificTime)
    def OnData(self, data):
        if self.IsWarmingUp:
            return
            #self.SetHoldings("USDCAD", 50)
    def SpecificTime(self):
        self.Plot('Custom', 'EMA8', self.EMA8.Current.Value)
        self.Plot('Custom', 'EMA55', self.EMA55.Current.Value)
        if not self.Portfolio.Invested:
            if self.EMA8.Current.Value>self.EMA55.Current.Value:
                self.MarketOrder("USDCAD", 100000)
                self.stopLimitTicket = self.LimitOrder("USDCAD", -100000, self.Securities["USDCAD"].Close+0.0011)
            if self.EMA8.Current.Value<self.EMA55.Current.Value:
                self.MarketOrder("USDCAD", -100000)
                self.stopLimitTicket = self.LimitOrder("USDCAD", 100000, self.Securities["USDCAD"].Close-0.0011)