Trigger-Once Auto-Reset Alerts


0
0

Dear Pete – Can you please show me how I can have the trigger sound an alarm only once per breakout (bull or bear), but reset (so that it can alarm again) each time price reverts back into the box zone.  Thank you.

Attachments:
Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on November 27, 2020 3:45 pm
178 views
0
Private answer

I think the following might do it, but I'm not sure (and markets are closed right now)...

### EXAMPLE BREAKOUT DETECTOR

declare upper;

####  ALERT/ALARM SETTINGS

input alert = no;

input noise = {"Bell", "Chimes", default "Ding", "Ring", "NoSound"};

def box_top = 3338;

def box_bot = 3332;

 

# detect if regular trading hours

def RTH = If (SecondsFromTime(0930) >= 0 and SecondsTillTime(1600) >= 0, 1, 0);

 

# combinations that constitute an alert

def bull = high > box_top;

def bear = low < box_bot;

 

# hitting opening range resets one-shot alarm

def reset = low >= box_bot and high <= box_top;

 

# alert trigger conditions

def trigger = RTH and (bull or bear) and reset[1];

 

Alert(

    alert AND trigger,

    if bull then "BULL BREAKOUT" else "BEAR BREAKOUT",

    Alert.BAR, noise

);

Marked as spam
Posted by (Questions: 1, Answers: 1)
Answered on November 28, 2020 2:34 am