Hey Guys,  I have been having issues getting a code to work properly. So, I started from scrach and in a notebook. I have found how to call the Relative Strenght Index (RSI), Bollinger Bands, MACD, but I cannot figure out how to call the Stochastic indicator in the notebook.

I have tried, Stochastic(xxx), Sto, qb.Indicator.Sto and a number of other variants. 

I keep getting the following error:

no constructor matches given arguments  Thoughs?qb = QuantBook() # Parameters for Indicators Boll_Length = 20 # Number of days back Boll_STD = 2.1 # Standard deviation used for upper/lower bands RSI_Lenght = 14 # Number of days taken into account Sto_K = 10 # K lenght Sto_D = 10 # D lenght MACD_Fast = 12 # Fast length MACD_Slow = 26 # Slow length MACD_Signal = 9 # Signal lenght # Add Equity spy = qb.AddEquity("SPY", Resolution.Daily).Symbol # Relative Strength Index (RSI) rsi = RelativeStrengthIndex(RSI_Lenght) # Bollinger Band BollBand = BollingerBands(Boll_Length, Boll_STD, MovingAverageType.Exponential) # Stochastic Stoch = Stochastic(Sto_K, Sto_D) #Stoch = qb.Indicator(STO(Sto_K, Sto_D)) # Moving Average Convergence Divergence (MACD) Macd = MovingAverageConvergenceDivergence(MACD_Fast, MACD_Slow, MACD_Signal, MovingAverageType.Exponential) # Create Monthly calendar consolidator MonthlyConsolidator = TradeBarConsolidator(Calendar.Monthly) # Define DataConsolidated event handler to track RSI values def OnMonthlyData(sender, updated): if rsi.IsReady: print(f"{updated.Time} RSI VALUE: {rsi.Current.Value}") if BollBand.IsReady: print(f"{updated.Time} Bollinger Band: {BollBand.UpperBand}") MonthlyConsolidator.DataConsolidated += OnMonthlyData # Register rsi to Monthly consolidator qb.RegisterIndicator(spy, rsi, MonthlyConsolidator) qb.RegisterIndicator(spy, BollBand, MonthlyConsolidator) qb.RegisterIndicator(spy, Stoch, MonthlyConsolidator) qb.RegisterIndicator(spy, Macd, MonthlyConsolidator) # Make history call to update consolidator, 1800 days guarantees at least 14 weeks of data history = qb.History(spy, 1800, Resolution.Daily) opens = history.loc["SPY"]["open"] closes = history.loc["SPY"]["close"] lows = history.loc["SPY"]["low"] highs = history.loc["SPY"]["high"] volumes = history.loc["SPY"]["volume"] times = history.unstack(0).index.values # Update consolidator with historical data for i in range(len(history)): bar = TradeBar(times[i], spy, opens[i], highs[i], lows[i], closes[i], volumes[i]) MonthlyConsolidator.Update(bar)

 

Author