Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Open Price v. Close Price

I have been doing a lot of testing using price in terms of open v. close, price v. vwap and for some reason in september 2012 my algo seems to always diverge from the benchmark.

Any thoughts?

7 responses

Hello Steven,

Why are you buying 100 shares each time but only selling 10 each time?

P.

I notice that when I have it set to -100 I was loosing a lot more money in the short run

Hello Steven,

You may be exceeding the margin limit a broker would allow. I added a function that tracks the capital used (credit to Dennis C.) and added some plots. It appears that you are using capital (your initial and loaned by the broker) that is unrealistic.

I'll see if I can fix up the algo so that the limits are realistic.

Grant

Thanks much!! it's going to take me a bit of time to understand it all though, but thank you

Hi Steven,

There was a posting on how to handle margin in a more robust way than the "notional" approach. When I get the chance, I'll see if I can find it for you (or someone else can assist).

Grant

Here's the reference:

https://www.quantopian.com/posts/template-limiting-leverage-by-brandon-ogle-and-dan-sandberg

I have not used it, but glancing through the comments, it seems to be o.k.

Thanks Grant, I'll give it a go over tonight