Backtesting - Signal enters too early / odd place in current bar

Login or Register

Please login or register in order to view and post in the Forum.

3 posts / 0 new
Last post
Food4Monkeys
Last seen: 5 years 8 months ago
Joined: 10/25/2015 - 15:43
Backtesting - Signal enters too early / odd place in current bar

I have an issue with a trading system signal that shows up on the trading system indicator
Specifically for this example looking to trigger an entry at the session MID only after market has broken the session 2 hour HI or LO.

It works almost perfectly, except that occasionally a large 1 minute bar that straddles the mid, breaks the IB, and the system triggers an entry within the body of the bar, but obviously price would by then be way higher. How do I prevent this happening?
The image here shows the issue (and has the chart/system def attached)
https://www.linnsoft.com/charts/pibmid-test-chart-fgblm7

Yellow line = First 2 hour Hi. Market then breaks through this high with a large bar - shifting the session mid into the body of the 1 minute bar and a long gets triggered at that mid while price is obviously higher already.

I know that I'm sending an order to fill at a V# variable where I've stored the mid instead of the bar last/close, so I see WHY it's doing this, but not sure how else to do this so that it triggers at that price. It appears to be working correctly apart from this situation.

Thanks for your help

0
cpayne
Last seen: 1 year 7 months ago
Joined: 03/30/2009 - 00:00
IB then MID

So the problem is, a wide range bar touches both the IBH and the MID, but you want it to touch the IBH and then come back and hit the MID, but most likely in this situation, it touched the MID then went up and hit the IBH instead of visa versa.  What I would do is this....

SESST_HI.1 > SESST_IBH AND LO.1 > SESST_MID AND LO <= SESST_MID AND SET(V#10, SESST_MID)

and get in at V#10

SESST_HI is highest high of all bars of session (and I assume you're using SESST to get MID and IBH).  So that tells us that the high exceeded the IBH on the previous bar or before, and the low of current bar touched the mid (while being above it on previous bar).  Try that and see if it gives you the correct results.

Food4Monkeys
Last seen: 5 years 8 months ago
Joined: 10/25/2015 - 15:43
A bit of extra fiddling, but

A bit of extra fiddling, but it works. Thanks very much.