Hi,
I need a screener for the attached code.
Plus these Conditions:
1.Buy (blue dot) signal screener result only when below the ‘zero’ line of the indicator. (In the over sell area)
2.Sell (red dot) signal screener result only when above the ‘zero’ line of the indicator. (In the over bought area)
//PRC_MACD Platinum | indicator
//29.09.2016
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
// --- settings
//short = 12
//long = 26
//signal = 9
// --- end of settings
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
if signalMACD>=zerolagMACD then
r=255
g=69
b=0
else
r=54
g=224
b=208
endif
drawbarchart(signalMACD,zerolagMACD,signalMACD,zerolagMACD) coloured(r,g,b)
if zerolagMACD crosses over signalMACD or zerolagMACD crosses under signalMACD then
drawtext("●",barindex,signalMACD,Dialog,Bold,12) coloured(r,g,b)
endif
RETURN ZeroLagMACD coloured(54,224,208) style(dottedline,1 ) as "Zero Lag MACD", SignalMACD coloured(255,69,0) style(line,2) as "Signal MACD", 0 coloured(100,100,100) as "zero line"
Also note: Proscreener hasn’t been working
Thanks,
Segie
Hi here is the required screener:
// PRC_MACD Platinum Screener
// --- parameters
short = 12
long = 26
signal = 9
// --- Zero Lag MACD calculation
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
// --- Buy (blue dot): crossover below the zero line (oversold area)
BuySignal = ZeroLagMACD crosses over SignalMACD AND ZeroLagMACD < 0 AND SignalMACD < 0
// --- Sell (red dot): crossunder above the zero line (overbought area)
SellSignal = ZeroLagMACD crosses under SignalMACD AND ZeroLagMACD > 0 AND SignalMACD > 0
SCREENER[BuySignal OR SellSignal]
Here is how the logic works:
- The full Zero Lag MACD and Signal line calculations are carried over exactly from your indicator, with the three default parameters (short = 12, long = 26, signal = 9) defined at the top so you can easily adjust them.
- BuySignal fires when ZeroLagMACD crosses over SignalMACD (the blue dot condition from your indicator) AND both lines are currently below zero, meaning the crossover is happening in the oversold area beneath the zero line.
- SellSignal fires when ZeroLagMACD crosses under SignalMACD (the red dot condition) AND both lines are currently above zero, confirming the crossover is in the overbought area above the zero line.
- The SCREENER instruction returns any instrument where either condition is true on the last completed bar. If you want to separate the two signals into distinct screener runs, simply replace the final line with SCREENER[BuySignal] or SCREENER[SellSignal] respectively.