论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:2417回复:14
草龙
注册时间2004-12-17
[MT4指标]COGMACD指标
楼主发表于:2014-02-27 04:26只看该作者倒序浏览
1楼 电梯直达
电梯直达
副图指标, mt4指标类型:趋势指标 是否能用在mt4手机版上:否 是否含有未来函数:无 //+------------------------------------------------------------------+ //| COGMACD.mq4 | //| Original Code from [email protected] | //| Linuxser 2007 for TSD http://www.forex-tsd.com/ | //| Mod by Brooky @ Brooky-Indicators.com | //+------------------------------------------------------------------+ #property copyright "[email protected]" //---------ang_pr (Din)-------------------- #property indicator_separate_window #property indicator_buffers 8 #property indicator_color1 RoyalBlue #property indicator_color2 Red #property indicator_color3 Green #property indicator_color4 Orange #property indicator_color5 LimeGreen #property indicator_color6 Olive #property indicator_color7 DarkBlue #property indicator_color8 Tomato #property indicator_level1 0 #property indicator_levelstyle 0 #property indicator_levelcolor DimGray #property indicator_width1 2 #property indicator_width2 2 #property indicator_width3 2 #property indicator_width4 1 #property indicator_width5 1 #property indicator_width6 2 #property indicator_width7 2 #property indicator_width8 2 #property indicator_style1 0 #property indicator_style2 0 #property indicator_style3 0 #property indicator_style4 2 #property indicator_style5 2 #property indicator_style6 0 #property indicator_style7 0 #property indicator_style8 0 //----------------------------------- extern int bars_back = 240; extern int fma = 12; extern int sma = 26; extern int sigma = 9; extern double fib.band = 0.618; extern int m = 3; extern int i = 0; extern double kstd = 3.618; //----------------------- double fx, sqh, sql, stdh, stdl, stochdata,stochdata2, stochsdata; double ai[10,10], b[10], x[10], sx[20]; double sum; int ip, p, n, f; double qq, mm, tt; int ii, jj, kk, ll, nn; double sq, std; //******************************************* int init() { IndicatorShortName("COGMACD: Mod by Brooky-Indicators.com"); SetIndexBuffer(0, fx);SetIndexStyle(0, DRAW_LINE); SetIndexBuffer(1, sqh); SetIndexBuffer(2, sql); SetIndexBuffer(3, stdh); SetIndexBuffer(4, stdl); SetIndexBuffer(5, stochdata);SetIndexStyle(5, DRAW_HISTOGRAM); SetIndexBuffer(6, stochsdata);SetIndexStyle(6, DRAW_LINE); SetIndexBuffer(7, stochdata2);SetIndexStyle(7, DRAW_HISTOGRAM); p = MathRound(bars_back); nn = m + 1; return(0); } //---------------------------------------------------------- int deinit() { } //********************************************************************************************** int start() { int mi; //------------------------------------------------------------------------------------------- p = bars_back; sx[1] = p + 1; SetIndexDrawBegin(0, Bars - p - 1); SetIndexDrawBegin(1, Bars - p - 1); SetIndexDrawBegin(2, Bars - p - 1); SetIndexDrawBegin(3, Bars - p - 1); SetIndexDrawBegin(4, Bars - p - 1); //----------------------sx------------------------------------------------------------------- int rlimit; int rcounted_bars=IndicatorCounted(); //---- check for possible errors if(rcounted_bars<0) return(-1); //---- the last counted bar will be recounted if(rcounted_bars>0) rcounted_bars--; rlimit=Bars-rcounted_bars; //---- main loop for(int ri=0; ri0)stochdata[ri]= iMACD(NULL,0,fma,sma,sigma,PRICE_CLOSE,MODE_MAIN,ri); else stochdata2[ri]= iMACD(NULL,0,fma,sma,sigma,PRICE_CLOSE,MODE_MAIN,ri); stochdata[ri]= iMACD(NULL,0,fma,sma,sigma,PRICE_CLOSE,MODE_MAIN,ri);//iStochastic(NULL,0,fma,sma,sigma,MODE_SMA,0,MODE_MAIN,ri); stochsdata[ri]= iMACD(NULL,0,fma,sma,sigma,PRICE_CLOSE,MODE_SIGNAL,ri);//iStochastic(NULL,0,fma,sma,sigma,MODE_SMA,0,MODE_SIGNAL,ri); } for(mi = 1; mi <= nn * 2 - 2; mi++) { sum = 0; for(n = i; n <= i + p; n++) { sum += MathPow(n, mi); } sx[mi + 1] = sum; } //----------------------syx----------- for(mi = 1; mi <= nn; mi++) { sum = 0.00000; for(n = i; n <= i + p; n++) { if(mi == 1) sum += ((iMACD(NULL,0,fma,sma,sigma,PRICE_CLOSE,MODE_MAIN,n)+iMACD(NULL,0,fma,sma,sigma,PRICE_CLOSE,MODE_SIGNAL,n))+0.0000001)/2;//rsi_period iRSI(NULL,0,rsi_period,prICE_CLOSE,n) else sum += (((iMACD(NULL,0,fma,sma,sigma,PRICE_CLOSE,MODE_MAIN,n)+iMACD(NULL,0,fma,sma,sigma,PRICE_CLOSE,MODE_SIGNAL,n))+0.0000001)/2) * MathPow(n, mi - 1); } b[mi] = sum; } //===============Matrix======================================================================================================= for(jj = 1; jj <= nn; jj++) { for(ii = 1; ii <= nn; ii++) { kk = ii + jj - 1; ai[ii, jj] = sx[kk]; } } //===============Gauss======================================================================================================== for(kk = 1; kk <= nn - 1; kk++) { ll = 0; mm = 0; for(ii = kk; ii <= nn; ii++) { if(MathAbs(ai[ii, kk]) > mm) { mm = MathAbs(ai[ii, kk]); ll = ii; } } if(ll == 0) return(0); if(ll != kk) { for(jj = 1; jj <= nn; jj++) { tt = ai[kk, jj]; ai[kk, jj] = ai[ll, jj]; ai[ll, jj] = tt; } tt = b[kk]; b[kk] = b[ll]; b[ll] = tt; } for(ii = kk + 1; ii <= nn; ii++) { qq = ai[ii, kk] / ai[kk, kk]; for(jj = 1; jj <= nn; jj++) { if(jj == kk) ai[ii, jj] = 0; else ai[ii, jj] = ai[ii, jj] - qq * ai[kk, jj]; } b[ii] = b[ii] - qq * b[kk]; } } x[nn] = b[nn] / ai[nn, nn]; for(ii = nn - 1; ii >= 1; ii--) { tt = 0; for(jj = 1; jj <= nn - ii; jj++) { tt = tt + ai[ii, ii + jj] * x[ii + jj]; x[ii] = (1 / ai[ii, ii]) * (b[ii] - tt); } } //=========================================================================================================================== for(n = i; n <= i + p; n++) { sum = 0; for(kk = 1; kk <= m; kk++) { sum += x[kk + 1] * MathPow(n, kk); } fx[n] = x[1] + sum; } //-----------------------------------Std----------------------------------------------------------------------------------- sq = 0.0; for(n = i; n <= i + p; n++) { sq += MathPow((((iMACD(NULL,0,fma,sma,sigma,PRICE_CLOSE,MODE_MAIN,n)+iMACD(NULL,0,fma,sma,sigma,PRICE_CLOSE,MODE_SIGNAL,n))+0.0000001)/2) - fx[n], 2); } sq = MathSqrt(sq / (p + 1)) * kstd; std = iStdDevOnArray(stochdata,0,p,0,MODE_SMA,i) * kstd; for(n = i; n <= i + p; n++) { sqh[n] = fx[n] + sq; sql[n] = fx[n] - sq; stdh[n] = fx[n] + (fib.band*std); stdl[n] = fx[n] - (fib.band*std); } //------------------------------------------------------------------------------- //ObjectMove("sstart" + sName, 0, Time, fx); //---------------------------------------------------------------------------------------------------------------------------- return(0); } //========================================================================================================================== COGMACD.jpgCOGMACD.jpg
TK29帖子1楼右侧xm竖版广告90-240
个性签名

阅尽天下指标
搬砖开始,始于2014

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告
HONGCHUN
注册时间2014-06-19
发表于:2015-06-22 00:41只看该作者
2楼
非常感谢楼主!
liujiqi
注册时间2006-09-20
goodday
注册时间2016-12-06
hackbos
注册时间2017-06-15
Pzxzx
注册时间2017-08-06
发表于:2017-08-07 05:59只看该作者
7楼
谢谢分享~~~~~~~~~~~
zmlyai
注册时间2017-10-03
发表于:2017-10-04 11:31只看该作者
8楼
谢谢分享
PANLV
注册时间2018-02-19
发表于:2018-02-23 11:36只看该作者
9楼
感谢分享感谢分享
PANLV
注册时间2018-02-19
发表于:2018-02-23 13:59只看该作者
10楼
外汇交易不应是你投资的全部,交易外汇也不应是你生活的全部
Takyau
注册时间2018-04-14
发表于:2018-07-29 00:03来自移动端只看该作者
12楼
Cccccccccccccccc
mikeroy
注册时间2018-11-18
chenyinghao
注册时间2018-07-09
发表于:2019-01-11 05:05只看该作者
14楼
谢谢分享
个性签名

韬客社区www.talkfx.co

广告
论坛谏言--外汇交易不应是你投资的全部,交易外汇也不应是你生活的全部
好好学习双江
注册时间2013-10-06
发表于:2019-01-11 22:52来自移动端只看该作者
15楼
感谢楼主!

本站免责声明:

1、本站所有广告及宣传信息均与韬客无关,如需投资请依法自行决定是否投资、斟酌资金安全及交易亏损风险;

2、韬客是独立的、仅为投资者提供交流的平台,网友发布信息不代表韬客的观点与意思表示,所有因网友发布的信息而造成的任何法律后果、风险与责任,均与韬客无关;

3、金融交易存在极高法律风险,未必适合所有投资者,请不要轻信任何高额投资收益的诱导而贸然投资;投资保证金交易导致的损失可能超过您投入的资金和预期。请您考虑自身的投资经验及风险承担能力,进行合法、理性投资;

4、所有投资者的交易帐户应仅限本人使用,不应交由第三方操作,对于任何接受第三方喊单、操盘、理财等操作的投资和交易,由此导致的任何风险、亏损及责任由投资者个人自行承担;

5、韬客不隶属于任何券商平台,亦不受任何第三方控制,韬客不邀约客户投资任何保证金交易,不接触亦不涉及投资者的任何资金及账户信息,不代理任何交易操盘行为,不向客户推荐任何券商平台,亦不存在其他任何推荐行为。投资者应自行选择券商平台,券商平台的任何行为均与韬客无关。投资者注册及使用韬客即表示其接受和认可上述声明,并自行承担法律风险。

版权所有:韬客外汇论坛 www.talkfx.com 联络我们:[email protected]