Demo server is feeding data to Demo account using live trading feed from broker and their trading tele-data. Live server is feeding data to Live account using the same life trading feed. But the difference is always between the server that is feeding the data.
1) Adding Delay in live trading. Different server offer different Bid-Ask spread and offer different Bid price when the currency start to move or trend up/down. So the demo results you get is different from live results and live results also different as its uses different live server, The way to close the gap is to add delay between sampling your strategy. The demo data smallest data is 1 minute. but live data changes every 1 second. By adding in delay of 1 or 5 minute, you are better in closing the gap.
2) Choose Indicate using 15 minutes or 1 hour or 1 day. Demo and live data may be difference when you looking at seconds changes and minutes changes. But if you using indicate like Moving Average, CCI, RSI, Stochastic, Bollier Band, choose a time frame of 15 minutes and above. The difference you have from Demo and Live will be very small. Like wise if you using Open/Close valve or High/Low valve of previous 15M/1H/1D, the indicate will not show much different. Thus closing the gap between Demo and Live data. Avoid using 1 minute and 5 minute data for indicator, during large price movement, will yield different indicator result giving false trigger trades.
3) To buffer 5 to 8 pips of loss. Even after you add in the protection of Bid-Ask difference not more then 7 pips. Meaning, the trade will only execute if the Bid and ask spread is less then 7 Pips, this does close the gap but due to trading server busy, allowance (0 to 2 pips) to match your buy/ask price and the Swap (few pips), always test your simulation with profit setting minus 5 to 8 pips to cover those. And Stoploss setting adding 5 to 8 pips. Else you will see different win/loss trading.
By following the above mention items, you will be closing the gap between Demo and LIve trading. Thank you.