Back

MACD calculation

Hi!

Two questions:

1.

I am just doing some basic thing to make sure the indicator calculation result is correct. I pick these two:

MACD(symbol_TSLA, 12, 26, 9, MovingAverageType.Exponential, Resolution.Hour, Field.Close);
EMA(symbol_TSLA, 20, Resolution.Hour, Field.Close);

The log file is here : http://data.quantconnect.com/backtests/16935/209033/59cb4a70f93a20e33274e5dc4de51d8a-log.txt


The EMA calculation seems right. But MACD seems off.

For example, in the log file:

...
2016-01-11 11:00:00 01/11/2016 10:00:00--TSLA-- 205.88900000000

2016-01-11 11:00:00 MACD -2.96667


But from hourly chart from TDAmeritrade, I see MACD is about -3.55.

2.
Since I specify "Resolution.Hour", I expect the time stamp of data gets to OnData() should be 9:30, 10:30 .... not 9:00, 10:00, since markets starts at the half hour mark. But from the log the data arrives at the hourly mark 9:00, 10:00. Why?

Thanks!








Update Backtest








1) We verify our data with FreeStockCharts.com - and test it with automated test runners.
https://github.com/QuantConnect/Lean/blob/master/Tests/Indicators/MovingAverageConvergenceDivergenceTests.cs#L32

2) We decided to round to the hour so our data also ends at 4pm. If you like a different hour step you can request minute data and then build your own hour bars.

0

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.


Update Backtest





0

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.


Loading...

This discussion is closed