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
Probabilistic 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.009
Tracking Error
0.017
Treynor Ratio
0
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, MovingAverageType.Simple, Resolution.Minute)
        self.EMA55 = self.EMA("USDCAD", 55, MovingAverageType.Simple, Resolution.Minute)
        self.SetBenchmark("USDCAD")
        self.SetWarmUp(50)
        self.Schedule.On(self.DateRules.Every(DayOfWeek.Monday), self.TimeRules.At(00,24), self.SpecificTime)
    def OnData(self, data):
                if self.IsWarmingUp:
                    return
                    #self.SetHoldings("USDCAD", 50)
    def SpecificTime(self):
                if not self.Portfolio.Invested:
                    if self.EMA8.Current.Value>self.EMA55.Current.Value:
                        self.MarketOrder("USDCAD", 100000)
                        self.stopLimitTicket = self.StopLimitOrder("USDCAD", -100000, self.securities["USDCAD"].Close-0.0006, -100000, self.securities["USDCAD"].Close+0.0011)
                    if self.EMA8.Current.Value<self.EMA55.Current.Value:
                        self.MarketOrder("USDCAD", -100000)
                        self.stopLimitTicket = self.StopLimitOrder("USDCAD", 100000, self.securities["USDCAD"].Close+0.0006, 100000, self.securities["USDCAD"].Close-0.0011)