Back

ADX Warmup Period Inquiry

Hello All, 

I hope someone can help me with this. I am trying to manually warmup adx with a history call. This is a simplified script that I've been trying in the notebook:

qb = QuantBook()
spy = qb.AddEquity("TEAM", Resolution.Daily).Symbol
adx = qb.ADX(spy, 14, Resolution.Daily)
print("The current value before warmup of ADX is = " + str(adx.Current.Value))
print("Warmup Period = " + str(adx.WarmUpPeriod))
bars = qb.History(str(spy), 150, Resolution.Daily)
for bar in bars:
adx.Update(bar)
print("ADX after warmup = " + str(adx.Current.Value))
print(qb.Time)

My question is:

What should be the period in the following statement to properly warmup the adx indicator without making a long unnecessary history call:

bars = qb.History(str(spy), 150, Resolution.Daily) 

I am arbitrarily using 150 since I felt the value of adx at lower numbers keeps changing. (e.g. using 120 gives a different value than using 100) which is confusing. My understanding is that both periods should be equally sufficient to warmup adx for a daily resolution, maybe even lower.

I might be doing something wrong, but I want it to match the custom adx indicator from data providers closely, doesn't have to be identical.

Thanks a bunch,

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.


Hey Amine,

The warm-up period, warmup_period = adx.WarmUpPeriod, represents the minimum number of data points to retrieve a valid value.

Some indicators, such as the ADX, converge to the true ADX value as the amount of data fed into the indicator increases. Notice that as you increase the length of the history call, the value of the ADX is more stable. This means the ADX asymptotically approaches its true current value.

The warmup length needed to retrieve proper values from your indicator will vary with each situation. You can tune the length until you reach a good enough approximation for your needs.

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