Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Noob needs help with backtesting

Hello,
I am about 6 weeks into learning python. I work on learning python around 2 hours a day, taking online classes from different providers etc. I am trying to figure out how to build a backtest around the midpoint. So the midpoint would be initialized at 10:30 AM. Then if the market is above Midpoint and retraces within $2 of the Midpoint price the algo will buy and look for a profit of $6.00. If the market drops more then $2 past midpoint then it will sell for a loss. Then I want the same scenario to play out on the short side. The problem is I don't have the slightest idea how to do this on future contracts. Any guidance, suggestions or funny comments are welcomed. I am not looking for someone to solve the problem for me, just kind of guide me would be nice.

4 responses

Bump

Just curious, how are you defining the midpoint? Is this done at 10:30 am by taking the midpoint of the high/low between 9:30am and 10:30am? What if the price is already extended past $2 of the midpoint, immediately buy/short, or would you consider that a missed opportunity?

Yes the midpoint is the 50% mark of high - low. It’s calculated from 9;30am-4;15pm est. I only want to start trading around the mid point after 10:30 am.
If it was not in the $2 zone then it’s an invalid set up, it only becomes valid once it has retraced to the midpoint $2.00 zone. Then that would trigger the order and would have a lmao order at $6 Mark and a stop loss of $4

Lmt not lmao order. Also thanks for replying!!!