EasyAI / Python-Charting-Indicators

This repository contains a python file with is used to calculate charting indicators.
MIT License
22 stars 14 forks source link

Add MACD zero lag indicator #2

Closed dsiens closed 3 years ago

dsiens commented 3 years ago

Hello, a request, if possible, to add MACD zero lag indicator Thanks

EasyAI commented 3 years ago

Hello Dsiens,

I can try and get this indicator added for you yes

EasyAI commented 3 years ago

Hello @dsiens,

Can you please confirm that the formula for the indicator: ZeroLAG MACD(i) = (2EMA(Close, EFP, i) - EMA(EMA(Close, FP, i), FP, i)) - (2EMA(Close, SP, i) - EMA(EMA(Close, SP, i), SP, i)) ZeroLAG MACD Signal(i) = 2*EMA(ZeroLAG MACD(i), SigP, i) - EMA(EMA(ZeroLAG MACD(i), SigP, i), SigP, i)

dsiens commented 3 years ago

Hi, I can just rely on your knowledge about this. https://www.mql5.com/en/code/9993 https://www.doctrading.fr/code-macd-zero-retard-zero-lag-macd/ http://fxcodebase.com/code/viewtopic.php?f=17&t=1623

As a MACD strategy, for short trading (scalping on small timeframe), I think this must be a great indicator. Thanks if you integrate this

EasyAI commented 3 years ago

Has now been added.

ititraymond commented 3 years ago

Hi, there is a chance getting the below error, example stock is weekly data of "HK.800000" or "HK.09618"

TypeError: only size-1 arrays can be converted to Python scalars The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users\Administrator.spyder-py3\MSSQL\getStock(genReport)DB.py", line 247, in get_zeroLagMACD z2 = get_DEMA(prices, Eslow)

File "C:\Users\Administrator.spyder-py3\MSSQL\getStock(genReport)DB.py", line 257, in get_DEMA EMA2 = get_EMA(EMA1, maPeriod)

File "C:\Users\Administrator.spyder-py3\MSSQL\getStock(genReport)DB.py", line 290, in get_EMA EMA[0] = seed

ValueError: setting an array element with a sequence.

Appreciate if you could help on this problem