Overall Statistics
Total Trades
2
Average Win
0%
Average Loss
0%
Compounding Annual Return
0.002%
Drawdown
0.000%
Expectancy
0
Net Profit
0.001%
Sharpe Ratio
0.115
Probabilistic Sharpe Ratio
24.894%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0.002
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
-0.149
Tracking Error
0.078
Treynor Ratio
0.009
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 ScheduledEventsAlgorithm(QCAlgorithm):
    def Initialize(self):
        self.SetStartDate(2020, 1, 1)  # Set Start Date
        self.SetEndDate(2020, 6, 22) # Set end date
        self.SetCash(100000000)  # Set Strategy Cash
        self.forex = self.AddForex("EURUSD", Resolution.Minute, Market.Oanda)
        self.SetBrokerageModel(BrokerageName.OandaBrokerage)
        self.EMA5 = self.EMA("EURUSD", 5, Resolution.Minute)
        self.RegisterIndicator("EURUSD", self.EMA5, timedelta(minutes=5))
        self.EMA40 = self.EMA("EURUSD", 40, Resolution.Minute)
        self.RegisterIndicator("EURUSD", self.EMA40, timedelta(minutes=5))
        self.SetBenchmark("EURUSD")
        self.SetWarmUp(55)
        self.Schedule.On(self.DateRules.Every(DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday), self.TimeRules.At(3, 0), self.SpecificTime)
    def OnData(self, data):
        if self.IsWarmingUp:
            return
            #self.SetHoldings("USDCAD", 50)
    def SpecificTime(self):
        self.Plot('Custom', 'EMA5', self.EMA5.Current.Value)
        self.Plot('Custom', 'EMA40', self.EMA40.Current.Value)
        if not self.Portfolio.Invested:
            if self.EMA5.Current.Value>self.EMA40.Current.Value:
                self.MarketOrder("EURUSD", 100000)
                self.stopLimitTicket = self.LimitOrder("EURUSD", -100000, (self.Securities["EURUSD"].Close+0.0011))
                self.stopMarketTicket = self.StopMarketOrder("EURUSD", -100000, (self.Securities["EURUSD"].Close-0.0005))
            if self.EMA5.Current.Value<self.EMA40.Current.Value:
                self.MarketOrder("EURUSD", -100000)
                self.stopMarketTicket = self.StopMarketOrder("EURUSD", 100000, (self.Securities["EURUSD"].Close+0.0005))
                self.stopLimitTicket = self.LimitOrder("EURUSD", 100000, (self.Securities["EURUSD"].Close-0.0011))