Hi,
Are there any python libraries available that can help me in using Demark Indicators? Any pointers will be useful. Thanks in advance.
Why you need a library for this? If you are comfortable with Python, why not calculate it yourself? AFAIK, the index is as below:
x = SMA(max(high(i)-high(i-1), 0), n)
y = SMA(max(low(i-1)-low(i), 0), n)
demark= x/(x+y)
For example, assuming you have "high" and "low" columns in a (pandas) dataframe named "price", y can be calculated as
y = np.maximum(price.low.shift(1)-price.low, 0).rolling(n).mean()
Here n is the period for simple moving average (SMA) and np refers to numpy. The calculation for x is similar. Give it a try. The final index is of course trivial to calculate once you have x and y.
1 Like
Thanks a lot. This helps. Will give it a try.