I have the following code, but for some reason It's not selling. I want to have it sell on close the days it buys, and after consulting the documentation It seems like my order call has the right parameters. What am I doing wrong?
def initialize(context):
context.nvda = sid(6984)
context.max_notional = 1000000.1
context.min_notional = -1000000.0
# Will be called on every trade event for the securities you specify.
def handle_data(context, data):
# Implement your algorithm logic here.
theOpen = data[context.nvda].open_price
curPrice = data[context.nvda].price
amount = 2000/curPrice
if curPrice >= (theOpen + .08) and curPrice <= (theOpen + 1.2):
#order(sid(19725),amount, theOpen * 1.02, (theOpen*.98))
order(context.nvda, amount, data[context.nvda].close_price)
# data[sid(X)] holds the trade event data for that security.
# data.portfolio holds the current portfolio state.
# Place orders with the order(SID, amount) method.
# TODO: implement your own logic here.
#order(sid(24), 50)