Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Getting started hint

I just want to do a quick test by using one Stock Ticker. Here are the inputs:

1) Initial investment amount and a historical StartDate
2) Follow the price every day
3) Sell N on drop by P % over last buy price, becomes Cash
4) Reinvest the Cash to buy M (may become less than N) when the price increases by Q% over 3.
5) Repeat 2 to 4 till an EndDate.

Is that possible here? I'm a programmer so just a few hints should be enough on where to start.
Thanks.

1 response

Hi, I'm just getting started as well. Short answer, yes, but I don't think you can get around reading the manual and trying some sample code.

Is this a "buy high, sell low" strategy?

  1. date range and investment amount are built into the backtester interface.
  2. use schedule_function to schedule a method to run once a day
    3.,4.,5. use order_target set to 0 to sell all of a security. I haven't read all the manual yet so i don't know where the historical buy price is stored, but even if it wasn't there's no reason why you couldn't store it to a variable of your choice.