| Overall Statistics |
|
Total Trades 626 Average Win 0.01% Average Loss -0.02% Compounding Annual Return -4.548% Drawdown 5.600% Expectancy -0.926 Net Profit -5.606% Sharpe Ratio -14.557 Probabilistic Sharpe Ratio 0% Loss Rate 95% Win Rate 5% Profit-Loss Ratio 0.44 Alpha -0.032 Beta 0 Annual Standard Deviation 0.002 Annual Variance 0 Information Ratio -1.079 Tracking Error 0.127 Treynor Ratio -201.739 Total Fees $0.00 |
import datetime
class EURUSDHourMinute(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2018, 10, 11)
self.SetCash(1000000)
self.SetBrokerageModel(BrokerageName.OandaBrokerage)
self.AddForex("EURUSD", Resolution.Minute, Market.Oanda)
self.buy = 0
self.sell = 0
self.wins = 0
self.totals = 0
def OnData(self, data):
if not self.Portfolio.Invested and self.Time.hour == 18 and self.Time.minute == 0:
self.buy = data["EURUSD"].Price
self.SetHoldings("EURUSD", 1)
if self.Portfolio.Invested and self.Time.hour == 18 and self.Time.minute == 1:
self.sell = data["EURUSD"].Price
if self.buy < self.sell:
self.Debug("PROFIT: " + str(self.sell-self.buy))
self.wins += 1
else:
self.Debug("LOSS: " + str(self.sell-self.buy))
self.Liquidate()
self.totals += 1
def OnEndOfAlgorithm(self):
self.Debug("Win Rate: " + str(self.wins/self.totals))