Hi folks. I love this indicator. Its so simple and effective. Can someone please show me how to amend the code to create alerts when the histogram changes from red to green and vice versa? I know its not too complicated but I am useless at coding. Below is the code from Thinkorswim....Thank you.
Code:
#
# Charles Schwab & Co. (c) 2012-2024
#
declare lower;
input length = 10;
input paintBars = yes;
input averageType = AverageType.WILDERS;
def diPlus = DMI(length, averageType)."DI+";
def diMinus = DMI(length, averageType)."DI-";
plot Osc = diPlus - diMinus;
plot Hist = Osc;
plot ZeroLine = 0;
Osc.SetDefaultColor(GetColor(1));
Hist.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Hist.SetLineWeight(3);
Hist.DefineColor("Positive", Color.UPTICK);
Hist.DefineColor("Negative", Color.DOWNTICK);
Hist.AssignValueColor(if Hist > 0 then Hist.Color("Positive") else Hist.Color("Negative"));
Hist.HideTitle();
ZeroLine.SetDefaultColor(Color.GRAY);
DefineGlobalColor("Positive", Color.UPTICK);
DefineGlobalColor("Negative", Color.DOWNTICK);
AssignPriceColor(if !paintBars
then Color.CURRENT
else if Osc > 0
then GlobalColor("Positive")
else GlobalColor("Negative"));
Last edited by a moderator: