Hello, I am new to algorithmic trading. In the notebook I coded the ichimoku cloud. In the notebook it runs perfectly. However, when I code the ichimoku cloud in the IDE, I have probelms with the shift command. Where it says 'Shift(26)' I receive an error that says ' 'int' object has no attribute 'shift''. Below is the code. I would appreciate if someone could tell me what am i doing wrong.
def initialize(context):
context.spy = sid(8554)
schedule_function(ichi,date_rules.every_day())
def ichi(context,data):
cur_price = data.current(context.spy,'price')
prices = data.history(context.spy,'price', 30 , '1d')
max_prices = data.history(context.spy, 'high',30,'1d')
close_prices = data.history(context.spy, 'close',30,'1d')
min_prices = data.history(context.spy,'low',30,'1d')
nine_period_high = max_prices.rolling(window=9).max()
nine_period_low = min_prices.rolling(window=9).min()
tenkan_sen = (nine_period_high + nine_period_low) /2
period26_high = max_prices.rolling(window=26).max()
period26_low = min_prices.rolling(window=26).min()
kijun_sen = (period26_high + period26_low) / 2
senkou_span_a = (tenkan_sen + kijun_sen) / (2).shift(26)
period52_high = max_prices.rolling(window=52).max()
period52_low = min_prices.rolling(window=52).min()
senkou_span_b = ((period52_high + period52_low) / 2).shift(26)
if cur_price > senkou_span_a:
order_target_percent(context.spy, 1.0)
elif cur_price < senkou_span_a:
order_target_percent(context.spy,-1.0)
else:
pass