| Overall Statistics |
|
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio 0 Probabilistic Sharpe Ratio 0% Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio -2.658 Tracking Error 0.158 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset Portfolio Turnover 0% |
# region imports
from AlgorithmImports import *
# endregion
from datetime import datetime
import numpy as np
from enum import Enum
class FuturesBasis(QCAlgorithm):
def Initialize(self):
self.SetStartDate(datetime(2023, 3, 1)) #StartDate
self.SetEndDate(datetime(2023, 3, 31)) #EndDate
self.SetCash(100000) # Captial
# Adding VIX Index
self.vix = self.AddFuture(Futures.Indices.VIX, Resolution.Daily, dataNormalizationMode = DataNormalizationMode.Raw)
self.vixSymbol = self.vix.Symbol
# Warmup
self.SetWarmup(22, Resolution.Daily)
# VIX EMA(s)
self.emaFast = self.EMA(self.vixSymbol, 8, 0.5, Resolution.Daily)
self.emaSlow = self.EMA(self.vixSymbol, 21, 0.5, Resolution.Daily)
self.emaFastHistory = RollingWindow[float](9)
self.emaSlowHistory = RollingWindow[float](22)
# Charting
chart = Chart("VIX")
self.AddChart(chart)
def OnData(self, data: Slice):
# Make sure data ready
if self.IsWarmingUp:
return
# Plot Candlestick Chart / Super Trend
self.Plot("VIX", "Slow", self.emaSlow.Current.Value)
self.Plot("VIX", "Fast", self.emaFast.Current.Value)
self.Debug(f"{self.Time} emaSlow: {self.emaSlow.Current.Value}, emaFast: {self.emaFast.Current.Value}")
self.emaFastHistory.Add(self.emaFast.Current.Value)
self.emaSlowHistory.Add(self.emaSlow.Current.Value)