Overall Statistics
Total Trades
2
Average Win
0%
Average Loss
0.00%
Compounding Annual Return
0.000%
Drawdown
0.000%
Expectancy
-1
Net Profit
0.000%
Sharpe Ratio
-0.868
Probabilistic Sharpe Ratio
7.416%
Loss Rate
100%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
-1.041
Tracking Error
0.159
Treynor Ratio
0.241
Total Fees
$0.00
Estimated Strategy Capacity
$760000.00
class SquareApricotDinosaur(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 9, 2)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        
        self.symbol = self.AddForex("USDCAD", Resolution.Minute).Symbol
        
        self.done = False


    def OnData(self, data):
        if self.done:
            return 
        
        if not self.Portfolio.Invested:
            self.MarketOrder(self.symbol, -100)
        else:
            self.done = True
            
            # Option 1
            quantity = round(self.Portfolio.CashBook['CAD'].ValueInAccountCurrency)
            self.MarketOrder(self.symbol, quantity)
            
            # Option 2
            #self.Liquidate(self.symbol)