Advertisement
njengaz

Untitled

Jan 11th, 2018
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 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. double Up[];
  14. double Dn[];
  15. double point;
  16. double bs=0;
  17. double index=0;
  18. double bindex=0;
  19. double sindex=0;
  20. double length=0;
  21. double ret=0;
  22.  
  23. int init() {
  24. if(Digits==3 || Digits==5) {
  25. point=10*Point;
  26. }
  27. else{
  28. point=Point;
  29.  
  30. }
  31.  
  32. IndicatorBuffers(2);
  33. SetIndexStyle(0, DRAW_ARROW);
  34. SetIndexBuffer(0, Up);
  35. SetIndexArrow(0,161);
  36. SetIndexStyle(1, DRAW_ARROW);
  37.  
  38. SetIndexBuffer(1, Dn);
  39. SetIndexArrow(1,161);
  40.  
  41.  
  42.  
  43. return (0);
  44. }
  45.  
  46. int deinit() {
  47. return (0);
  48. }
  49.  
  50. int start() {
  51. bool TurnedUp = false;
  52. bool TurnedDown = false;
  53. double highest,lowest;
  54.  
  55. int i,limit,limit2;
  56. int counted_bars = IndicatorCounted();
  57. if(counted_bars < 0)
  58. return(-1);
  59.  
  60. limit=Countbars-counted_bars;
  61. if (i> limit2)
  62. limit2= i;
  63. if (limit2 <Countbars-1)
  64. limit =Countbars- 1;
  65.  
  66. for( i=limit; i>=0; i--) {
  67. if (Close[i]>Close[i+4]){
  68. bindex=bindex+1;
  69. }
  70. if(Close[i]<Close[i+4]){
  71. sindex=sindex+1;
  72. }
  73. ret=0;
  74. index=0;
  75.  
  76.  
  77. if ((bindex>qual) && (Close[i]<Open[i])&& (High[i]>=High[iHighest(Symbol(),0,MODE_HIGH,len,i+1)])) {
  78. index=1;
  79. bindex=0;
  80. ret=-1;
  81. }
  82. if ((sindex>qual) && (Close[i]>Open[i])&& (Low[i]<= Low[iLowest(Symbol(),0,MODE_LOW,len,i+1)])) {
  83. index=-1;
  84. sindex=0;
  85. ret=1;
  86. }
  87.  
  88. if (ret==1 && i!=0){
  89. Up[i]=Low[i]-Distance*point;
  90. }
  91.  
  92. if (ret==-1 && i!=0){
  93. Dn[i]=High[i]+Distance*point;
  94.  
  95. }
  96.  
  97. }
  98.  
  99. if (i> limit2)
  100. limit2= i;
  101.  
  102.  
  103. return (0);
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement