Setting alarms on the relative momentum index

Namor

New member
VIP
How does one set alarms on the relative momentum index? I can place them in marketwatch, however once they are triggered, I have to reenter them anew. How can a sound alarm be placed that works on a continual basis without requiring a redo? Many thanks in advance.
 

BenTen

Administrative
Staff
VIP
@Namor Here you go:

Code:
#
# TD Ameritrade IP Company, Inc. (c) 2007-2020
#

declare lower;

input length = 20;
input momentum = 5;

assert(momentum > 0, "'momentum' must be positive: " + momentum);

def emaInc = ExpAverage(Max(close - close[momentum], 0), length);
def emaDec = ExpAverage(Max(close[momentum] - close, 0), length);
plot RMI = if emaDec == 0 then 0 else 100 - 100 / (1 + emaInc / emaDec);
plot OverBought = 70;
plot OverSold = 30;

RMI.SetDefaultColor(GetColor(1));
OverBought.SetDefaultColor(GetColor(8));
OverSold.SetDefaultColor(GetColor(8));

def condition1 = RMI crosses above OverSold;
def condition2 = RMI crosses below OverBought;

# Alerts
Alert(condition1, " ", Alert.Bar, Sound.Chimes);
Alert(condition2, " ", Alert.Bar, Sound.Bell);
 

Similar threads

Top