Stop loss using open price

I noticed when I use stop losses in my sims, they are hitting correctly based on the low of the bar, but the open price of that same bar is used for the return which is completely skewing my results. Am I doing something wrong?

I think you’re right. It looks like a bug.

It improves the performance of my simulated strategies wayyyy too much to be believable.

Personally I would stay away from using opening prices. Bid/ask prices are much higher and you will see much more slippage. With that being said I doubt a stop loss will ever get you out on an opening price. In practice you’ll get out below the open price and probably much lower if the markets are falling.

Can you please send me a link to the portfolio where you’re seeing this? I’d like to take a look.

Sure. I just copied one of p123’s sims and added the stop-loss; https://www.portfolio123.com/port_summary.jsp?portid=1596258

Checkout CONN. The closing price for the stop-loss transaction looks wrong; $22.51 is the opening price for the day that the stop-loss was triggered.


Strangely on a gap down the correct stop price is used, which actually SHOULD be the open price in that case.

We found a problem that Aaron says is easily fixed. It should be patched with the next release.

Excellent! When’s the next release scheduled?

Good to see it’s fixed, I also encountered this just a few days ago.

Looks like the fix has been deployed. Nice! Thanks!

Walter

Yes, this fix went through this afternoon. Let us know if you’re still seeing anything off.

Just check one transaction and it looked correct. However, it wasn’t a gap-down type. I’ll look for one of those later.

I think I’m seeing an issue when variable slippage is enabled. The attached transaction is with a entry based stop of 10%. With a buy price of $43.78, I think the sell price should be ($43.78*(1-0.10)=$39.40 - slippage. But the sell price is recorded as $39.45. That’s too high by two measures.

Walter

EDIT: Ok, I think p123 is right. The ‘price’ column is un-adjusted for slippage. Adding slippage to the buy price makes the entry based stop $39.45 - as reported. I haven’t checked the PL, but it should be based on slippage adjusted prices.