Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1.  
  2. input marketThreshold = 0.00;
  3. input timeFrame = {default DAY, "2 DAYS", "3 DAYS", "4 DAYS", WEEK, MONTH, YEAR, "OPT EXP"};
  4. input showOnlyToday = no;
  5.  
  6.  
  7. def PP2 = high(period = timeFrame)[2] + low(period = timeFrame)[2] + close(period = timeFrame)[2];
  8.  
  9. plot R3;
  10. plot R2;
  11. plot R1;
  12. plot PP;
  13. plot S1;
  14. plot S2;
  15. plot S3;
  16.  
  17. if showOnlyToday and !IsNaN(close(period = timeFrame)[-1])
  18. then {
  19. R1 = Double.NaN;
  20. R2 = Double.NaN;
  21. R3 = Double.NaN;
  22. PP = Double.NaN;
  23. S1 = Double.NaN;
  24. S2 = Double.NaN;
  25. S3 = Double.NaN;
  26.  
  27. } else {
  28.  
  29. PP = (high(period = timeFrame)[1] + low(period = timeFrame)[1] + close(period = timeFrame)[1]) / 3;
  30. R1 = PP + ((high(period = timeFrame)[1] - low(period = timeFrame)[1])* .382);
  31. R2 = PP + ((high(period = timeFrame)[1] - low(period = timeFrame)[1])* .618);
  32. R3 = PP + ((high(period = timeFrame)[1] - low(period = timeFrame)[1])* 1.0);
  33.  
  34. S1 = PP - ((high(period = timeFrame)[1] - low(period = timeFrame)[1])* .382);
  35. S2 = PP - ((high(period = timeFrame)[1] - low(period = timeFrame)[1])* .618);
  36. S3 = PP - ((high(period = timeFrame)[1] - low(period = timeFrame)[1])* 1.0);
  37.  
  38. }
  39.  
  40. PP.SetDefaultColor(GetColor(0));
  41. R1.SetDefaultColor(GetColor(2));
  42. R2.SetDefaultColor(GetColor(8));
  43. R3.SetDefaultColor(GetColor(3));
  44. S1.SetDefaultColor(GetColor(6));
  45. S2.SetDefaultColor(GetColor(1));
  46. S3.SetDefaultColor(GetColor(3));
  47.  
  48.  
  49. PP.SetStyle(Curve.firm);
  50. R1.SetStyle(Curve.SHORT_DASH);
  51. R2.SetStyle(Curve.SHORT_DASH);
  52. R3.SetStyle(Curve.SHORT_DASH);
  53. S1.SetStyle(Curve.SHORT_DASH);
  54. S2.SetStyle(Curve.SHORT_DASH);
  55. S3.SetStyle(Curve.SHORT_DASH);
  56.  
  57. def paintingStrategy = if timeframe == timeframe.WEEK then PaintingStrategy.DASHES else if timeFrame == timeFrame.MONTH or timeFrame == timeFrame."OPT EXP" or timeFrame == timeFrame.YEAR then PaintingStrategy.DASHES else PaintingStrategy.DASHES;
  58.  
  59. PP.SetPaintingStrategy(paintingStrategy);
  60. R1.SetPaintingStrategy(paintingStrategy);
  61. R2.SetPaintingStrategy(paintingStrategy);
  62. R3.SetPaintingStrategy(paintingStrategy);
  63. S1.SetPaintingStrategy(paintingStrategy);
  64. S2.SetPaintingStrategy(paintingStrategy);
  65. S3.SetPaintingStrategy(paintingStrategy);
  66.  
  67. #####
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement