10评论

9收藏

Support and Resistance Breakout Arrows【支撑阻力突破箭头】

 

avatar 张玲 | 4242 人阅读 | 10 人评论 | 2018-03-20

USDJPYH1.png

  1. //+------------------------------------------------------------------+
  2. //|                                          Support and Resistance  |
  3. //|                                  Copyright ?2004 Barry Stander  |
  4. //|                           Arrows added by Lennoi Anderson, 2015  |
  5. //+------------------------------------------------------------------+
  6. #property copyright "Copyright ?2004 Barry Stander; Arrow alerts by Lennoi Anderson, 2015."
  7. #property indicator_chart_window
  8. #property indicator_buffers 4
  9. #property indicator_color1 Blue
  10. #property indicator_color2 Red
  11. #property indicator_color3 Blue
  12. #property indicator_color4 Magenta
  13. #property indicator_width3 2
  14. #property indicator_width4 2

  15. extern bool RSICCI_Filter = FALSE;
  16. extern double RSIPeriod = 14;
  17. extern double RSIOverbought = 75;
  18. extern double RSIOversold = 25;
  19. extern double CCIPeriod = 14;
  20. extern double CCIBuyLevel = 50;
  21. extern double CCISellLevel = -50;
  22. extern int SignalDots = 3;
  23. extern bool Alerts = TRUE;
  24. extern bool ApplyToClose = TRUE;
  25. extern int BarCount = 10000;

  26. bool HighBreakout = FALSE;
  27. bool HighBreakPending = FALSE;        
  28. bool LowBreakout = FALSE;
  29. bool LowBreakPending = FALSE;
  30. double LastResistance = 0;
  31. double LastSupport = 0;
  32. double AlertBar = 0;
  33. //---- buffers
  34. double v1[];
  35. double v2[];
  36. double BreakUp[];
  37. double BreakDown[];
  38. double val1;
  39. double val2;
  40. int counter1;
  41. int counter2;
  42. //+------------------------------------------------------------------+
  43. //|                                                                  |
  44. //+------------------------------------------------------------------+  
  45. int init()
  46. {
  47. //---- drawing settings
  48.    SetIndexArrow(0, 119);
  49.    SetIndexArrow(1, 119);
  50. //----  
  51.    SetIndexStyle(0, DRAW_ARROW, STYLE_DOT, 0, Red);
  52.    //SetIndexDrawBegin(0, i-1);
  53.    SetIndexBuffer(0, v1);
  54.    SetIndexLabel(0, "Resistance");
  55. //----   
  56.    SetIndexStyle(1, DRAW_ARROW, STYLE_DOT, 0, Blue);
  57.    //SetIndexDrawBegin(1, i-1);
  58.    SetIndexBuffer(1, v2);
  59.    SetIndexLabel(1, "Support");
  60. //----
  61.    SetIndexStyle(2, DRAW_ARROW, EMPTY, 2);
  62.    SetIndexArrow(2, 233);
  63.    SetIndexBuffer(2, BreakUp);
  64. //----   
  65.    SetIndexStyle(3, DRAW_ARROW, EMPTY, 2);
  66.    SetIndexArrow(3, 234);
  67.    SetIndexBuffer(3, BreakDown);
  68.    return(0);
  69. }
  70. //+------------------------------------------------------------------+
  71. int start()
  72. {   
  73. //----
  74.    for(int i = BarCount; i >=0; i--)
  75.    {   
  76.        val1 = iFractals(NULL, 0, MODE_UPPER, i);
  77.        //----
  78.        if(val1 > 0)
  79.        {
  80.            v1[i] = High[i];
  81.            counter1 = 1;         
  82.        }
  83.        else
  84.        {
  85.            v1[i] = v1[i+1];
  86.            counter1++;           
  87.        }
  88.        val2 = iFractals(NULL, 0, MODE_LOWER, i);
  89.        //----
  90.        if(val2 > 0)
  91.        {
  92.            v2[i] = Low[i];
  93.            counter2 = 1;     
  94.        }
  95.        else
  96.        {
  97.            v2[i] = v2[i+1];
  98.            counter2++;        
  99.        }
  100.                     
  101.        if (v1[i] != LastResistance) { HighBreakPending = True; LastResistance = v1[i]; }
  102.        if (v2[i] != LastSupport) { LowBreakPending = True; LastSupport = v2[i]; }  
  103.                   
  104.        if (HighBreakPending && Close[i] > v1[i] && (!RSICCI_Filter || (RSICCI_Filter && iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, i) < RSIOverbought &&
  105.            iCCI(Symbol(), NULL, CCIPeriod, PRICE_CLOSE, i) > CCIBuyLevel)) && counter1 >= SignalDots) HighBreakout = TRUE;
  106.        if (LowBreakPending && Close[i] < v2[i] && (!RSICCI_Filter || (RSICCI_Filter && iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, i) > RSIOversold &&
  107.            iCCI(Symbol(), NULL, CCIPeriod, PRICE_CLOSE, i) < CCISellLevel)) && counter2 >= SignalDots) LowBreakout = TRUE;
  108.            
  109.        if (ApplyToClose) int AlertCandle = 1; else AlertCandle = 0;         
  110.       
  111.        if (HighBreakout)
  112.        {         
  113.          if (i >= AlertCandle) BreakUp[i] = Low[i]-10*Point;
  114.          if (Alerts && i == AlertCandle && Bars > AlertBar)
  115.          {
  116.            Alert(Symbol(), " M", Period(), ": Resistance Breakout: BUY");
  117.            AlertBar = Bars;
  118.          }
  119.          HighBreakout = False;
  120.          HighBreakPending = False;
  121.        } else
  122.        if (LowBreakout)
  123.        {
  124.          if (i >= AlertCandle) BreakDown[i] = High[i]+10*Point;              
  125.          if (Alerts && i==AlertCandle && Bars>AlertBar)
  126.          {  
  127.            Alert(Symbol(), " M", Period(), ": Support Breakout: SELL");
  128.            AlertBar = Bars;
  129.          }
  130.          LowBreakout = False;
  131.          LowBreakPending = False;
  132.        }   
  133.    }  
  134.    return(0);
  135. }
复制代码


Support and Resistance Breakout Arrows.mq4
""
还没有人打赏,支持一下

评论|共 10 个

bxcyn

发表于 2018-9-20 16:07:07 | 显示全部楼层

感谢分享

浅川

发表于 2020-3-15 18:52:24 | 显示全部楼层

前排支持下分享

不走回头路

发表于 2020-4-21 08:48:50 来自手机 | 显示全部楼层

学习技术交流技术

不走回头路

发表于 2020-5-13 11:46:07 来自手机 | 显示全部楼层

学习技术交流技术

me乐乐

发表于 2020-5-18 22:50:07 | 显示全部楼层

感谢分享666

824jduf

发表于 2020-6-7 15:31:41 | 显示全部楼层

真是 收益 匪浅

92469com

发表于 2020-6-21 17:02:47 | 显示全部楼层

看帖回帖是美德!:lol

天天好心情

发表于 2020-8-11 12:42:39 | 显示全部楼层

学习了,不错

blacktie

发表于 2021-7-19 22:57:26 | 显示全部楼层

支持下

12下一页
您需要登录后才可以回帖 登录 | 注册 微信登录

EA之家评论守则