Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
435
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.37 KB | None | 0 0
  1. //+------------------------------------------------------------------+
  2. //| super-signals.mq4 |
  3. //| Copyright © 2006, Nick Bilak, beluck[AT]gmail.com |
  4. //+------------------------------------------------------------------+
  5. #property copyright "Copyright © 2006, Nick Bilak"
  6. #property link "http://www.forex-tsd.com/"
  7.  
  8. #property indicator_chart_window
  9. #property indicator_buffers 2
  10. #property indicator_color1 Red
  11. #property indicator_color2 Aqua
  12.  
  13. extern int SignalGap=10;
  14.  
  15. input int TriggerCandle = 1;
  16. input bool EnableNativeAlerts = true;
  17. input bool EnableSoundAlerts = true;
  18. input bool EnableEmailAlerts = true;
  19. input bool EnablePushAlerts = true;
  20. input string AlertEmailSubject = "";
  21. input string AlertText = "";
  22. input string SoundFileName = "alert.wav";
  23.  
  24. datetime LastAlertTime = D'01.01.1970';
  25. int LastAlertDirection = 0;
  26.  
  27. int dist=50;
  28. double b1[];
  29. double b2[];
  30.  
  31. //+------------------------------------------------------------------+
  32. //| |
  33. //+------------------------------------------------------------------+
  34. int init() {
  35. SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1);
  36. SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1);
  37. SetIndexArrow(1,233);
  38. SetIndexArrow(0,234);
  39. SetIndexBuffer(0,b1);
  40. SetIndexBuffer(1,b2);
  41. return(0);
  42. }
  43. //+------------------------------------------------------------------+
  44. //| |
  45. //+------------------------------------------------------------------+
  46. int start() {
  47. int counted_bars=IndicatorCounted();
  48. int k,i,j,limit,hhb,llb;
  49.  
  50. if (counted_bars<0) return(-1);
  51. if (counted_bars>0) counted_bars--;
  52. limit=Bars-1;
  53. if(counted_bars>=1) limit=Bars-counted_bars-1;
  54. if (limit<0) limit=0;
  55.  
  56. for(i=limit;i>=0;i--) {
  57. hhb=Highest(NULL,0,MODE_HIGH,dist,i-dist/2);
  58. llb=Lowest(NULL,0,MODE_LOW,dist,i-dist/2);
  59.  
  60. if (i==hhb)
  61. b1[i]=High[hhb]+SignalGap*Point;
  62. if (i==llb)
  63. b2[i]=Low[llb]-SignalGap*Point;
  64. }
  65. if (((TriggerCandle > 0) && (Time[0] > LastAlertTime)) || (TriggerCandle == 0))
  66. {
  67. string Text;
  68. // Up Arrow Alert
  69. if ((dUpBuffer[TriggerCandle] > 0) && ((TriggerCandle > 0) || ((TriggerCandle == 0) && (LastAlertDirection != 1))))
  70. {
  71. Text = AlertText + "CCI Arrows: " + Symbol() + " - " + EnumToString((ENUM_TIMEFRAMES)Period()) + " - Up.";
  72. if (EnableNativeAlerts) Alert(Text);
  73. if (EnableEmailAlerts) SendMail(AlertEmailSubject + "CCI Arrows Alert", Text);
  74. if (EnableSoundAlerts) PlaySound(SoundFileName);
  75. if (EnablePushAlerts) SendNotification(Text);
  76. LastAlertTime = Time[0];
  77. LastAlertDirection = 1;
  78. }
  79. // Down Arrow Alert
  80. if ((dUpBuffer[TriggerCandle] > 0) && ((TriggerCandle > 0) || ((TriggerCandle == 0) && (LastAlertDirection != -1))))
  81. {
  82. Text = AlertText + "CCI Arrows: " + Symbol() + " - " + EnumToString((ENUM_TIMEFRAMES)Period()) + " - Down.";
  83. if (EnableNativeAlerts) Alert(Text);
  84. if (EnableEmailAlerts) SendMail(AlertEmailSubject + "CCI Arrows Alert", Text);
  85. if (EnableSoundAlerts) PlaySound(SoundFileName);
  86. if (EnablePushAlerts) SendNotification(Text);
  87. LastAlertTime = Time[0];
  88. LastAlertDirection = -1;
  89.  
  90. return(0);
  91. }
  92.  
  93. //+------------------------------------------------------------------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement