Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;
- input opentime = 0830;
- input ORend = 0930;
- def na = Double.NaN;
- #
- # Check if the opening range time is now
- #
- def ORActive = if GetLastDay() == GetDay() and SecondsFromTime(opentime) >= 0 and SecondsFromTime(ORend) < 0 then 1 else 0;
- #
- # Track the OR high and low
- #
- def ORHigh = if ORActive then high else na;
- def ORLow = if ORActive then low else na;
- #
- # Plot the OR high and low
- #
- plot ORAH = if GetLastDay() != GetDay() or !ORActive then na else HighestAll(ORHigh);
- plot ORAL = if GetLastDay() != GetDay() or !ORActive then na else LowestAll(ORLow);
- plot ORH = if GetLastDay() != GetDay() or SecondsFromTime(ORend) < 0 then na else HighestAll(ORHigh);
- plot ORL = if GetLastDay() != GetDay() or SecondsFromTime(ORend) < 0 then na else LowestAll(ORLow);
- #
- # Formatting
- #
- ORAH.SetStyle(Curve.SHORT_DASH);
- ORAL.SetStyle(Curve.SHORT_DASH);
- ORAH.SetDefaultColor(Color.GREEN);
- ORAL.SetDefaultColor(Color.RED);
- ORH.SetStyle(Curve.SHORT_DASH);
- ORL.SetStyle(Curve.SHORT_DASH);
- ORH.SetDefaultColor(Color.GREEN);
- ORL.SetDefaultColor(Color.RED);
- #
- # Add Cloud creates the shading
- #
- #AddCloud(ORH, ORL);
- AddCloud(ORAL, ORAH, Color.GREEN);
- #
- # Alerts:
- #
- def alerttrigger = if (high >= ORH and low <= ORH) or (high >= ORL and low <= ORL) then 1 else 0; #replace the 1 with your definition
- # BLOCK CODE BELOW
- input alerttext = "OR Breakout!";
- input UseAlerts = {false, default true};
- input AlertType = {default "BAR", "ONCE", "TICK"};
- def at = AlertType;
- input AlertSound = {"Bell", "Chimes", default "Ding", "NoSound", "Ring"};
- #Alert(alerttrigger and UseAlerts, alerttext, if at == 1 then Alert.ONCE else if at == 2 then Alert.TICK else Alert.BAR, AlertSound);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement