- Platform
-
- Thinkorswim
Price and Momentum Divergence, very simple, very efficient. Keep it simple folks.
Code:
#Mac Divergence Average Bars
#Ghost
#Mac Avg
def Value = ExpAverage(close, 27) - ExpAverage(close, 55);
def Avg = ExpAverage(Value, 13);
def Avg2 = ExpAverage(Value, 27);
#EmaEma
def ema145 = ExpAverage(close, 62);
def Up = value >= avg2 and close <= ema145;;
def Dwn = value <= avg and close >= ema145;
def UpUp = value >= avg and close >= ema145;
def DwnDwn = value <= avg and close <= ema145;
AssignPriceColor(if Up then color.cyan else if Dwn then color.magenta else if upup then color.green else if dwndwn then color.red else Color.CURRENT);