Overall Statistics
Total Trades
7
Average Win
0.03%
Average Loss
-0.05%
Compounding Annual Return
-12.928%
Drawdown
0.100%
Expectancy
-0.473
Net Profit
-0.076%
Sharpe Ratio
-19.087
Probabilistic Sharpe Ratio
0%
Loss Rate
67%
Win Rate
33%
Profit-Loss Ratio
0.58
Alpha
0
Beta
0
Annual Standard Deviation
0.005
Annual Variance
0
Information Ratio
-19.087
Tracking Error
0.005
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$750000.00
class BasicTemplateAlgorithm(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2017, 2, 4)
        self.SetEndDate(2017, 2, 5)
        self.SetCash(5000)

        self.pair = self.AddForex("EURUSD", Resolution.Hour).Symbol

        self.previousPortfolioValue = self.Portfolio.TotalPortfolioValue

        self.buyPrice = None

    def OnData(self, data):
        self.Debug("======================================")

        if not self.Portfolio.Invested:
            self.SetHoldings(self.pair, 1)
        else:
            self.SetHoldings(self.pair, 0)

        realProfit = (self.Portfolio.TotalPortfolioValue - self.previousPortfolioValue) / self.previousPortfolioValue
        self.previousPortfolioValue = self.Portfolio.TotalPortfolioValue

        self.Debug("realProfit=" + str(realProfit))

        quoteBar = data[self.pair] 

        if self.buyPrice is not None:
            sellPrice = quoteBar.Close
            profitPercentage = (sellPrice - self.buyPrice) / self.buyPrice
    
            self.Debug("myProfit=" +str(profitPercentage))

        self.buyPrice = quoteBar.Ask.Close