News Focus
News Focus
icon url

spdpro

05/18/14 4:55 PM

#3105 RE: Hacktheripper #3104

load this and mess with it macd lower study
=========================================================


declare lower;
input fastEMA = 12;
input slowEMA = 26;
input Smooth = 9;
def c = close;
def h = high;
def l = low;
def FSignal = (c * .15) + (.85 * ExpAverage(c, fastEMA)[1]);
def SSignal = (c * .075) + (.925 * ExpAverage(c, slowEMA)[1]);
plot MACD = FSignal - SSignal;
MACD.SetPaintingStrategy(PaintingStrategy.Line);
MACD.SetLineWeight(2);
MACD.AssignValueColor(if MACD < 0 and
MACD < MACD[1]
then Color.Red
else if MACD < 0 and
MACD > MACD[1]
then Color.Cyan
else if MACD > 0 and
MACD > MACD[1]
then Color.Green
else Color.Lime);
plot MACDSL = ExpAverage(MACD, Smooth);
MACDSL.SetPaintingStrategy(PaintingStrategy.Histogram);
MACDSL.SetLineWeight(5);
MACDSL.AssignValueColor(if MACDSL < 0 and
MACDSL < MACDSL[1]
then Color.Plum
else if MACDSL < 0 and
MACDSL > MACDSL[1]
then Color.Green
else if MACDSL > 0 and
MACDSL > MACDSL[1]
then Color.Blue
else Color.Light_Red);

rec MACDh = CompoundValue(1, if MACD < 0
then Double.NaN
else if MACD crosses above 0
then MACD
else if MACD > 0 and
MACD > MACDh[1]
then MACD
else MACDh[1], 0);
rec Valueh = CompoundValue(1, if MACD < 0
then Double.NaN
else if MACD crosses above 0
then h
else if MACD > 0 and
h >Valueh[1]
then h
else Valueh[1], 0);
plot divSignal = if MACD > 0 and
h > Valueh[1] and
MACD < MACDh[1]
then 0
else Double.NaN;
divSignal.SetPaintingStrategy(PaintingStrategy.Points);
divSignal.SetLineWeight(4);
divSignal.SetDefaultColor(Color.Green);
rec MACDl = CompoundValue(1, if MACD > 0
then Double.NaN
else if MACD crosses below 0
then MACD
else if MACD < 0 and
MACD < MACDl[1]
then MACD
else MACDl[1], 0);
rec Valuel = CompoundValue(1, if MACD > 0
then Double.NaN
else if MACD crosses below 0
then l
else if MACD < 0 and
l < Valuel[1]
then l
else Valuel[1], 0);
plot divSignall = if MACD < 0 and
l < Valuel[1] and
MACD > MACDl[1]
then 0
else Double.NaN;
divSignall.SetPaintingStrategy(PaintingStrategy.Points);
divSignall.SetLineWeight(4);
divSignall.SetDefaultColor(Color.Red);
plot zeroLine = if isNaN(divSignal) and
isNaN(divSignall) and
!isNaN(c)
then 0
else Double.NaN;
zeroLine.SetPaintingStrategy(PaintingStrategy.Points);
zeroLine.SetLineWeight(1);
zeroLine.SetDefaultColor(Color.Blue);

# End Code