Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Stochastic Oscillator

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

import talib  
import numpy as np  
import pandas as pd

def initialize(context):  
    context.stock = symbols('SPY')  
def handle_data( context, data ):  
    hist = data.history( context.stock,  [ 'high', 'low', 'close' ] , bar_count = 5, frequency = '1d' )  
    for stock in context.stock:  
        fastk = talib.STOCH( hist['high'][stock], hist['low'][stock], hist['close'][stock], fastk_period=5)  
        print fastk