Overall Statistics |
Total Trades 647 Average Win 0.25% Average Loss -3.58% Compounding Annual Return 61864.804% Drawdown 47.700% Expectancy 0.052 Net Profit 69.626% Sharpe Ratio 643.723 Probabilistic Sharpe Ratio 79.384% Loss Rate 2% Win Rate 98% Profit-Loss Ratio 0.07 Alpha 1424.237 Beta 7.127 Annual Standard Deviation 2.216 Annual Variance 4.91 Information Ratio 645.378 Tracking Error 2.21 Treynor Ratio 200.138 Total Fees $0.00 |
import pandas as pd from datetime import timedelta class Calibrated(QCAlgorithm): def Initialize(self): self.SetStartDate(2019, 4, 1) # Set Start Date self.SetEndDate(2019, 4, 30) # Set End Date self.SetCash(2500) # Set Strategy Cash self.AddForex("EURUSD", Resolution.Minute, Market.Oanda) self.Securities["EURUSD"].SetLeverage(100.0) self.soft_entry = 0.0000 self.n_min = 20 self.or_l = 1000 self.or_h = 0 self.or_t = 0 self.llo = 0 self.slo = 0 def OnData(self, data): '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. Arguments: data: Slice object keyed by symbol containing the stock data ''' cur_t = data["EURUSD"].Time cur_d = cur_t.date() cur_h = cur_t.hour cur_m = cur_t.minute if(cur_m <= self.n_min): if(data['EURUSD'].Low<self.or_l): self.or_l = data['EURUSD'].Low if(data['EURUSD'].High>self.or_h): self.or_h = data['EURUSD'].High if(cur_m == self.n_min): self.or_t = self.or_h - self.or_l #long limit order self.llo = self.LimitOrder('EURUSD',1000,round(self.or_l,5) - self.soft_entry,"limit order below OR") #short limit order self.slo = self.LimitOrder('EURUSD',-1000,round(self.or_h,5) + self.soft_entry,"limit order above OR") #eof