| Overall Statistics |
|
Total Trades 142 Average Win 0.76% Average Loss -0.08% Compounding Annual Return 12513.367% Drawdown 4.300% Expectancy 0.476 Net Profit 5.444% Sharpe Ratio 80.999 Probabilistic Sharpe Ratio 0% Loss Rate 85% Win Rate 15% Profit-Loss Ratio 9.04 Alpha 47.337 Beta -0.649 Annual Standard Deviation 0.59 Annual Variance 0.348 Information Ratio 66.342 Tracking Error 0.731 Treynor Ratio -73.592 Total Fees $0.00 Estimated Strategy Capacity $20000.00 Lowest Capacity Asset ETHUSD XJ |
# Crypto VWAP
from AlgorithmImports import *
# ---------------------------------------
CRYPTO = "ETHUSD"; SL = -0.02; TP = 0.02;
# ---------------------------------------
class DeterminedAsparagusManatee(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2020, 6, 21)
self.SetEndDate(2020, 6, 24)
self.SetCash(100000)
self.crypto = self.AddCrypto(CRYPTO, Resolution.Minute).Symbol
self.vwap = self.VWAP(self.crypto)
def OnData(self, data: Slice):
if not self.vwap.IsReady: return
pnl = self.Securities[self.crypto].Holdings.UnrealizedProfitPercent
currentclose = self.Securities[self.crypto].Close
vwap = self.vwap.Current.Value
self.Plot(self.crypto, "current close", currentclose)
self.Plot(self.crypto, "vwap", vwap)
if not self.Portfolio[self.crypto].IsLong:
if currentclose >= vwap:
self.SetHoldings(self.crypto, 1, False, "currentclose > vwap")
elif not self.Portfolio[self.crypto].IsShort:
if currentclose < vwap:
self.SetHoldings(self.crypto, -1, False, "currentclose < vwap")
if self.Portfolio[self.crypto].Invested:
if pnl < SL:
self.Liquidate(self.crypto, "Stop Loss")
elif pnl > TP:
self.Liquidate(self.crypto, "Take Profit")