Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Hello, New to Quantopian, please kindly help

Hi all,

I just joined Quantopian today! Main purpose is to explore algo trading and learn a little bit of python.

I am trying to implement a really simple strategy that will BUY a stock at the close of the 3rd day if it has closed lower for 3 consecutive trading days, then hold it and sell at the 5th trading day thereafter.

I have tried using the history function and see that returns a dataframe. I have also read something about the history function only supporting minute backtesting and not daily.

Could someone please kindly help me figure out this strategy is possible?

Thank you very much!
Bob

2 responses

Hi Bob,

Here is my naive implementation of your strategy. It doesn't use history API and can be run on daily data. Just wanted to show you an easy way first :)

PS: Let me know If you want me to reimplement it using history API.

Hi Ed,

Thank you very much for your response! I really enjoyed your solution too!

So if I'm understanding the API docs correctly, the history API is only avail for minute testing. We would have to aggregate the minute data into a daily, and then compare? It would be an overkill, so I guess no point here with this strategy. But I can definitely see the power in the history API - it will allow us to manipulate short-term intraday trends. I will explore that further when I'm more knowledgeable.

Thank you again!
Bob