| Overall Statistics |
|
Total Trades 18 Average Win 0.35% Average Loss -0.58% Compounding Annual Return -13.762% Drawdown 2.900% Expectancy -0.468 Net Profit -2.444% Sharpe Ratio -1.81 Probabilistic Sharpe Ratio 0.999% Loss Rate 67% Win Rate 33% Profit-Loss Ratio 0.60 Alpha -0.104 Beta -0.032 Annual Standard Deviation 0.06 Annual Variance 0.004 Information Ratio -1.527 Tracking Error 0.18 Treynor Ratio 3.382 Total Fees $0.00 Estimated Strategy Capacity $27000000.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.Hour, 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.Limit:
self.Transactions.CancelOpenOrders(order.Symbol)
if order.Status == OrderStatus.Canceled:
self.Log(str(orderEvent))