Reasonable_Drag
New member
Hi all,
I have a custom coded script, just a really basic HMA for entries and exits and min and max points, but for some reason my alerts aren't triggering for it. It plots perfectly fine, but no associated rings, dings, or chimes. Can anyone help me problem solve?
I have a custom coded script, just a really basic HMA for entries and exits and min and max points, but for some reason my alerts aren't triggering for it. It plots perfectly fine, but no associated rings, dings, or chimes. Can anyone help me problem solve?
Code:
############
# HMA Max and Min Points
############
input HMAprice = HL2;
input HMA_Length = 22;
def HMA = HullMovingAvg(price = HMAprice, length = HMA_Length);
def HMAMax = if HMA[-1] < HMA and HMA > HMA[1] then HMA else Double.NaN;
def HMAMin = if HMA[-1] > HMA and HMA < HMA[1] then HMA else Double.Nan;
#########
# Plots
#########
plot OpenLong = if HMAMin then low else Double.NaN;;
OpenLong.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
OpenLong.SetDefaultColor (color.GREEN);
OpenLong.SetLineWeight(3);
plot OpenShort = if HMAMax then high else Double.NaN;;
OpenShort.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
OpenShort.SetDefaultColor (color.RED);
OpenShort.SetLineWeight(3);
###################
# Alerts
###################
Alert(OpenLong, "Open Long", Alert.BAR, Sound.Ring);
Alert(OpenShort, "Open Short", Alert.BAR, Sound.Ring);
# END OF CODE