Advertisement
Guest User

Untitled

a guest
Dec 10th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. ;
  2. input opentime = 0830;
  3. input ORend = 0930;
  4. def na = Double.NaN;
  5. #
  6. # Check if the opening range time is now
  7. #
  8. def ORActive = if GetLastDay() == GetDay() and SecondsFromTime(opentime) >= 0 and SecondsFromTime(ORend) < 0 then 1 else 0;
  9. #
  10. # Track the OR high and low
  11. #
  12. def ORHigh = if ORActive then high else na;
  13. def ORLow = if ORActive then low else na;
  14. #
  15. # Plot the OR high and low
  16. #
  17. plot ORAH = if GetLastDay() != GetDay() or !ORActive then na else HighestAll(ORHigh);
  18. plot ORAL = if GetLastDay() != GetDay() or !ORActive then na else LowestAll(ORLow);
  19. plot ORH = if GetLastDay() != GetDay() or SecondsFromTime(ORend) < 0 then na else HighestAll(ORHigh);
  20. plot ORL = if GetLastDay() != GetDay() or SecondsFromTime(ORend) < 0 then na else LowestAll(ORLow);
  21. #
  22. # Formatting
  23. #
  24. ORAH.SetStyle(Curve.SHORT_DASH);
  25. ORAL.SetStyle(Curve.SHORT_DASH);
  26. ORAH.SetDefaultColor(Color.GREEN);
  27. ORAL.SetDefaultColor(Color.RED);
  28. ORH.SetStyle(Curve.SHORT_DASH);
  29. ORL.SetStyle(Curve.SHORT_DASH);
  30. ORH.SetDefaultColor(Color.GREEN);
  31. ORL.SetDefaultColor(Color.RED);
  32. #
  33. # Add Cloud creates the shading
  34. #
  35. #AddCloud(ORH, ORL);
  36. AddCloud(ORAL, ORAH, Color.GREEN);
  37. #
  38. # Alerts:
  39. #
  40. def alerttrigger = if (high >= ORH and low <= ORH) or (high >= ORL and low <= ORL) then 1 else 0; #replace the 1 with your definition
  41. # BLOCK CODE BELOW
  42. input alerttext = "OR Breakout!";
  43. input UseAlerts = {false, default true};
  44. input AlertType = {default "BAR", "ONCE", "TICK"};
  45. def at = AlertType;
  46. input AlertSound = {"Bell", "Chimes", default "Ding", "NoSound", "Ring"};
  47. #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