外汇指标
bykov trend
回复:0  浏览:34
  • 楼主admin 圈主
  • 2019-05-05 05:06
XAUUSDM30.png

  1. //+------------------------------------------------------------------+
  2. //| BykovTrend_Sig.mq4
  3. //| Ramdass - Conversion only
  4. //+------------------------------------------------------------------+

  5. #property indicator_chart_window
  6. #property indicator_buffers 2
  7. #property indicator_color1 Magenta
  8. #property indicator_color2 Aqua

  9. //---- input parameters
  10. extern int RISK=3;
  11. extern int SSP=9;
  12. extern int CountBars=500;

  13. //---- buffers
  14. double val1[];
  15. double val2[];

  16. //+------------------------------------------------------------------+
  17. //| Custom indicator initialization function                         |
  18. //+------------------------------------------------------------------+
  19. int init()
  20.   {
  21.    string short_name;
  22. //---- indicator line
  23.    IndicatorBuffers(2);
  24.    SetIndexStyle(0,DRAW_ARROW);
  25.    SetIndexArrow(0,234);
  26.    SetIndexStyle(1,DRAW_ARROW);
  27.    SetIndexArrow(1,233);
  28.    SetIndexBuffer(0,val1);
  29.    SetIndexBuffer(1,val2);

  30. //----
  31.    return(0);
  32.   }
  33. //+------------------------------------------------------------------+
  34. //| BykovTrend_Sig                                                   |
  35. //+------------------------------------------------------------------+
  36. int start()
  37.   {   
  38.    SetIndexDrawBegin(0,Bars-CountBars+SSP+1);
  39.    SetIndexDrawBegin(1,Bars-CountBars+SSP+1);
  40.    int i,counted_bars=IndicatorCounted();
  41.    int K;
  42.    bool uptrend,old;
  43.    double wpr;
  44.    
  45.    K=33-RISK;
  46. //----
  47.    if(Bars<=SSP+1) return(0);
  48. //---- initial zero
  49.    if(counted_bars<SSP+1)
  50.    {
  51.       for(i=1;i<=0;i++) val1[CountBars-i]=0.0;
  52.       for(i=1;i<=0;i++) val2[CountBars-i]=0.0;
  53.    }
  54. //----
  55.    i=CountBars-SSP-1;
  56.    if(counted_bars>=SSP+1) i=CountBars-counted_bars-1;
  57.    while(i>=0)
  58.      {
  59.      
  60.    wpr=iWPR(NULL,0,SSP,i);
  61.    val1[i]=0.0; val2[i]=0.0;
  62.    if (wpr<-100+K) uptrend=false;
  63.    if (wpr>-K) uptrend=true;
  64.    if ((! uptrend==old) && uptrend==true) {val2[i]=Low[i]-5*Point;}
  65.    if ((! uptrend==old) && uptrend==false) {val1[i]=High[i]+5*Point;}
  66.    old=uptrend;
  67.       
  68.       i--;
  69.      }
  70.    return(0);
  71.   }
  72. //+------------------------------------------------------------------+