Overall Statistics
Total Trades
34
Average Win
0.26%
Average Loss
-0.34%
Compounding Annual Return
-20.887%
Drawdown
4.200%
Expectancy
-0.688
Net Profit
-3.778%
Sharpe Ratio
-4.253
Probabilistic Sharpe Ratio
0.003%
Loss Rate
82%
Win Rate
18%
Profit-Loss Ratio
0.77
Alpha
-0.134
Beta
0.05
Annual Standard Deviation
0.036
Annual Variance
0.001
Information Ratio
1.14
Tracking Error
0.163
Treynor Ratio
-2.995
Total Fees
$0.00
Estimated Strategy Capacity
$11000000.00
Lowest Capacity Asset
EURSEK 8G
from AlgorithmImports import *
import pandas as pd
import numpy as np
from datetime import time, datetime, timedelta
# endregion

class CombinedAlgorithm(QCAlgorithm):
	
    def Initialize(self):

        # INITIALIZE
        self.SetStartDate(2022, 1, 1)  # Set Start Date
        self.SetEndDate(2022, 3, 1)
        self.SetCash(10000)  # Set Strategy Cash
        self.EURSEK = self.AddForex("EURSEK", Resolution.Minute, Market.Oanda)
        self.EURSEK.SetDataNormalizationMode(DataNormalizationMode.Raw)

        self.first = None
        self.second = None



        dailyConsolidator = QuoteBarConsolidator(timedelta(days=1))
        dailyConsolidator.DataConsolidated += self.OnDaily
        self.SubscriptionManager.AddConsolidator("EURSEK", dailyConsolidator)
        
        self.dailyBarWindow = RollingWindow[QuoteBar](2) 

    
      



    def OnData(self, data):
        # VARIABLES
        if (self.Time.hour == 0  and self.Time.minute == 1):
            if self.dailyBarWindow.IsReady and self.first is not None:
                if self.first > self.second:
                    self.SetHoldings("EURSEK", 1)
        #close position at 9:30   
        if (self.Time.hour == 9  and self.Time.minute == 30) and self.Portfolio.Invested:
            self.Liquidate()

    def OnDaily(self, sender, quoteBar):
        #QuoteBar values get specified here 
        self.Log("OnDataConsolidated called on " + str(self.Time))
        self.Log(str(quoteBar.Close))
        self.dailyBarWindow.Add(quoteBar)

                 
        if not self.dailyBarWindow.IsReady:
            return
        self.first = self.dailyBarWindow[0].Close
        self.Log("first" + str(self.dailyBarWindow[0].Time) + str(self.dailyBarWindow[0].Close))
        
        self.second = self.dailyBarWindow[1].Close
        self.Log("second" + str(self.dailyBarWindow[1].Time) + str(self.dailyBarWindow[1].Close))