外汇论坛 外兔财经

开启左侧

请教懂mt4技术指标程序的高手,关于改指标的颜色.非常感激!

[复制链接]
发表于 2006-2-5 19:02 | 显示全部楼层 |阅读模式
https://www.y2cn.com
先谢谢!
下面是mt4的一个指标"t3"它只能输出固定的红色线条,我如用两条,都只能是红色,改了也不行.请教怎么修改一下程序,能是两条是两种颜色.谢谢!!!!


//+------------------------------------------------------------------+
//| T3.mq4 |
//| MojoFX |
//| http://groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/ |
//+------------------------------------------------------------------+
#property copyright "MojoFX - Conversion only"
#property link "http://groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red

extern int MA_Period = 14;
extern double b = 0.7;


double MapBuffer[];

double e1[],e2[],e3[],e4[],e5[],e6[];
double c1,c2,c3,c4;
double n,w1,w2,b2,b3;

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators setting
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,Red);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
IndicatorShortName("T3"+MA_Period);
SetIndexDrawBegin(0,100);
SetIndexBuffer(0,MapBuffer);



//---- variable reset
//e2=0; e3=0; e4=0; e5=0; e6=0;
c1=0; c2=0; c3=0; c4=0;
n=0;
w1=0; w2=0;
b2=0; b3=0;

b2=b*b;
b3=b2*b;
c1=-b3;
c2=(3*(b2+b3));
c3=-3*(2*b2+b+b3);
c4=(1+3*b+b3+3*b2);
n=MA_Period;

if (n<1) n=1;
n = 1 + 0.5*(n-1);
w1 = 2 / (n + 1);
w2 = 1 - w1;

//----
return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
if (counted_bars<0) return (-1);
if (counted_bars>0) counted_bars--;
limit=(Bars-counted_bars)-1;

//---- indicator calculation
ArrayResize(e1, Bars+1);
ArrayResize(e2, Bars+1);
ArrayResize(e3, Bars+1);
ArrayResize(e4, Bars+1);
ArrayResize(e5, Bars+1);
ArrayResize(e6, Bars+1);

for(int i=limit; i>=0; i--)
{
e1[Bars-i] = w1*Close + w2*e1[(Bars-i)-1];
e2[Bars-i] = w1*e1[Bars-i] + w2*e2[(Bars-i)-1];
e3[Bars-i] = w1*e2[Bars-i] + w2*e3[(Bars-i)-1];
e4[Bars-i] = w1*e3[Bars-i] + w2*e4[(Bars-i)-1];
e5[Bars-i] = w1*e4[Bars-i] + w2*e5[(Bars-i)-1];
e6[Bars-i] = w1*e5[Bars-i] + w2*e6[(Bars-i)-1];
//Print ("I- ",i, "Bars-I ",Bars-i);
MapBuffer=c1*e6[Bars-i] + c2*e5[Bars-i] + c3*e4[Bars-i] + c4*e3[Bars-i];
}
//----
return(0);
}
//+------------------------------------------------------------------+
 楼主| 发表于 2006-2-5 20:47 | 显示全部楼层
高手啊,
 楼主| 发表于 2006-2-6 10:06 | 显示全部楼层
没人会吗?????
发表于 2006-2-7 00:57 | 显示全部楼层
有必要这么改吗?直接在PROPERTIES里改啊
发表于 2006-2-7 01:02 | 显示全部楼层
你直接指到它右击鼠标,弹出属性对话框就可以改参数了
 楼主| 发表于 2006-2-7 09:56 | 显示全部楼层
原帖由 grunge 于 2006-2-7 01:02 发表
你直接指到它右击鼠标,弹出属性对话框就可以改参数了


谢谢.其他指标是可以这样改.但这个不行,改完一刷新又变成原样,不信你是是.
 楼主| 发表于 2006-2-7 09:57 | 显示全部楼层
急呀,.........................
发表于 2006-2-7 16:49 | 显示全部楼层
设置成模板就不会变色了。TEMPLATE

这个指标很重要吗?
 楼主| 发表于 2006-2-8 08:22 | 显示全部楼层
原帖由 grunge 于 2006-2-7 16:49 发表
设置成模板就不会变色了。TEMPLATE

这个指标很重要吗?


不行呀,我是要用两个"t3",颜色一样分不清呀.
很重要的,抱墙.
谢谢你.

急............
发表于 2006-2-8 20:20 | 显示全部楼层
请复制“#property indicator_color1 Red”,然后改为“#property indicator_color2 Green",
然后将”#property indicator_buffers 1“改为”“#property indicator_buffers 2”,
请试试,我也是猜得。

本版积分规则

QQ|手机版 Mobile Version|Archiver|关于我们 About Us|联系我们 Contact Us|Y2外汇论坛 外兔财经

GMT+8, 2025-5-3 09:51 , Processed in 0.043953 second(s), 25 queries .

Powered by Discuz! X7.2

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表