论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:1983回复:18
草龙
注册时间2004-12-17
[MT4指标]忍者买卖点指标
楼主发表于:2014-01-23 22:33只看该作者倒序浏览
1楼 电梯直达
电梯直达
忍者买卖点附图指标 ,根据趋势来标示出趋势系统的进出点位 mt4指标类型:趋势指标 是否能用在mt4手机版上:否 mt4指标类型:震荡指标 是否能用在mt4手机版上:否 是否含有未来函数: //+------------------------------------------------------------------+ //| Nina.mq4 | //| Copyright ? 2005, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright ? 2005, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property indicator_separate_window #property indicator_buffers 5 #property indicator_color1 Brown #property indicator_color2 DeepSkyBlue #property indicator_color3 Green #property indicator_color4 Red #property indicator_color5 Blue #property indicator_minimum 0 #property indicator_maximum 1 //---- input parameters extern int PeriodWATR = 10; extern double Kwatr = 1.0000; extern int HighLow = 0; extern int cbars = 1000; extern int from = 0; //---- indicator buffers double LineMinBuffer; double LineMidBuffer; double LineBuyBuffer; double LineSellBuffer; double LineExitBuffer; double Ma50; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; IndicatorBuffers(6); SetIndexBuffer(0, LineMinBuffer); SetIndexBuffer(1, LineMidBuffer); SetIndexBuffer(2, LineBuyBuffer); SetIndexBuffer(3, LineSellBuffer); SetIndexBuffer(4, LineExitBuffer); SetIndexBuffer(5, Ma50); //---- indicator line SetIndexStyle(0, DRAW_LINE); SetIndexStyle(1, DRAW_LINE); SetIndexStyle(2, DRAW_ARROW, 0, 1); SetIndexStyle(3, DRAW_ARROW, 0, 1); SetIndexStyle(4, DRAW_ARROW, 0, 1); SetIndexStyle(5, DRAW_NONE); //---- SetIndexArrow(2, 233); SetIndexArrow(3, 234); SetIndexArrow(4, 174); //---- SetIndexEmptyValue(2, 0); SetIndexEmptyValue(3, 0); SetIndexEmptyValue(4, 0); SetIndexEmptyValue(5, 0); //---- IndicatorDigits(Digits + 1); //---- name for DataWindow and indicator subwindow label short_name="Nina(" + PeriodWATR + "," + Kwatr + "," + HighLow + ")"; IndicatorShortName(short_name); //---- SetIndexDrawBegin(0, PeriodWATR); SetIndexDrawBegin(1, PeriodWATR); //---- return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int last_ind_inv(int shift, int dir) { if(dir != 0) { for(int i = shift; i < cbars; i++) { if(dir > 0) { if(iCustom(NULL, 0, "0_IndInverse", 2, cbars, 1, i) != 0) return (i); } else if(dir < 0) { if(iCustom(NULL, 0, "0_IndInverse", 2, cbars, 2, i) != 0) return(-i); } } } //---- return (0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { int i, shift, TrendMin, TrendMax, TrendMid; double SminMin0, SmaxMin0, SminMin1, SmaxMin1, SumRange, dK, WATR0, WATRmax, WATRmin; double WATRmid; double SminMax0, SmaxMax0, SminMax1, SmaxMax1, SminMid0, SmaxMid0, SminMid1, SmaxMid1; double linemin, linemax, linemid, Stoch1, Stoch2, bsmin, bsmax; //---- int StepSizeMin, StepSizeMax, StepSizeMid; double min, max, mid, h, l, c; //---- int b = 0; int last = 0, ma = 0; //---- for(shift = cbars - 1; shift >= from; shift--) { SumRange = 0; for(i = PeriodWATR - 1; i >= from; i--) { dK = 1 + 1.0*(PeriodWATR - i) / PeriodWATR; SumRange += dK*MathAbs(High[i+shift] - Low[i+shift]); } WATR0 = SumRange / PeriodWATR; WATRmax = MathMax(WATR0, WATRmax); //---- if(shift == cbars - 1 - PeriodWATR) WATRmin = WATR0; WATRmin = MathMin(WATR0, WATRmin); StepSizeMin = MathRound(Kwatr*WATRmin / Point); StepSizeMax = MathRound(Kwatr*WATRmax / Point); StepSizeMid = MathRound(Kwatr*0.5*(WATRmax + WATRmin) / Point); min = Kwatr*WATRmin; max = Kwatr*WATRmax; mid = Kwatr*0.5*(WATRmax + WATRmin); c = Close[shift]; h = High[shift]; l = Low[shift]; //---- if(HighLow > 0) { SmaxMin0 = l + 2*min; SminMin0 = h - 2*min; SmaxMax0 = l + 2*max; SminMax0 = h - 2*max; SmaxMid0 = l + 2*mid; SminMid0 = h - 2*mid; //---- if(c > SmaxMin1) TrendMin = 1; //---- if(c < SminMin1) TrendMin = -1; //---- if(c > SmaxMax1) TrendMax = 1; //---- if(c < SminMax1) TrendMax = -1; //---- if(c > SmaxMid1) TrendMid = 1; //---- if(c < SminMid1) TrendMid = -1; } //---- if(HighLow == 0) { SmaxMin0 = c + 2*min; SminMin0 = c - 2*min; SmaxMax0 = c + 2*max; SminMax0 = c - 2*max; SmaxMid0 = c + 2*mid; SminMid0 = c - 2*mid; //---- if(c > SmaxMin1) TrendMin = 1; //---- if(c < SminMin1) TrendMin = -1; //---- if(c > SmaxMax1) TrendMax = 1; //---- if(c < SminMax1) TrendMax = -1; //---- if(c > SmaxMid1) TrendMid = 1; //---- if(c < SminMid1) TrendMid = -1; } //---- if(TrendMin > 0 && SminMin0 < SminMin1) SminMin0 = SminMin1; //---- if(TrendMin < 0 && SmaxMin0 > SmaxMin1) SmaxMin0 = SmaxMin1; //---- if(TrendMax > 0 && SminMax0 < SminMax1) SminMax0 = SminMax1; //---- if(TrendMax < 0 && SmaxMax0 > SmaxMax1) SmaxMax0 = SmaxMax1; //---- if(TrendMid > 0 && SminMid0 < SminMid1) SminMid0 = SminMid1; //---- if(TrendMid < 0 && SmaxMid0 > SmaxMid1) SmaxMid0 = SmaxMid1; //---- if(TrendMin > 0) linemin = SminMin0 + min; //---- if(TrendMin < 0) linemin = SmaxMin0 - min; //---- if(TrendMax > 0) linemax = SminMax0 + max; //---- if(TrendMax < 0) linemax = SmaxMax0 - max; //---- if(TrendMid > 0) linemid = SminMid0 + mid; //---- if(TrendMid < 0) linemid = SmaxMid0 - mid; bsmin = linemax - max; bsmax = linemax + max; if((bsmax - bsmin) != 0) { Stoch1 = (linemin - bsmin) / (bsmax - bsmin); Stoch2 = (linemid - bsmin) / (bsmax - bsmin); LineMinBuffer[shift] = Stoch1; LineMidBuffer[shift] = Stoch2; } SminMin1 = SminMin0; SmaxMin1 = SmaxMin0; SminMax1 = SminMax0; SmaxMax1 = SmaxMax0; SminMid1 = SminMid0; SmaxMid1 = SmaxMid0; //---- if((LineMinBuffer[shift] - LineMidBuffer[shift])*(LineMinBuffer[shift+1] - LineMidBuffer[shift+1]) < 0) { LineExitBuffer[shift] = LineMidBuffer[shift]; // BUY or SELL if(LineMinBuffer[shift] > LineMidBuffer[shift]) { last = shift; } else if(LineMinBuffer[shift] < LineMidBuffer[shift]) { last = -shift; } } //---- if(last != 0 && Ma50[shift+1] != 0) { if(last > 0 && ma > 0 && last_ind_inv(shift, 1) > 0) LineBuyBuffer[shift] = LineMidBuffer[shift]; else if(last < 0 && ma < 0 && last_ind_inv(shift, -1) < 0) LineSellBuffer[shift] = LineMidBuffer[shift]; } Ma50[shift] = iMA(NULL, 0, 50, 0, MODE_EMA, PRICE_MEDIAN, shift); //---- if(Ma50[shift] >= MathMax(Close[shift], Open[shift]) - 2.5*Point || Ma50[shift] <= MathMin(Close[shift], Open[shift]) + 2.5*Point) Ma50[shift] = 0; else { if(Close[shift] > Open[shift]) { ma = shift; } else if(Close[shift] < Open[shift]) { ma = -shift; } } } return(0); } //+------------------------------------------------------------------+aNina.jpgaNina.jpg
TK29帖子1楼右侧xm竖版广告90-240
个性签名

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

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告
HONGCHUN
注册时间2014-06-19
发表于:2015-06-17 10:05只看该作者
2楼
谢谢楼主,辛苦了
rimonky
注册时间2014-11-29
发表于:2015-07-01 12:17只看该作者
3楼
感谢分享
三无男人
注册时间2015-05-18
发表于:2015-07-02 01:23只看该作者
4楼
请问楼主,为什么编写出来安装后会很卡机?谢谢!
haoyio
注册时间2015-04-14
发表于:2015-07-02 10:19只看该作者
5楼
谢谢楼主分享,不买也要顶下!
远静
注册时间2015-09-07
发表于:2015-09-07 08:49只看该作者
6楼
如何使用给个解释吧
打天下
注册时间2015-07-26
jasonair
注册时间2014-06-23
gunsnw
注册时间2015-01-24
发表于:2015-10-29 09:37只看该作者
9楼
如何使用给个解释吧
尘缘在此
注册时间2016-03-13
发表于:2016-06-19 13:36只看该作者
10楼
学习学习!
个性签名

韬客社区www.talkfx.co

广告
论坛谏言--外汇交易不应是你投资的全部,交易外汇也不应是你生活的全部
风声加色
注册时间2016-05-14
发表于:2016-06-20 03:06只看该作者
11楼
很不错!
玉中幽灵
注册时间2016-03-10
yjsteed
注册时间2016-04-22
pensh
注册时间2016-07-24
发表于:2016-08-01 12:52只看该作者
14楼
多谢分享
SuperYaoYao
注册时间2016-07-23
黄金分割法
注册时间2015-03-28
杨粟程
注册时间2017-01-19
Pzxzx
注册时间2017-08-06

本站免责声明:

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

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

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

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

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

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