Hi,
I've been trying to automate my strategies that I use in Oanda, but the technical indicator calculation is completely different, despite both sites (Oanda and QC) using the same formulas apparently. I'm probably doing something very wrong, but I can't get many indicators to line up correctly, even when importing data from Oanda. For example, the MACD is completely different than what i'm seeing on Oanda, and for that matter, other websites, that despite using different data sets, have similar calculations.
Here are the MACD (12,26,9) calculations that I see from Oanda, DailyFX/TradingView, and QC respectively.
As you can see, the differences between Oanda and DailyFX are miniscule, but very different in my QC backtests, even when I use Oanda's imported data. I ever so slightly modified the MACD template provided by the Indicator Example threads, and have attached a backtest. Please let me know what i'm doing wrong (or if something is inherently not working) since the discrepancies are massive, and they do not let me test any of my strategies, with any resolution (EMA, MACD, or otherwise).
Jared Broad
Welcome @Josh! Alex looked into this and discovered we do daily bars differently to other platforms! We're looking around now to see what others do and we'll standardize our daily data.
Short explaination is the Oanda data is in UTC -- but the trading platfoms you listed above are in EST; so the daily OHLC values are totally different. You can test this yourself by using FXCM data which is in EST, or hourly data which isn't sensitive to daily timezones.
Once we find the industry standard we'll convert our daily data across.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Josh Morris
Josh Morris
I quickly just threw together the same backtest plugging in FXCM and hourly, to compare to what I'm seeing in Oanda (in the bottom right it says im in UTC), and they look completely different. Is something wrong with my code this time or is it something else?
Alexandre Catarino
@Josh, your results look so different because you are comparing different variables. _macd.Fast is EMA(12) and _macd.Slow is EMA(26). The red and blue lines from the Oanda platform graph is our _macd and _macd.Signal:
Plot("MACD", _macd, _macd.Signal);
Like Jared said, hourly resolution backtests are not sensible to timezones. Here is a one-week period comparison:
We are not beeing fooled by our eyes: when we check the actual values, they are quite similar.
Here is the daily comparison:
Like the hourly graphs, the results are not very different visually (similar using FXCM data). However, if we compare the values, their different is bigger if we compare with the hourly comparison.
Oanda and FXCM platforms consolidate their daily bars starting from 17 EST, thus their result are quite similar. Since we consolidate our data differently, it reflects on the indicators.
Josh Morris
Josh Morris
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!