Overall Statistics
Total Trades
1387
Average Win
0.48%
Average Loss
-0.29%
Compounding Annual Return
-90.172%
Drawdown
33.400%
Expectancy
-0.191
Net Profit
-32.140%
Sharpe Ratio
-4.087
Probabilistic Sharpe Ratio
0.000%
Loss Rate
69%
Win Rate
31%
Profit-Loss Ratio
1.65
Alpha
-0.877
Beta
0.233
Annual Standard Deviation
0.205
Annual Variance
0.042
Information Ratio
-4.224
Tracking Error
0.237
Treynor Ratio
-3.594
Total Fees
$0.00
Estimated Strategy Capacity
$390000.00
Lowest Capacity Asset
EURUSD 8G
class BasicTemplateAlgorithm(QCAlgorithm):
    '''Basic template algorithm simply initializes the date range and cash'''

    def Initialize(self):
        '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''

        self.SetStartDate(2020,8,1)  #Set Start Date
        self.SetEndDate(2020,9,30)    #Set End Date
        self.SetCash(1000)           #Set Strategy Cash
        # Find more symbols here: http://quantconnect.com/data
        self.curr = ['EURUSD']
        for symbol in self.curr:
            self.AddForex(symbol, Resolution.Minute, Market.Oanda)

    def OnData(self, data):
        
        for symbol in self.curr:
            price = data[symbol].Close
            
            margin = self.Portfolio.MarginRemaining
            risk = 0.0025
            pipvalue = (margin * risk) / 10
            orderSize = pipvalue / 0.0001
                
            stopLoss = (price - 0.0010)       
            profitTarget = (price + 0.0020)
            
            if not self.Portfolio[symbol].Invested:
                self.MarketOrder(symbol, orderSize)
                self.StopMarketOrder(symbol, -orderSize, stopLoss)
                self.LimitOrder(symbol, -orderSize, profitTarget)
                
                
    def OnOrderEvent(self, orderEvent):
        order = self.Transactions.GetOrderById(orderEvent.OrderId)
        if order.Status == OrderStatus.Filled:
            if order.Type == OrderType.Limit or order.Type == OrderType.StopMarket:
                self.Transactions.CancelOpenOrders(order.Symbol)
                        
        if order.Status == OrderStatus.Canceled:
            self.Log(str(orderEvent))