I did some more tests in the meantime.

This compares the closing candle against the low price of the next candle. (1)

The first set of tests assumes you place the order at the o/h/l/c values for the current tick. (2)

```
Assuming you place the order for the open(T) price, your order fills 0.708 of the time at (T+1)
Assuming you place the order for the high(T) price, your order fills 0.990 of the time at (T+1)
Assuming you place the order for the low(T) price, your order fills 0.440 of the time at (T+1)
Assuming you place the order for the close(T) price, your order fills 0.891 of the time at (T+1)
```

As we can see if we place the order for the high value of the previous candle, we have it filled 99% of the time. If we do it based on the closing price, this drops to 89.1%. The rest of the time we would have to cancel the order after a minute. Paying for the cancellation fee between 1% to 15% of the time or extending the order time, depending on the route we go and how bad the few seconds delay changes the situation. In addition if one tests for placing the order at the high price point, it is likely the order will fill under that price point in real life, making up for the cancellation fees we have to pay for the rare times it doesn't fill at all.

If we are operating by the previous candles values and our orders are considered at earliest at the the next candle though, the situation changes a lot. **This is how I understand the quantopian orders to work. Please correct me if I am wrong, I hope I am.**

```
Assuming you place the order for the open(T-1) price, your order fills 0.659 of the time at (T+1)
Assuming you place the order for the high(T-1) price, your order fills 0.864 of the time at (T+1)
Assuming you place the order for the low(T-1) price, your order fills 0.462 of the time at (T+1)
Assuming you place the order for the close(T-1) price, your order fills 0.707 of the time at (T+1)
```

Using the close price now only fills 70.7% of the time from 89.1%. A drop of 24.01%. That's a huge difference when we are measuring methods that are meant to make or lose anywhere from around a percent to less than a percent in a whole day. (3)

More importantly, the price is higher than even the previous high a whopping 14% of the time, while it was higher only 1% of the time using the candle that just finished(assuming we do the calculations as soon as the candle finishes). If our delay is measured in seconds and we place the orders for the high price, theoretically we are going to miss it only 1% of the time(4) although it will be worse in the real case. On the other hand I don't expect the quantopian case to get worse, as it's more than possible to beat the 14% rate if we have our delay under 60 seconds, which is a lot of time.

Case in point, I was able to come up with a test that basically tracks SPY and is only slightly(<5%) outperforming it on Quantconnect. The same test on Quantopian is underperforming SPY.

Both using the standard order call, no limit orders, fees set to 0 on Quantopian and fees left at default on Quantconnect.

(1) Tested for a year of minutely candles, ignoring the first and last 30 minutes of each day, because we don't get the indicators at proper values for the first 30 minutes at the earliest and doing buys near market close is risky. When the price I am trying to fill is equal to the low price of the next, it's assumed the order doesn't fill(though this is rare).

(2) It's possible to calculate the values for indicators under a second unless it's a complicated method, and it's possible to place an order in a time measured in a few seconds as well. We likely need to account for a delay of retrieving the data too. Even so, this is far from trying to time things to under a second or HFT. I consider keeping the delay above a second at a minumum, but below 10 seconds a possible task using retail systems. Instead of assuming a delay of a whole minute which I believe might be the case here.

(3) Realistically, with our few secons delay, we wouldn't be able to fill it exactly 89.1% of the time, but we might very well miss it by only a few percentage points, not by 24%. I am planning to test this on real life situations or real-time paper trading. In addition, if we also assume a cancellation fee in our model, we either have to assume a higher limit or paying the fee 24% of the time. Both seem to be weaker models than just assuming a cancellation fee based on placing the order only a few seconds late. If I understood the mechanic of quantopian order filling correctly. Again please correct me if this is all wrong, I would be glad to hear that.

(4) With our few seconds delay, the 1% rate is probably going to be higher, but I don't expect it to increase by 1400% (14x) which would be the rate for skipping the candle. I think assuming something like 500%(5x) is reasonable as a worst-case mean, which would put us at around a 5% cancellation rate. Have to test for this as well.