8评论

0收藏

fast-oscillator

avatar admin | 1575 人阅读 | 8 人评论 | 2018-01-18

XAUUSDH1.png

  1. //+------------------------------------------------------------------+
  2. //|                                                       _Fast2.mq4 |
  3. //|                      Copyright ?2008, MetaQuotes Software Corp. |
  4. //|                                        http://www.metaquotes.net |
  5. //+------------------------------------------------------------------+
  6. #property copyright "Copyright ?2008, MetaQuotes Software Corp."
  7. #property link      "http://www.metaquotes.net"

  8. #property indicator_separate_window
  9. #property indicator_buffers 7
  10. #property indicator_color1 LightSeaGreen
  11. #property indicator_color2 Green
  12. #property indicator_color3 Red
  13. #property indicator_color4 White
  14. #property indicator_color5 Red
  15. #property indicator_color6 Blue
  16. extern int    ma1=3;
  17. extern int    ma2=9;
  18. extern bool   sound=true;
  19. extern bool   alert=false;
  20. extern bool   comment=true;

  21. //---- buffers
  22. double ExtMapBuffer1[];
  23. double ExtMapBuffer2[];
  24. double ExtMapBuffer3[];
  25. double ExtMapBuffer4[];
  26. double ExtMapBuffer5[];
  27. double ExtMapBuffer6[];
  28. double Outbuf[];
  29. static int prevtime = 0 ;
  30. double spr,stop;
  31. string simv;
  32. //+------------------------------------------------------------------+
  33. //| Custom indicator initialization function                         |
  34. //+------------------------------------------------------------------+
  35. int init()
  36.   {
  37. //---- indicators
  38.    SetIndexStyle(0,DRAW_HISTOGRAM);
  39.    SetIndexBuffer(0,ExtMapBuffer1);
  40.    SetIndexStyle(1,DRAW_LINE,0,2);
  41.    SetIndexBuffer(1,ExtMapBuffer2);
  42.    SetIndexStyle(2,DRAW_LINE,0,2);
  43.    SetIndexBuffer(2,ExtMapBuffer3);
  44.    SetIndexStyle(3,DRAW_NONE);
  45.    SetIndexBuffer(3,Outbuf);
  46.    SetIndexStyle(4,DRAW_ARROW);
  47.    SetIndexArrow(4,236);
  48.    SetIndexBuffer(4,ExtMapBuffer5);
  49.    SetIndexEmptyValue(4,0.0);
  50.    SetIndexStyle(5,DRAW_ARROW);
  51.    SetIndexArrow(5,238);
  52.    SetIndexBuffer(5,ExtMapBuffer6);
  53.    SetIndexEmptyValue(5,0.0);
  54. //----
  55. Outbuf[1]=0;
  56. simv = (Symbol());
  57.   if (simv == "EURUSD")
  58.      {
  59.      spr = MarketInfo("EURUSD",MODE_SPREAD);
  60.      stop = MarketInfo("EURUSD",MODE_STOPLEVEL);
  61.      }
  62.   if (simv == "GBPUSD")
  63.      {
  64.      spr = MarketInfo("GBPUSD",MODE_SPREAD);
  65.      stop = MarketInfo("GBPUSD",MODE_STOPLEVEL);
  66.      }
  67.   if (simv == "EURJPY")
  68.      {
  69.      spr = MarketInfo("EURJPY",MODE_SPREAD);
  70.      stop = MarketInfo("EURJPY",MODE_STOPLEVEL);
  71.      }
  72.   if (simv == "GBPJPY")
  73.      {
  74.      spr = MarketInfo("GBPJPY",MODE_SPREAD);
  75.      stop = MarketInfo("GBPJPY",MODE_STOPLEVEL);
  76.      }
  77.   if (simv == "USDJPY")
  78.      {
  79.      spr = MarketInfo("USDJPY",MODE_SPREAD);
  80.      stop = MarketInfo("USDJPY",MODE_STOPLEVEL);
  81.      }
  82.   if (simv == "EURCHF")
  83.      {
  84.      spr = MarketInfo("EURCHF",MODE_SPREAD);
  85.      stop = MarketInfo("EURCHF",MODE_STOPLEVEL);
  86.      }
  87.   if (simv == "GBPCHF")
  88.      {
  89.      spr = MarketInfo("GBPCHF",MODE_SPREAD);
  90.      stop = MarketInfo("GBPCHF",MODE_STOPLEVEL);
  91.      }
  92.   if (simv == "USDCHF")
  93.      {
  94.      spr = MarketInfo("USDCHF",MODE_SPREAD);
  95.      stop = MarketInfo("USDCHF",MODE_STOPLEVEL);
  96.      }
  97.   if (simv == "USDCAD")
  98.      {
  99.      spr = MarketInfo("USDCAD",MODE_SPREAD);
  100.      stop = MarketInfo("USDCAD",MODE_STOPLEVEL);
  101.      }
  102.   if (simv == "AUDUSD")
  103.      {
  104.      spr = MarketInfo("AUDUSD",MODE_SPREAD);
  105.      stop = MarketInfo("AUDUSD",MODE_STOPLEVEL);
  106.      }
  107.    return(0);
  108.   }
  109. //+------------------------------------------------------------------+
  110. //| Custom indicator deinitialization function                       |
  111. //+------------------------------------------------------------------+
  112. int deinit()
  113.   {
  114. //----
  115. Comment("  ");   
  116. //----
  117.    return(0);
  118.   }
  119. //+------------------------------------------------------------------+
  120. //| Custom indicator iteration function                              |
  121. //+------------------------------------------------------------------+
  122. int start()
  123.   {
  124. //----
  125. int    counted_bars=IndicatorCounted();
  126. //----
  127.    if(counted_bars>0)
  128.         counted_bars--;
  129.      
  130.    int limit=Bars-counted_bars;
  131.    for(int i=0;i<Bars;i++)
  132.    {
  133.    ExtMapBuffer1[i]=((Close[i]-Open[i])+((Close[i+1]-Open[i+1])/MathSqrt(2))+((Close[i+2]-Open[i+2])/MathSqrt(3)))/Point;
  134.   // ExtMapBuffer1[i]=((Close[i]-Open[i])+((Close[i+1]-Open[i+1])/MathSqrt(2))+((Close[i+2]-Open[i+2])/MathSqrt(3))+((Close[i+3]-Open[i+3])/MathSqrt(5))+((Close[i+4]-Open[i+4])/MathSqrt(8)))/Point;

  135.    }
  136.    for(i=0;i<Bars;i++)
  137.    {
  138.    ExtMapBuffer2[i]=iMAOnArray(ExtMapBuffer1,Bars,ma1,0,MODE_LWMA,i);
  139.    ExtMapBuffer3[i]=iMAOnArray(ExtMapBuffer1,Bars,ma2,0,MODE_LWMA,i);
  140.    }
  141. // 其屐, 觐沅?耵铕扈痼弪? 眍恹?徉?
  142.    if (Time[0] == prevtime) return(0);
  143.    prevtime = Time[0];
  144.    Outbuf[1]=0;  
  145. //--------------------   
  146.       if (((ExtMapBuffer2[2] > ExtMapBuffer3[2])&&(ExtMapBuffer2[1] < ExtMapBuffer3[1])&&(ExtMapBuffer2[0] < ExtMapBuffer3[0]))
  147.              &&((ExtMapBuffer2[2]>0)&&(ExtMapBuffer3[2]>0))&&((ExtMapBuffer1[1]<=0)&&(ExtMapBuffer1[0]<0)))
  148.              {
  149.              ExtMapBuffer6[1]=(ExtMapBuffer1[1]+ExtMapBuffer2[1]);
  150.          if (sound==true)PlaySound("alert.wav");            
  151.          if (alert==true) Alert (Symbol());  
  152.          if (comment==true)Comment(Symbol(),TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS),"\n","SELL    SL= ",MathAbs(ExtMapBuffer1[1]-Close[1]));
  153.              Outbuf[1]=1;
  154.              Outbuf[2]=(MathAbs(ExtMapBuffer1[1]-Close[1]));
  155.              if (Outbuf[2]<stop) Outbuf[2] =(MathAbs(ExtMapBuffer1[1]-Close[1]))+ stop;
  156.              } else { ExtMapBuffer6[1]= 0.0; }
  157.       if (((ExtMapBuffer2[2] < ExtMapBuffer3[2])&&(ExtMapBuffer2[1] > ExtMapBuffer3[1])&&(ExtMapBuffer2[0] > ExtMapBuffer3[0]))
  158.              &&((ExtMapBuffer2[2]<0)&&(ExtMapBuffer3[2]<0))&&((ExtMapBuffer1[1]>=0)&&(ExtMapBuffer1[0]>0)))
  159.              {
  160.              ExtMapBuffer5[1]=(ExtMapBuffer1[1]+ExtMapBuffer2[1]);
  161.          if (sound==true)PlaySound("alert.wav");            
  162.          if (alert==true) Alert (Symbol());
  163.          if (comment==true)Comment(Symbol(),TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS),"\n","BUY     SL= ",MathAbs(ExtMapBuffer1[1]-Close[1]));
  164.              Outbuf[1]=2;
  165.              Outbuf[2]=(MathAbs(ExtMapBuffer1[1]-Close[1]));
  166.              if (Outbuf[2]<stop) Outbuf[2]=(MathAbs(ExtMapBuffer1[1]-Close[1]))+ stop;
  167.              } else {  ExtMapBuffer5[1]= 0.0;  }   

  168.    if ((ExtMapBuffer2[2] - ExtMapBuffer3[2]) > (ExtMapBuffer2[1] - ExtMapBuffer3[1]))
  169.          {
  170.          if (sound==true)PlaySound("alert2.wav");
  171.          if (comment==true)Comment(TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS),"\n","Close !!!",(Close[1]));
  172.           Outbuf[1]=3;
  173.          }

  174.    
  175.    
  176.    
  177.    
  178.       
  179. //----
  180.    return(0);
  181.   }
  182. //+------------------------------------------------------------------+
复制代码

""
还没有人打赏,支持一下

评论|共 8 个

天天好心情

发表于 2020-6-5 15:03:51 | 显示全部楼层

帮你顶下哈!!

xnhib

发表于 2020-6-13 15:10:00 | 显示全部楼层

不错,支持下楼主

金融世纪

发表于 2020-6-15 19:36:23 | 显示全部楼层

不错不错,很好哦

u88y01

发表于 2020-6-26 15:05:06 | 显示全部楼层

我抢、我抢、我抢沙发~

mpfczftb

发表于 2020-7-1 11:38:50 | 显示全部楼层

小手一抖,积分到手!

neversky

发表于 2020-7-18 22:52:48 | 显示全部楼层

学习了,不错

CCCUK

发表于 2020-8-9 11:33:41 | 显示全部楼层

谢谢楼主分享

尹万俞系

发表于 2021-7-15 12:34:26 | 显示全部楼层

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

EA之家评论守则