Any ideas on where i am going wrong here? Must be something to do with borrowing?
Havent coded on this previously so testing an algo out.Trying a simple vol adj moving avg on multiple stocks
Any ideas on where i am going wrong here? Must be something to do with borrowing?
Havent coded on this previously so testing an algo out.Trying a simple vol adj moving avg on multiple stocks
Hello hk k,
I changed the number of shares transacted to a global, num_shares. I also added modified your buy/sell loop to include the security price:
for stock in context.Stocks1:
ew = get_MA(stock,data)
price = data[stock].price
if ew < 0 and notional > context.min_notional:
print "less"
order(stock,-num_shares)
notional = notional - price*num_shares
elif ew > 0 and notional < context.max_notional:
print "more"
order(stock,+num_shares)
notional = notional + price*num_shares
I think the problem with your original algorithm is that the min_notional/max_notional approach runs into problems when the number of shares transacted is too large compared to your notional limits.
By the way, my understanding is that regulations require at least $25K capital for daily trading; if you have less, there is a clearing period of several days.
Grant
Hi Grant
Thank you v much for the response. I have made those changes and will look to modify to handle $25k capital. However, that return i am getting seems really high doesnt it?