Is there a full example of a simple system with entry and exits to get someone started with this platform. I have been on and off and never managed to do anything. I have tried a simple inside day break out but code is a mess
def initialize(context):
context.SPY = symbol("SPY")
def handle_data(context, data):
highv = history(2, "1d", "high")[context.SPY]
lowv = history(2, "1d", "low")[context.SPY]
if (highv.iloc[-1] < highv.iloc[-2] and lowv.iloc[-1] > lowDv.iloc[-2]) and (close_price > highv.iloc[-2]):
order_target_percent(context.SPY, 1)
if data[context.stock].price > entry*1.03:
order(context.stock, 0)
if data[context.stock].price < entry*0.97:
order(context.stock, 0)
Can anyone help? Thanks