论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:1291回复:1
草龙
注册时间2004-12-17
[MT4指标]Currency heat map指标
楼主发表于:2014-04-17 12:16只看该作者倒序浏览
1楼 电梯直达
电梯直达
附图指标,在附图上显示出货币的强弱情况,以整体判断汇市的可操作货币 mt4指标类型:趋势指标 是否能用在mt4手机版上:否 是否含有未来函数:无 //+------------------------------------------------------------------+ //| Currency heat map.mq4 | //| mladen | //+------------------------------------------------------------------+ #property copyright \"mladen\" #property link \"[email protected]\" #property indicator_separate_window #property indicator_minimum 0 #property indicator_maximum 1 // // // // // extern string Currencies = \"USD;EUR;GBP;JPY;CHF;CAD;AUD;NZD\"; extern string TimeFrames = \"H4;D1\"; extern color StrongUp = LimeGreen; extern color WeakUp = Green; extern color NoMove = DimGray; extern color WeakDown = FireBrick; extern color StrongDown = Red; extern color DoesNotExist = Black; extern bool UseMSLineDrawFont = false; // // // // // string shortName; int shortLength; int window; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ // // // // // int cpairsLen; int ctimesLen; string cpairs; int aTimes; string addition = \"\"; string FontToUse = \"Terminal\"; // // // // // int init() { if (UseMSLineDrawFont) FontToUse = \"MS LIneDraw\"; Currencies = StringUpperCase(StringTrimLeft(StringTrimRight(Currencies))); if (StringSubstr(Currencies,StringLen(Currencies),1) != \";\") Currencies = StringConcatenate(Currencies,\";\"); // // // // // int s = 0; int i = StringFind(Currencies,\";\",s); string current; while (i > 0) { current = StringSubstr(Currencies,s,i-s); ArrayResize(cpairs,ArraySize(cpairs)+1); cpairs[ArraySize(cpairs)-1] = current; s = i + 1; i = StringFind(Currencies,\";\",s); } cpairsLen = ArraySize(cpairs); // // // // // TimeFrames = StringUpperCase(StringTrimLeft(StringTrimRight(TimeFrames))); if (StringSubstr(TimeFrames,StringLen(TimeFrames),1) != \";\") TimeFrames = StringConcatenate(TimeFrames,\";\"); // // // // // s = 0; i = StringFind(TimeFrames,\";\",s); int time; while (i > 0) { current = StringSubstr(TimeFrames,s,i-s); time = stringToTimeFrame(current); if (time > 0) { ArrayResize(aTimes,ArraySize(aTimes)+1); aTimes[ArraySize(aTimes)-1] = time; } s = i + 1; i = StringFind(TimeFrames,\";\",s); } ctimesLen = ArraySize(aTimes); // // // // // if (IsMini()) addition=\"m\"; shortName = MakeUniqueName(\"CHM \",\"\"); shortLength = StringLen(shortName); IndicatorShortName(shortName); return(0); } // // // // // int deinit() { clearObjects(); return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ // // // // // int start() { string name; int gaph = (cpairsLen*66+10); int gapv = (cpairsLen*15+20); int i,k,t; window = WindowFind(shortName); // // // // // for (t = 0; t < ctimesLen; t++ ) { name = shortName+\"t\"+t+i; if (ObjectFind(name) == -1) ObjectCreate(name,OBJ_LABEL,window,0,0,0,0); ObjectSet(name,OBJPROP_XDISTANCE,5 +(t%2)*30); ObjectSet(name,OBJPROP_YDISTANCE,20+(t/2)*15); ObjectSetText(name,TimeFrameToString(aTimes[t]),10,\"Arial Bold\"); // // // // // for (i = 0; i < cpairsLen; i++) { name = shortName+\"h\"+t+i; if (ObjectFind(name) == -1) ObjectCreate(name,OBJ_LABEL,window,0,0,0,0); ObjectSet(name,OBJPROP_XDISTANCE,i*66+120+gaph*(t%2)); ObjectSet(name,OBJPROP_YDISTANCE, 1+gapv*(t/2)); ObjectSetText(name,cpairs,10,\"Arial Bold\"); if ((t%2)>0) continue; name = shortName+\"v\"+t+i; if (ObjectFind(name) == -1) ObjectCreate(name,OBJ_LABEL,window,0,0,0,0); ObjectSet(name,OBJPROP_XDISTANCE, 65); ObjectSet(name,OBJPROP_YDISTANCE,i*15+20+gapv*(t/2)); ObjectSetText(name,cpairs,10,\"Arial Bold\"); } } // // // // // for (t = 0; t < ctimesLen; t++) for (i = 0; i < cpairsLen; i++) for (k = i+1; k < cpairsLen; k++) { string symbol = cpairs+cpairs[k]+addition; double price = iClose(symbol,aTimes[t],0); bool normal = true; bool exist = true; if (price == 0) { symbol = cpairs[k]+cpairs+addition; price = iClose(symbol,aTimes[t],0); normal = false; } if (price == 0) exist = false; double close = iClose(symbol,aTimes[t],1); double high = iHigh(symbol,aTimes[t],1); double low = iLow(symbol,aTimes[t],1); // // // // // for (int l=0; l<2; l++) { color theColor = DoesNotExist; if (exist) { if (!normal) while (true) { if (price > high) { theColor = StrongUp; break; } if (price > close) { theColor = WeakUp; break; } if (price== close) { theColor = NoMove; break; } if (price < low) { theColor = StrongDown; break; } theColor = WeakDown; break; } else while (true) { if (price > high) { theColor = StrongDown; break; } if (price > close) { theColor = WeakDown; break; } if (price== close) { theColor = NoMove; break; } if (price < low) { theColor = StrongUp; break; } theColor = WeakUp; break; } } // // // // // name = shortName+t+k+i; if (ObjectFind(name) == -1) ObjectCreate(name,OBJ_LABEL,window,0,0,0,0); ObjectSet(name,OBJPROP_XDISTANCE,i*66+100+gaph*(t%2)); ObjectSet(name,OBJPROP_YDISTANCE,k*15+ 20+gapv*(t/2)); ObjectSetText(name,\"圹圹圹圹\",10,FontToUse,theColor); int tmp = k; k = i; i = tmp; normal = (!normal); } } return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ // // // // // bool IsMini() { return(StringFind(Symbol(),\"m\") > -1); } string MakeUniqueName(string first, string rest) { string result = first+(MathRand()%1001)+rest; while (WindowFind(result)> 0) result = first+(MathRand()%1001)+rest; return(result); } // // // // // void clearObjects() { for (int i = ObjectsTotal(); i>=0; i--) { string name = ObjectName(i); if (StringSubstr(name,0,shortLength) == shortName) ObjectDelete(name); } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ // // // // // int stringToTimeFrame(string tfs) { int tf=0; tfs = StringTrimLeft(StringTrimRight(StringUpperCase(tfs))); if (tfs==\"M1\" || tfs==\"1\") tf=PERIOD_M1; if (tfs==\"M5\" || tfs==\"5\") tf=PERIOD_M5; if (tfs==\"M15\"|| tfs==\"15\") tf=PERIOD_M15; if (tfs==\"M30\"|| tfs==\"30\") tf=PERIOD_M30; if (tfs==\"H1\" || tfs==\"60\") tf=PERIOD_H1; if (tfs==\"H4\" || tfs==\"240\") tf=PERIOD_H4; if (tfs==\"D1\" || tfs==\"1440\") tf=PERIOD_D1; if (tfs==\"W1\" || tfs==\"10080\") tf=PERIOD_W1; if (tfs==\"MN\" || tfs==\"43200\") tf=PERIOD_MN1; return(tf); } string TimeFrameToString(int tf) { string tfs; switch(tf) { case PERIOD_M1: tfs=\"M1\" ; break; case PERIOD_M5: tfs=\"M5\" ; break; case PERIOD_M15: tfs=\"M15\" ; break; case PERIOD_M30: tfs=\"M30\" ; break; case PERIOD_H1: tfs=\"H1\" ; break; case PERIOD_H4: tfs=\"H4\" ; break; case PERIOD_D1: tfs=\"D1\" ; break; case PERIOD_W1: tfs=\"W1\" ; break; case PERIOD_MN1: tfs=\"MN\"; } return(tfs); } // // // // // string StringUpperCase(string str) { string s = str; int lenght = StringLen(str) - 1; int char; while(lenght >= 0) { char = StringGetChar(s, lenght); // // // // // if((char > 96 && char < 123) || (char > 223 && char < 256)) s = StringSetChar(s, lenght, char - 32); else if(char > -33 && char < 0) s = StringSetChar(s, lenght, char + 224); lenght--; } return(s); }
TK29帖子1楼右侧xm竖版广告90-240
个性签名

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

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告
Pzxzx
注册时间2017-08-06
发表于:2017-08-09 23:44只看该作者
2楼
韬客交易社区-国内最大的外汇交易社区

本站免责声明:

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

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

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

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

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

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