Advertisement
njengaz

Untitled

Jan 11th, 2018
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1.  
  2.  
  3. #property indicator_chart_window
  4. #property indicator_buffers 2
  5. #property indicator_width1 2
  6. #property indicator_color1 Lime
  7. #property indicator_width2 2
  8. #property indicator_color2 Red
  9. extern int qual=5;
  10. extern int len=5;
  11. extern int Distance = 1;
  12. extern int Countbars=1000;
  13. input int TriggerCandle = 1;
  14. input bool EnableNativeAlerts = true;
  15. input bool EnableSoundAlerts = true;
  16. input bool EnableEmailAlerts = true;
  17. input string AlertEmailSubject = "";
  18. input string AlertText = "";
  19. input string SoundFileName = "alert.wav";
  20. datetime LastAlertTime = D'01.01.1970';
  21. int LastAlertDirection = 0;
  22. double Up[];
  23. double Dn[];
  24. double point;
  25. double bs=0;
  26. double index=0;
  27. double bindex=0;
  28. double sindex=0;
  29. double length=0;
  30. double ret=0;
  31.  
  32. int init() {
  33. if(Digits==3 || Digits==5) {
  34. point=10*Point;
  35. }
  36. else{
  37. point=Point;
  38.  
  39. }
  40.  
  41. IndicatorBuffers(2);
  42. SetIndexStyle(0, DRAW_ARROW);
  43. SetIndexBuffer(0, Up);
  44. SetIndexArrow(0,161);
  45. SetIndexStyle(1, DRAW_ARROW);
  46.  
  47. SetIndexBuffer(1, Dn);
  48. SetIndexArrow(1,161);
  49.  
  50.  
  51.  
  52. return (0);
  53. }
  54.  
  55. int deinit() {
  56. return (0);
  57. }
  58.  
  59. int start() {
  60. bool TurnedUp = false;
  61. bool TurnedDown = false;
  62. double highest,lowest;
  63.  
  64. int i,limit,limit2;
  65. int counted_bars = IndicatorCounted();
  66. if(counted_bars < 0)
  67. return(-1);
  68.  
  69. limit=Countbars-counted_bars;
  70. if (i> limit2)
  71. limit2= i;
  72. if (limit2 <Countbars-1)
  73. limit =Countbars- 1;
  74.  
  75. for( i=limit; i>=0; i--) {
  76. if (Close[i]>Close[i+4]){
  77. bindex=bindex+1;
  78. }
  79. if(Close[i]<Close[i+4]){
  80. sindex=sindex+1;
  81. }
  82. ret=0;
  83. index=0;
  84.  
  85.  
  86. if ((bindex>qual) && (Close[i]<Open[i])&& (High[i]>=High[iHighest(Symbol(),0,MODE_HIGH,len,i+1)])) {
  87. index=1;
  88. bindex=0;
  89. ret=-1;
  90. }
  91. if ((sindex>qual) && (Close[i]>Open[i])&& (Low[i]<= Low[iLowest(Symbol(),0,MODE_LOW,len,i+1)])) {
  92. index=-1;
  93. sindex=0;
  94. ret=1;
  95. }
  96.  
  97. if (ret==1 && i!=0){
  98. Up[i]=Low[i]-Distance*point;
  99. }
  100. else Up[i] = 0;
  101. if (ret==-1 && i!=0){
  102. Dn[i]=High[i]+Distance*point;
  103.  
  104. }
  105. else Dn[i] = 0;
  106. }
  107.  
  108. if (i> limit2)
  109. limit2= i;
  110.  
  111.  
  112. return (0);
  113. if (((TriggerCandle > 0) && (Time[0] > LastAlertTime)) || (TriggerCandle == 0))
  114. {
  115. string Text;
  116. // Up Arrow Alert
  117. if (( Up[TriggerCandle] > 0) && ((TriggerCandle > 0) || ((TriggerCandle == 0) && (LastAlertDirection != 1))))
  118. {
  119. Text = AlertText + "ACT: " + Symbol() + " - " + EnumToString((ENUM_TIMEFRAMES)Period()) + " - ACT.";
  120. if (EnableNativeAlerts) Alert(Text);
  121. if (EnableEmailAlerts) SendMail(AlertEmailSubject + "up", Text);
  122. if (EnableSoundAlerts) PlaySound(SoundFileName);
  123. LastAlertTime = Time[0];
  124. LastAlertDirection = 1;
  125. }
  126. // Down Arrow Alert
  127. if ((Dn[TriggerCandle] > 0) && ((TriggerCandle > 0) || ((TriggerCandle == 0) && (LastAlertDirection != -1))))
  128. {
  129. Text = AlertText + "ACT: " + Symbol() + " - " + EnumToString((ENUM_TIMEFRAMES)Period()) + " - ACT .";
  130. if (EnableNativeAlerts) Alert(Text);
  131. if (EnableEmailAlerts) SendMail(AlertEmailSubject + "CCI Arrows Alert", Text);
  132. if (EnableSoundAlerts) PlaySound(SoundFileName);
  133. LastAlertTime = Time[0];
  134. LastAlertDirection = -1;
  135. }
  136. }
  137.  
  138. return (0);
  139. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement