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

I'm trying to figure this out. I try place buy when 9 EMA crosses above kijun_sen and sell when crosses below. Time interval should be 2 hours.

Can you help please?

def initialize(context):
schedule_function(myfunc, date_rules.every_day(), time_rules.market_open(minutes = 15))

def myfunc(context, data):
stk = symbol('TQQQ')
MovingAvg1 = data.history(stk, 'price', 10,'15m').mean()
period26_high = pd.rolling_max(high_prices, window=26, min_periods=26)
period26_low = pd.rolling_min(low_prices, window=26, min_periods=26)
kijun_sen = (period26_high + period26_low) / 2

if (MovingAvg1 > kijun_sen) and current_positions == 0:
order_target_percent(stk, 0.25)
elif (MovingAvg1 < kijun_sen) and current_positions != 0:
order_target(stk, 0)