Hey guys, when i try to use the macd zero line as automatic trading, it doesn’t work.
I tried the code nicolas posted, but it doesn’t work? I when i press “creation by programming”, i remove the text already there, and copied in this:
EMAshort1 = exponentialaverage[short](close)
EMAshort2 = exponentialaverage[short](EMAshort1)
DifferenceShort = EMAshort1 - EMAshort2
ZeroLagShort = EMAshort1 + DifferenceShort
EMAlong1 = exponentialaverage[long](close)
EMAlong2 = exponentialaverage[long](EMAlong1)
DifferenceLong = EMAlong1 - EMAlong2
ZeroLagLong = EMAlong1 + DifferenceLong
ZeroLagMACD = ZeroLagShort - ZeroLagLong
signal1=ExponentialAverage[signal](ZEROLAGMACD)
signal2=ExponentialAverage[signal](signal1)
DIFFERENCE2=signal1-signal2
SignalMACD=signal1+DIFFERENCE2
RETURN ZeroLagMACD as "Zero Lag MACD", SignalMACD as "Signal MACD"
And it doesn’t work.
What am i doing wrong? Appreciate all help guys!
Thanks
I guess you have seen this? …
Surely such a basic Indicator as the MACD can’t be wrong in the standard PRT listings???
First of all, the INDICATOR that youre trying to implement is missing 3 values: short, long and signal.
you need to define the values for that indicator, like this:
short = 10
long = 20
signal = 15
EMAshort1 = exponentialaverage[short](close)
EMAshort2 = exponentialaverage[short](EMAshort1)
DifferenceShort = EMAshort1 - EMAshort2
ZeroLagShort = EMAshort1 + DifferenceShort
EMAlong1 = exponentialaverage[long](close)
EMAlong2 = exponentialaverage[long](EMAlong1)
DifferenceLong = EMAlong1 - EMAlong2
ZeroLagLong = EMAlong1 + DifferenceLong
ZeroLagMACD = ZeroLagShort - ZeroLagLong
signal1=ExponentialAverage[signal](ZEROLAGMACD)
signal2=ExponentialAverage[signal](signal1)
DIFFERENCE2=signal1-signal2
SignalMACD=signal1+DIFFERENCE2
RETURN ZeroLagMACD as "Zero Lag MACD", SignalMACD as "Signal MACD"
I just used random values for the values, i dont know what values to use here 🙂 Now that you have the indicator, you add a new indicator to the chart and voila, you can use the creation wizard tool to click the indicator and do what you need to do
Hi Bezieh, Are you still using the macd zero line as automatic trading?
I am interested in using this myself.
All the best