just want to be clear, the success I referred to is real. I back test using strategy analyzer, forward test on live data (sim), check to make sure the sim results are the "same" as the strategy analyzer (excluding slippage), then I go live. I have 1 live strategy now that is performing the same as it does on historic data. There have been no surprises.
The way to avoid fake prices is to know how the chosen bar is built and write your code to account for those bars. That's unavoidable. You have to educate yourself about the different bar types.
There are many other factors as well that will cause problems such as you describe. Those factors have been discussed in numerous threads on futures.io (formerly BMT) so try searching for back testing and you should be able to compile a pretty good list. In your research you will see many opinions that are completely contrary to mine so don't be discouraged about what you read. Stay focused on trying to build a list of things that cause a back tested strategy to fail when going live.
The following user says Thank You to MWinfrey for this post:
Unless you code your strategy for "intra-bar granularity" (as NT puts it), all your entry orders will occur the start of the next bar (as well as exit orders). Depending on the strategy, this may yield an overly rosy result. It may, as in my case, be overly-pessimistic. Many of my strategies do much better in Market Replay or Live testing than in backtest.
As one poster above mentioned, adding the intrabar granularity makes it easy to lose your strategy in the mishmash of multiple time trames. I have found that backtesting is a good negative test. That is, if it does not work in backtest, it probably will not work in real life.