Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. //0 - текущее положение бара
  2. //1 - предыдущий положение старта/финиша
  3. int Bar_Position = 0;
  4. int Last_Position;
  5.  
  6. const int MinDistance = 20;
  7.  
  8. for(int i = 0; i < Bars; i++) {
  9. quick_ma = iMA(NULL, 0, MA_Period_Quick, 0, MA_Method_Quick, PRICE_CLOSE, i);
  10. slow_ma = iMA(NULL, 0, MA_Period_Slow, 0, MA_Method_Slow, PRICE_CLOSE, i);
  11.  
  12. Last_Position = quick_ma > slow_ma ? 0 : 1;
  13.  
  14. if(quick_ma > slow_ma) {
  15. if(Last_Position == 1) {
  16. if(Bar_Position > MinDistance) {
  17. if(min_price != 9999999)
  18. {
  19. BufferL[Number_Bar] = min_price - Dig * indent * Point;
  20. min_price = 9999999;
  21. Number_Bar = 0;
  22. }
  23.  
  24. Bar_Position = 0;
  25. }
  26.  
  27. } else {
  28. Last_Position = 0;
  29. }
  30.  
  31. if(High[i] > max_price)
  32. {
  33. max_price = High[i];
  34. Number_Bar = i;
  35. }
  36. } else {
  37. if(Last_Position == 0) {
  38. if(Bar_Position > MinDistance) {
  39. if(max_price != 0)
  40. {
  41. BufferH[Number_Bar] = max_price + Dig * indent * Point;
  42. max_price = 0;
  43. Number_Bar = 0;
  44. }
  45.  
  46. Bar_Position = 0;
  47. }
  48. } else {
  49. Last_Position = 1;
  50. }
  51.  
  52. if(Low[i] < min_price)
  53. {
  54. min_price = Low[i];
  55. Number_Bar = i;
  56. }
  57. }
  58.  
  59. Bar_Position++;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement