The Peak-Ahead Problem
For most people the quick and dirty method of building trading systems using the signal bar closing price is good enough to judge a trading system. (CQG's formula toolbox gives you the close as the default price.)
The main problem using this method is that the open bar might cause signals that keep appearing and disappearing. This is due to the price change of the not-yet-finished bar that leads indicators to trigger, but as time goes on and the close moves in the other direction, the signal disappears again. Many indicators are also influenced by the close price that will change its value and, therefore, the indicator's value until the bar is really finished (i.e., really closed).
This is only a problem watching the trading system live since the close does not move anymore on historical data. If you convert your backtest to real trading, you need to wait until almost the end of the bar (e.g., end of the 60 minutes, end of the day, etc.) before you actually trade. For manual trading that might be doable, but if you want to step into auto trading, this is an absolute no go.
The correct approach is to trigger the trade at the opening of the bar instead of the close, but you need to look for your signal to be true one bar before.
SSK(@,10,Smo,3)[-1] XABOVE SSD(@,10,Smo,3,Smo,3)[-1]
In most liquid markets, the price difference between the close and the open on an intraday bar will not be too significant as it is just the next trade separated by a few seconds.
On daily bars, that difference might be significant, especially if the market is closed overnight and it opens with a gap in the morning.
In this example, the Slow Stochastics cross happened on the 10:00 bar but the trade actually takes place at the opening of the next bar.
A very unfortunate but also very common error is that users change their trading systems to the open method and then forget to delay all, or sometimes just one, element of the signal by minus one [-1]. The trouble is not on the price difference between open and close. The actual problem is that, for example, you trade on the open of a 240-minute bar, but you are using information (signal based on the close price) that you do not have until another four hours of trading activity happens. It is even worse on daily bars.
You might think, "This can't be a big deal?" It can!
Here is a simple Slow Stochastics trading system using the described error.
Trade on open:
SSK(@,10,Smo,3) XABOVE SSD(@,10,Smo,3,Smo,3) AND SSK(@,10,Smo,3) < 50
This is the same data but with the peak-ahead error corrected.
What happens is very obvious if you have a closer look into the statistics.
If I see a more-or-less simple trading system that looks too good to be true, I usually start looking for these kinds of mistakes. More often than not, this is what happened.
Something very similar happened to me when I wrote a very simple Heikin-Ashi trading system for this blog.