论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:865回复:0
草龙
注册时间2004-12-17
[MT4指标]BB_Squeeze_Advanced_v2指标
楼主发表于:2014-01-29 19:35只看该作者倒序浏览
1楼 电梯直达
电梯直达
BB_Squeeze_Advanced_v2指标 附图指标 mt4指标类型:趋势指标 是否能用在mt4手机版上:否 是否含有未来函数:无 //+-------------------------------------------------------------------------------| //| BB_Squeeze_Advanced_v2 | //| Copyright ? 2005,MetaQuotes Software Corp. author:!Scriptor or Collector!| //| ForexTSD 2007 mladen fxbs ki http://www.metaquotes.net/ | //| Cleaned up, options, additions (the usual bla,bla:) Mladen; mtf WEN formula | //+-------------------------------------------------------------------------------| #property copyright "Copyright ? MetaQuotes Software Corp." #property link "http://www.metaquotes.net/ www.ForexTSD.com 2007 Mladen" // // // // // #property indicator_separate_window #property indicator_buffers 8 #property indicator_color1 ForestGreen #property indicator_color2 Red #property indicator_color3 DarkGreen #property indicator_color4 FireBrick #property indicator_color5 DodgerBlue #property indicator_color6 SlateGray #property indicator_color7 Gray #property indicator_color8 Gold #property indicator_width1 2 #property indicator_width2 2 #property indicator_levelcolor DarkSlateGray #property indicator_levelstyle 4 // // // // // extern int TimeFrame = 0; // extern string graph = "type"; extern int graphType = 1; extern string types = "parameters"; extern int type1.linearRegresion.Period =20; extern int type2.stoch.KPeriod =14; extern int type2.stoch.DPeriod = 3; extern int type2.stoch.Slowing = 3; extern int type3.cci.Period =50; extern int type4.rsi.Period =14; extern int type5.macd.fastEMA =12; extern int type5.macd.slowEMA =26; extern int type5.macd.macdEMA = 9; extern int type6.momentum.Period =14; extern int type7.williamsPR.Period =14; extern int type8.demarker.Period =10; extern int type9.ADX.Period =14; // // // // // extern string squeeze = "parameters"; extern int Bollinger.Period = 20; extern double Bollinger.Deviation = 2.0; extern int Keltner.Period = 20; extern double Keltner.Factor = 1.5; extern string other = "parameters"; extern int BarsToCount =900; extern bool ShowLevels =true; // extern string note_TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF"; string IndicatorFileName; //------------------------ // // // // double upB; double loB; double upB2; double loB2; double histoLine; double upK; double loK; double mm; //------------------------------ // // // regression slope variables // // double SumSqrBars; double SumBars; double Num2; //---------------------------------------------------------------------------------| // | //---------------------------------------------------------------------------------| int init() { string shortName; SetIndexBuffer(0,upB); SetIndexBuffer(1,loB); SetIndexBuffer(2,upB2); SetIndexBuffer(3,loB2); SetIndexBuffer(4,mm); SetIndexBuffer(5,histoLine); SetIndexBuffer(6,upK); SetIndexBuffer(7,loK); // // // // // SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexStyle(1,DRAW_HISTOGRAM); SetIndexStyle(2,DRAW_HISTOGRAM); SetIndexStyle(3,DRAW_HISTOGRAM); SetIndexStyle(4,DRAW_NONE); SetIndexStyle(5,DRAW_LINE); SetIndexStyle(6,DRAW_ARROW); SetIndexArrow(6,159); SetIndexStyle(7,DRAW_ARROW); SetIndexArrow(7,159); // // // // // if ((graphType < 1) || (graphType > 9)) graphType = 1; switch (graphType) { case 1: SetLevels(0.004,-0.004); shortName = "linear regression slope ("+type1.linearRegresion.Period+")"; // // // constants depending axclusively on linear regression period // // SumBars = type1.linearRegresion.Period * (type1.linearRegresion.Period-1) * 0.5; SumSqrBars = type1.linearRegresion.Period * (type1.linearRegresion.Period-1) * (2 * type1.linearRegresion.Period - 1)/6; Num2 = MathPow(SumBars,2) - type1.linearRegresion.Period * SumSqrBars; break; // // // // // case 2: SetLevels(30,-30); shortName = StringConcatenate("Stochastic (",type2.stoch.KPeriod,",", type2.stoch.DPeriod,",", type2.stoch.Slowing,")"); SetIndexStyle(4,DRAW_LINE); break; case 3: SetLevels(100,-100); shortName = "CCI ("+type3.cci.Period+",CLOSE)"; break; case 4: SetLevels(20,-20); shortName = "RSI ("+type4.rsi.Period+",CLOSE)"; break; case 5: SetLevels(20,-20); shortName = "MACD ("+type5.macd.fastEMA+"," +type5.macd.slowEMA+"," +type5.macd.macdEMA+",CLOSE)"; SetIndexStyle(4,DRAW_LINE); break; case 6: SetLevels(1,-1); shortName = "Momentum ("+type6.momentum.Period+",CLOSE)"; break; case 7: SetLevels(-30,30); shortName = "Williams% ("+type7.williamsPR.Period+")"; break; case 8: SetLevels(0.20,-0.20); shortName = "Demarker ("+type8.demarker.Period+")"; break; case 9: SetLevels(20,-20); shortName = "ADX ("+type9.ADX.Period+")"; SetIndexStyle(4,DRAW_LINE); } // // // // // IndicatorFileName = WindowExpertName(); IndicatorShortName("BollingerSqueeze["+TimeFrame+"] with "+shortName); if (TimeFrame < Period()) TimeFrame = Period(); BarsToCount = MathMax(BarsToCount,150); return(0); } //---------------------------------------------------------------------------------| // | //---------------------------------------------------------------------------------| int deinit() { return(0); } //---------------------------------------------------------------------------------| // | //---------------------------------------------------------------------------------| //void SetLevels(double level1,double level2,double level3=NULL,double level4=NULL) void SetLevels(double level1,double level2) { if (ShowLevels) { SetLevelValue(1,level1); SetLevelValue(2,level2); // SetLevelValue(3,level3); // SetLevelValue(4,level4); } return; } // // // // // double CallMain(int buffNo,int shift) { double result = iCustom(NULL,TimeFrame,IndicatorFileName, 0,"", graphType,"", type1.linearRegresion.Period, type2.stoch.KPeriod, type2.stoch.DPeriod, type2.stoch.Slowing, type3.cci.Period, type4.rsi.Period, type5.macd.fastEMA, type5.macd.slowEMA, type5.macd.macdEMA, type6.momentum.Period, type7.williamsPR.Period, type8.demarker.Period, type9.ADX.Period,"", Bollinger.Period, Bollinger.Deviation, Keltner.Period, Keltner.Factor,"", BarsToCount, false, buffNo,shift); return(result); } //---------------------------------------------------------------------------------| // | //---------------------------------------------------------------------------------| int start() { int counted_bars1=IndicatorCounted(); int limit1,i1; if(counted_bars1 < 0) return(-1); limit1 = Bars-counted_bars1; if (TimeFrame != Period()) { limit1 = MathMax(limit1,TimeFrame/Period()); datetime TimeArray; ArrayCopySeries(TimeArray ,MODE_TIME ,NULL,TimeFrame); for(i1=0,int y=0; i10) limit--; limit=MathMin(Bars-limit,BarsToCount); // // // // // for (i=limit;i>=0;i--) { switch (graphType) { case 1: d=LinearRegressionSlope(type1.linearRegresion.Period,i); break; case 2: d=iStochastic(NULL,0,type2.stoch.KPeriod, type2.stoch.DPeriod, type2.stoch.Slowing,MODE_SMA,0,MODE_MAIN,i)-50; mm=iStochastic(NULL,0,type2.stoch.KPeriod, type2.stoch.DPeriod, type2.stoch.Slowing,MODE_SMA,0,MODE_SIGNAL,i)-50; break; case 3: d=iCCI(NULL,0,type3.cci.Period,PRICE_CLOSE,i); break; case 4: d=iRSI(NULL,0,type4.rsi.Period,PRICE_CLOSE,i)-50; break; case 5: d=iMACD(NULL,0, type5.macd.fastEMA, type5.macd.slowEMA, type5.macd.macdEMA,PRICE_CLOSE,MODE_MAIN,i); mm=iMACD(NULL,0,type5.macd.fastEMA, type5.macd.slowEMA, type5.macd.macdEMA,PRICE_CLOSE,MODE_SIGNAL,i); break; case 6: d=iMomentum(NULL,0,type6.momentum.Period,PRICE_CLOSE,i)-100; break; case 7: d=iWPR(NULL,0,type7.williamsPR.Period,i)+50; break; case 8: d=iDeMarker(NULL,0,type8.demarker.Period,i)-0.5; break; case 9: d=iADX(NULL,0,type9.ADX.Period,PRICE_CLOSE, MODE_PLUSDI,i) -iADX(NULL,0,type9.ADX.Period,PRICE_CLOSE, MODE_MINUSDI,i); mm=iADX(NULL,0,type9.ADX.Period,PRICE_CLOSE, MODE_MAIN,i); break; break; } // // // // // diff = iATR(NULL,0,Keltner.Period,i)*Keltner.Factor; std = iStdDev(NULL,0,Bollinger.Period,MODE_SMA,0,PRICE_CLOSE,i); bbs = Bollinger.Deviation * std / diff; // // // // // histoLine=d; if(bbs<1) { upK=0; loK=EMPTY_VALUE; upB=EMPTY_VALUE; loB=EMPTY_VALUE; if (d > 0) { upB2=d; loB2=EMPTY_VALUE; } else { loB2=d; upB2=EMPTY_VALUE; } } else { loK =0; upK =EMPTY_VALUE; upB2=EMPTY_VALUE; loB2=EMPTY_VALUE; if (d > 0) { upB=d; loB=EMPTY_VALUE; } else { loB=d; upB=EMPTY_VALUE; } } } return(0); } //---------------------------------------------------------------------------------| // | //---------------------------------------------------------------------------------| double LinearRegressionSlope(int Len,int shift) { double LinearRegSlope; double SumY = 0; double Sum1 = 0; double Num1; int i; // // // // // for (i=0; iBB_Squeeze_Advanced_v2.jpg
TK29帖子1楼右侧xm竖版广告90-240
个性签名

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

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告

本站免责声明:

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

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

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

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

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

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