Stochastic Oscillator -- Need quick help printing values ( Corrected)

Hello,

My name is Mark and i'd like to first thank Quantopian and the community for helping each other tackle programming problems. It'd be almost impossible trying to fiqure these questions out on your own.

I was wondering how would you print the values the talib.STOCH( ) is producing/calculating in the background. I would like to see the exact numbers if possible. This is a stochatic oscillator. I did not use the slowk_period or slowd period but that's not the problem

When using the fastk oscillator (original) formula the output numbers should come out to be 10 ,24 , 25, 76, 100 < - these are just examples

When i printed the fastk values.. i got NaN in return..

Is there anyway to print the exact numbers ( i'd like to see whats going on in the background. )

Here is the real code i've been working with

14
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
 Returns 1 Month 3 Month 6 Month 12 Month
 Alpha 1 Month 3 Month 6 Month 12 Month
 Beta 1 Month 3 Month 6 Month 12 Month
 Sharpe 1 Month 3 Month 6 Month 12 Month
 Sortino 1 Month 3 Month 6 Month 12 Month
 Volatility 1 Month 3 Month 6 Month 12 Month
 Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 591e03d6426b7361a5af0651
There was a runtime error.
4 responses

Mark,
This should work.

# stochastic fast indicator

import talib

def initialize(context):
schedule_function(stochastic_fast_indicator, date_rules.every_day(), time_rules.market_open(minutes=10))
def stochastic_fast_indicator(context, data):
stk = symbol('SPY')
fk, fd = 14, 1
bars = fk + fd
H = data.history(stk, 'high', bars, '1d')
L = data.history(stk, 'low', bars, '1d')
C = data.history(stk, 'price', bars, '1d')

fastk, fastd = talib.STOCHF(H,L,C,fk,fd)
print fastk[-1]
record(fastk = fastk[-1])