Tuesday, February 23, 2010

“New Candle” Problem in MetaTrader

MetaTrader is a great software for charting, analyzing, trading and testing. It has many useful features and supports many tools that make the life of the Forex trader much easier. But when it comes to drawing the new candles/bars on the chart there is a tricky part of MetaTrader.

Both in MT4 and MT5 the candles are drawn depending on the ticks (each tick is a moment when a new quote from the broker came) rather than on the time, while the charts themselves are displayed based on time. The problem is that the new candle won’t be drawn on the chart exactly at its expected start time; you’ll have to wait for the next tick after that start time and only then the candle is displayed on the chart. For example, you look at the M1 chart, it’s quite obvious that 13:45:59 is the last second of the previous candle, the next candle should be available on 13:46:00, but you may still end up looking at the previous candle even on 13:46:05 or later (depending on the market volatility). If the tick comes on 13:46:10, the new candle will be drawn at that time with the Open value at the price which came with the tick.

So why should it matter? What consequences such behavior has on trading? First, the candle charts look different because of it. Often, Close value of the previous candle isn’t the same as the Open value of the next candle — we have to wait for the new quote and new quote often means a new price. Second, we can’t base our trading solely on time, especially if we try to be precise up to a second. All scripts, expert advisors and indicators have to rely on the time of the last tick rather than on the exact time.

So, how do you avoid being affected by all this? When you trade based on the candle/bar charts in MetaTrader, always keep in mind that the candles depend on ticks, not on time. If you trade on longer timeframes, it won’t be difficult, especially if the Forex market is slow. If you trade on M1/M5, pay attention to prevClose/Open difference when trying to apply the candlestick chart patterns. If you write an indicator (or some other MetaTrader program), try to avoid relying on the round time values, remember that the system is tick-based, use the ”>=” comparison instead of the strict “=” when dealing with the seconds.

No comments:

Post a Comment