论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:4478回复:15
Zukunft
注册时间2005-05-12
[MT4指标]发个mt4的指标,看看各时段的趋势
楼主发表于:2006-11-13 02:37只看该作者倒序浏览
1楼 电梯直达
电梯直达
//+------------------------------------------------------------------+ //| TTM-Trend-Map.mq4 | //| Tamir Bleicher, +972-54-4941653 | //| | //+------------------------------------------------------------------+ #property copyright "Tamir Bleicher, +972-54-4941653" #property link "" //-- This indicator will show a "Map" of the trends at different time frames on the currencies of your choice, according to the TTM-Trend indicator. //-- You should have the TTM-Trend indicator in your indicator's folder for this indicator to work. #property indicator_separate_window #property indicator_minimum 0 #property indicator_maximum 100 #property indicator_buffers 1 #property indicator_color1 Red //---- input parameters extern int CompBars=6;//- Do not change. This is the same parameter as in the TTM-Trend indicator. extern string SymbolSuffix="";//- If your broker names the currency pairs with a suffix for a mini account (like an "m", for example), enter the suffix here. extern string PairsList="GBPUSD,EURUSD,USDCHF,USDJPY";//- This is where you add the currency pairs you want to track. Add each one of them separated by a coma. extern string MainCurrency="";//- If you want to see only pairs where the USD (or any other currency) appears just enter here USD (or the currency of your choice) and it will show all USD (or the currency you chose) pairs. extern bool Invert=false;//- If you chose to show all USD pairs and you want to show them with the USD as the first currency, change this setting to "true". extern color UpTrendColor=Green; extern color DownTrendColor=Red; extern color NoTrendColor=Yellow; extern bool MN=true;//- Change to "false" if you don't want to show this time frame. extern bool W1=true;//- Change to "false" if you don't want to show this time frame. extern bool D1=true;//- Change to "false" if you don't want to show this time frame. extern bool H4=true;//- Change to "false" if you don't want to show this time frame. extern bool H1=true;//- Change to "false" if you don't want to show this time frame. extern bool M30=true;//- Change to "false" if you don't want to show this time frame. extern bool M15=true;//- Change to "false" if you don't want to show this time frame. extern bool M5=true;//- Change to "false" if you don't want to show this time frame. extern bool M1=true;//- Change to "false" if you don't want to show this time frame. //---- buffers double ExtMapBuffer1; string Pair[20]; int SymNo; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { int i,j,k; string Cur; bool AllCur; //---- indicators SetIndexStyle(0,DRAW_SECTION); SetIndexBuffer(0,ExtMapBuffer1); SetIndexEmptyValue(0,0.0); AllCur=(StringFind(PairsList,MainCurrency,0)==-1); for (i=0; i<20; i++) Pair=""; for (i=0, j=0, k=1; i<20 && k>0; ) { k=StringFind(PairsList,",",j); if (k==0) Cur=StringSubstr(PairsList,j,0); else Cur=StringSubstr(PairsList,j,k-j); if (AllCur || StringFind(Cur,MainCurrency,0)>-1) { Pair=Cur; i++; } j=StringFind(PairsList,",",j)+1; if (j==0) break; } SymNo=i; //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } int trend(string sym,int per) { int t1=(iCustom(sym,per,"ttm-trend",CompBars,4,1)); int t2=(iCustom(sym,per,"ttm-trend",CompBars,4,2)); if (t1==1 && t2==1) return (1); if (t1==-1 && t2==-1) return (-1); else return (0); } void output_arrow(string label, string sym,int bar, double price, int per, string per_name, bool invert, bool create) { datetime time = Time[bar]; string sym1; if (invert && StringSubstr(sym,3,3)==MainCurrency) sym1=StringSubstr(sym,3,3)+StringSubstr(sym,0,3)+SymbolSuffix; else { sym1=sym; invert=false; } if (sym=="Title") { ObjectDelete(label+per_name); if (create) { ObjectCreate(label+per_name,OBJ_TEXT,1,time,price); ObjectSetText(label+per_name,per_name); ObjectSet(label+per_name,OBJPROP_COLOR,White); ObjectSet(label+per_name,OBJPROP_WIDTH,2); } } else if (per==0) { ObjectDelete(label); if (create) { ObjectCreate(label,OBJ_TEXT,1,time,price); ObjectSetText(label,sym1); ObjectSet(label+per_name,OBJPROP_COLOR,White); ObjectSet(label+per_name,OBJPROP_WIDTH,2); } } else { ObjectDelete(label+per_name); if (create) { int t=trend(sym,per); if (invert) t=-t; if (t==1) { ObjectCreate(label+per_name,OBJ_ARROW,1,time,price); ObjectSet(label+per_name,OBJPROP_COLOR,UpTrendColor); ObjectSet(label+per_name,OBJPROP_ARROWCODE,225); ObjectSet(label+per_name,OBJPROP_WIDTH,2); } else if (t==-1) { ObjectCreate(label+per_name,OBJ_ARROW,1,time,price); ObjectSet(label+per_name,OBJPROP_COLOR,DownTrendColor); ObjectSet(label+per_name,OBJPROP_ARROWCODE,226); ObjectSet(label+per_name,OBJPROP_WIDTH,2); } else { ObjectCreate(label+per_name,OBJ_ARROW,1,time,price); ObjectSet(label+per_name,OBJPROP_COLOR,NoTrendColor); ObjectSet(label+per_name,OBJPROP_ARROWCODE,104); ObjectSet(label+per_name,OBJPROP_WIDTH,2); } } } } void output_line(string label, string sym,double price, bool invert, bool create) { int n=MN+W1+M1+D1+H4+H1+M30+M15+M1; int br=MathRound(BarsPerWindow()/12); int D=MN+W1+D1; int H=D+H4+H1; output_arrow(label,sym,MathRound(br*10.5),price,0,"",invert,create); output_arrow(label,sym,br*9,price,PERIOD_MN1,"MN",invert,create&&MN); output_arrow(label,sym,br*(9-MN),price,PERIOD_W1,"W1",invert,create&&W1); output_arrow(label,sym,br*(9-MN-W1),price,PERIOD_D1,"D1",invert,create&&D1); output_arrow(label,sym,br*(9-D),price,PERIOD_H4,"H4",invert,create&&H4); output_arrow(label,sym,br*(9-D-H4),price,PERIOD_H1,"H1",invert,create&&H1); output_arrow(label,sym,br*(9-H),price,PERIOD_M30,"M30",invert,create&&M30); output_arrow(label,sym,br*(9-H-M30),price,PERIOD_M15,"M15",invert,create&&M15); output_arrow(label,sym,br*(9-H-M30-M15),price,PERIOD_M5,"M5",invert,create&&M5); output_arrow(label,sym,br*(9-H-M30-M15-M1),price,PERIOD_M1,"M1",invert,create&&M1); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { bool invert; double space=(95-5)/SymNo; if (space>10) space=10; output_line("Title","Title",95,false,true); for (int i=0; i<20; i++) { output_line(DoubleToStr(i,0),Pair+SymbolSuffix,95-space*(i+1),Invert,i1.gif
TK29帖子1楼右侧xm竖版广告90-240
个性签名

韬客社区www.talkfx.co

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告
影子
注册时间2006-07-18
peterdk
注册时间2006-10-31
TL
注册时间2005-11-22
发表于:2006-11-13 02:48只看该作者
4楼
不懂得如何看,不过还是谢谢emoji-imageemoji-imageemoji-image
rosediamondonly
注册时间2006-01-27
发表于:2006-11-13 03:24只看该作者
5楼
晕....
个性签名

亏损不过夜,赢利留八天,随波逐流,零点进出.

tokenny
注册时间2006-07-04
发表于:2006-11-13 03:34只看该作者
6楼
介绍一下吧..怎么看的.
长天飞沙
注册时间2005-04-26
发表于:2006-11-13 03:35只看该作者
7楼
我也想问,该指标是用什么来确定趋势的?
TATA
注册时间2005-08-16
发表于:2006-11-13 06:29只看该作者
8楼
没看懂
完美使者
注册时间2006-02-15
阿牛哥哥
注册时间2006-10-06
发表于:2006-11-13 06:36只看该作者
10楼
顶楼主的辛勤劳动!
chenx1999
注册时间2006-09-05
发表于:2006-11-13 06:40只看该作者
11楼
LZ这个是什么图?
寒雨
注册时间2004-05-01
发表于:2006-11-13 06:42只看该作者
12楼
编辑高手
liujiqi
注册时间2006-09-20
1cf2
注册时间2005-02-08
发表于:2006-11-13 09:27只看该作者
15楼
我用编辑器新建了一个指标,然后把Lz的code粘贴进去,编译通过了。但是返回Terminal调入指标。没有显示,指标窗口什么都没有. Y?
个性签名

放眼望去,有几个人能看出地球是圆的?

1cf2
注册时间2005-02-08
发表于:2006-11-13 09:33只看该作者
16楼
现在可以了,但是看不到箭头,都是波折线

本站免责声明:

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

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

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

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

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

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