论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:1916回复:6
草龙
注册时间2004-12-17
[MT4指标]TZ-Breaktout高低点指标
楼主发表于:2014-04-19 05:06只看该作者倒序浏览
1楼 电梯直达
电梯直达
主图指标 mt4指标类型:震荡指标 是否能用在mt4手机版上:否 是否含有未来函数:无 TZ-Breaktout高低点指标 利用指标指示出当天的高低点 //+------------------------------------------------------------------+ //| TZ-Breaktout.mq4 | //| Shimodax | //| | //+------------------------------------------------------------------+ #property copyright "Copyright Shimodax" #property link "http://www.strategybuilderfx.com/forums/showthread.php?t=15439" /* Introduction: Draw ranges for "Simple Combined Breakout System for EUR/USD and GBP/USD" thread (see http://www.strategybuilderfx.com/forums/showthread.php?t=15439) LocalTimeZone: TimeZone for which MT4 shows your local time, e.g. 1 or 2 for Europe (GMT+1 or GMT+2 (daylight savings time). Use zero for no adjustment. The MetaQuotes demo server uses GMT +2. Enjoy :-) Markus */ #property indicator_chart_window #property indicator_buffers 5 #property indicator_color1 Red #property indicator_color2 Red #property indicator_color3 LightGray #property indicator_color4 LightGray #property indicator_color5 Blue //---- extern int LocalTimeZone= 2; extern int DestTimeZone= 6; extern int PipsForEntry= 5; //---- double Zone1Upper; double Zone2Upper; double Zone1Lower; double Zone2Lower; double SignalsBuffer; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,Zone1Upper); SetIndexEmptyValue(0, 0.0); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,Zone1Lower); SetIndexEmptyValue(1, 0.0); SetIndexStyle(2,DRAW_NONE); SetIndexBuffer(2,Zone2Upper); SetIndexEmptyValue(2, 0.0); SetIndexStyle(3,DRAW_NONE); SetIndexBuffer(3,Zone2Lower); SetIndexEmptyValue(3, 0.0); SetIndexStyle(4,DRAW_ARROW); SetIndexArrow(4, 156); SetIndexBuffer(4, SignalsBuffer); return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars= IndicatorCounted(), lastbar, result; //---- if (Bars<=100) return(0); if (counted_bars>0) counted_bars--; //---- lastbar= Bars - counted_bars; //---- BreakoutRanges(0, lastbar, LocalTimeZone, DestTimeZone); return(0); } //+------------------------------------------------------------------+ //| Compute index of first/last bar of yesterday and today | //+------------------------------------------------------------------+ int BreakoutRanges(int offset, int lastbar, int tzlocal, int tzdest) { int i, j, k, tzdiff= tzlocal - tzdest, tzdiffsec= tzdiff*3600, tidxstart[2]= { 0, 0}, tidxend[2]= { 0, 0 }; double thigh[2]= { 0.0, 0.0 }, tlow[2]= { 99999.9, 99999.9 }; string tfrom[3]= { "04:00", "08:00" , /*rest of day: */ "12:00"}, tto[3]= { "08:00", "12:00", /*rest of day: */ "24:00" }, tday; bool inperiod= -1; datetime timet; // search back for the beginning of the day tday= TimeToStr(Time[lastbar]-tzdiffsec, TIME_DATE); for( ;lastbar=offset; i--) { timet= Time - tzdiffsec; // time of this bar //---- string timestr= TimeToStr(timet, TIME_MINUTES), // current time HH:MM thisday= TimeToStr(timet, TIME_DATE); // current date // for all three periods (first period, second period, rest of day) for(j= 0; j<3; j++) { if (tfrom[j]<=timestr && timestr0) { // now draw high/low back over the recently completed period for(k= tidxstart[j-1]; k>=tidxend[j-1]; k--) { if (j-1==0) { Zone1Upper[k]= thigh[j-1]; Zone1Lower[k]= tlow[j-1]; } if (j-1==1) { Zone2Upper[k]= thigh[j-1]; Zone2Lower[k]= tlow[j-1]; } } } inperiod= j; // remember current period } if (inperiod==2) // inperiod==2 (end of day) is just to check completion of zone 2 break; // for the current period find idxstart, idxend and compute high/low if (tidxstart[j]==0) { tidxstart[j]= i; tday= thisday; } tidxend[j]= i; //---- thigh[j]= MathMax(thigh[j], High); tlow[j]= MathMin(tlow[j], Low); } } // carry forward the periods for which we have definite high/lows if (inperiod>=1 && tday==thisday) { // first time period completed Zone1Upper= thigh[0] + PipsForEntry*Point; Zone1Lower= tlow[0] - PipsForEntry*Point; //---- if (inperiod>=2) { // second period completed Zone2Upper= thigh[1] + PipsForEntry*Point; Zone2Lower= tlow[1] - PipsForEntry*Point; } } else { // none yet to carry forward (zero to clear old values, e.g. from switching timeframe) Zone1Upper= 0; Zone1Lower= 0; Zone2Upper= 0; Zone2Lower= 0; } // at the beginning of a new day reset everything if (tday!="XXX" && tday!=thisday) { Print("#", i, "new day ", thisday, "/", tday); //---- tday= "XXX"; //---- inperiod= -1; //---- for(j= 0; j<2; j++) { tidxstart[j]= 0; tidxend[j]= 0; thigh[j]= 0; tlow[j]= 99999; } } } return(0); } //+------------------------------------------------------------------+Hans%20Indicator4.jpgHans%20Indicator4.jpg
TK29帖子1楼右侧xm竖版广告90-240
个性签名

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

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告
Pzxzx
注册时间2017-08-06
发表于:2017-08-09 23:44只看该作者
2楼
韬客交易社区-国内最大的外汇交易社区
我很烦
注册时间2018-02-04
发表于:2018-02-24 04:01只看该作者
3楼
我今天最想说
四海龙a
注册时间2018-02-22
PANLV
注册时间2018-02-19
addidastony
注册时间2018-03-26
发表于:2018-03-27 05:07只看该作者
7楼
不错不错....人家发帖不容易。回帖支持一下

本站免责声明:

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

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

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

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

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

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