首页 KDJ背离预警 MT4外汇指标

KDJ背离预警 MT4外汇指标

举报
开通vip

KDJ背离预警 MT4外汇指标KDJ背离预警 MT4外汇指标 #property copyright "Copyright? 2010,Sin.Petric" #property indicator_separate_window #property indicator_buffers 6 #property indicator_color1 Red #property indicator_color2 Yellow #property indicator_color3 Green #property indicator_color4 Bl...

KDJ背离预警 MT4外汇指标
KDJ背离预警 MT4外汇指标 #property copyright "Copyright? 2010,Sin.Petric" #property indicator_separate_window #property indicator_buffers 6 #property indicator_color1 Red #property indicator_color2 Yellow #property indicator_color3 Green #property indicator_color4 Black #property indicator_color5 Red #property indicator_color6 Blue #property indicator_level1 0 #property indicator_level2 20 #property indicator_level3 80 #property indicator_level4 100 #property indicator_width5 2 #property indicator_width6 2 //---- input parameters extern int nPeriod=20; extern double factor_1=0.6666666; extern double factor_2=0.3333333; //---- buffers double percentK[]; double percentD[]; double percentJ[]; double RSV[]; double UpperFr[]; double LowerFr[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //IndicatorBuffers(4); //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,percentK); SetIndexLabel(0, "%K"); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,percentD); SetIndexLabel(1, "%D"); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,percentJ); SetIndexLabel(2, "%J"); SetIndexBuffer(3,RSV); SetIndexBuffer(4, UpperFr); SetIndexBuffer(5, LowerFr); // SetIndexEmptyValue(4, 0); SetIndexEmptyValue(5, 0); // SetIndexStyle(4, DRAW_ARROW); SetIndexArrow(4, 241); // SetIndexStyle(5, DRAW_ARROW); SetIndexArrow(5, 242); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); //---- int i, k, num; double Ln, Hn, Cn; //---- i = Bars - counted_bars - 1; num = Bars - nPeriod; while(i>=0) { Cn = iClose(NULL,0,i); Ln = iClose(NULL,0,i); Hn = iClose(NULL,0,i); for(k=0; k iLow(NULL,0,i+k)) Ln = iLow(NULL,0,i+k); if (Hn < iHigh(NULL,0,i+k)) Hn = iHigh(NULL,0,i+k); } if (Hn-Ln != 0) RSV[i] = (Cn-Ln)/(Hn-Ln)*100; else RSV[i] = 50; if (i >= num) { percentK[i] = factor_1 * 50 + factor_2 * RSV[i]; percentD[i] = factor_1 * 50 + factor_2 * percentK[i]; } else { percentK[i] = factor_1 * percentK[i+1] + factor_2 * RSV[i]; percentD[i] = factor_1 * percentD[i+1] + factor_2 * percentK[i]; } percentJ[i] = 3 * percentD[i] - 2 * percentK[i]; if(percentJ[i]>percentK[i]&&percentJ[i+1]<=percentK[i+1]&&percentJ[i+1]-percentJ [i]<10) { LowerFr[i]=percentJ[i]; Alert(TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS),",",Symbol(),",周 期:",period_pros(Period()),",KDJ背离,","卖出"); } if(percentJ[i]=percentK[i+1]&&percentJ[i]-percentJ[i +1]<10) { UpperFr[i]=percentJ[i]; Alert(TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS),",",Symbol(),",周 期:",period_pros(Period()),",KDJ背离,","买入"); } i--; } return(0); } string period_pros(int per_t) { string alart_string=""; switch(per_t) { case 1:alart_string="M1";break; case 5:alart_string="M5";break; case 15:alart_string="M15";break; case 30:alart_string="M30";break; case 60:alart_string="H1";break; case 240:alart_string="H4";break; case 1440:alart_string="D1";break; case 10080:alart_string="W1";break; case 43200:alart_string="MN";break; default:break; } return(alart_string); }
本文档为【KDJ背离预警 MT4外汇指标】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_281650
暂无简介~
格式:doc
大小:20KB
软件:Word
页数:6
分类:金融/投资/证券
上传时间:2018-01-20
浏览量:194