[MT4指标]帮忙把这个指标改成 MT4的
俺编程只有半桶水,MT3是用原有公式修改的,但现在MT4没有适合的可以改。
那位好心人帮帮俺。
Inputs : TIME_Period(10), MA_Period(4), SignalMAPeriod(4); 
Variables : shift(0), loopbegin1(0), loopbegin2(0),loopbegin3(0), loopbegin4(0), first(True), prevbars(0), cnt(0), sum(0); 
Variables : FastMA(0), SlowMA(0); 
SetLoopCount(0); 
If Bars < prevbars Or Bars-prevbars>1 Then first = True; 
prevbars = Bars; 
// loopbegin1 and loopbegin2 prevent couning of counted bars exclude current 
If first Then Begin 
loopbegin1 = Bars-MA_Period-1; 
If loopbegin1 < 0 Then Exit; // not enough bars for counting 
loopbegin2 = Bars-MA_Period-SignalMAPeriod-2; 
If loopbegin2 < 0 Then Exit; // not enough bars for counting 
loopbegin3 = Bars-MA_Period-SignalMAPeriod-3; 
If loopbegin3 < 0 Then Exit; // not enough bars for counting 
loopbegin4 = Bars-MA_Period-SignalMAPeriod-4; 
If loopbegin4 < 0 Then Exit; // not enough bars for counting 
first = False; // this block is to be evaluated once only 
End; 
// convergence-divergence 
loopbegin1 = loopbegin1+1; // current bar is to be recounted too 
For shift = loopbegin1 Downto 0 Begin 
FastMA = iADX(TIME_Period,MODE_MINUSDI,shift);
SetIndexValue(shift,FastMA); 
loopbegin1 = loopbegin1-1; // prevent to previous bars recounting 
End; 
// signal line
loopbegin2 = loopbegin2+1;            // current bar is to be recounted too
For shift = loopbegin2 Downto 0 Begin
	sum = 0;
	for cnt = 0 To MA_Period-1 Begin
		sum = sum + GetIndexValue(shift+cnt);
	End;
	SetIndexValue(shift,sum/MA_Period);
	loopbegin2 = loopbegin2-1;        // prevent to previous bars recounting
End; 
loopbegin3 = loopbegin3+1; // current bar is to be recounted too 
For shift = loopbegin3 Downto 0 Begin 
SlowMA = iADX(TIME_Period,MODE_PLUSDI,shift);
SetIndexValue2(shift,SlowMA); 
loopbegin3 = loopbegin3-1; // prevent to previous bars recounting 
End; 
// signal line
loopbegin4 = loopbegin4+1;            // current bar is to be recounted too
For shift = loopbegin4 Downto 0 Begin
	sum = 0;
	for cnt = 0 To SignalMAPeriod-1 Begin
		sum = sum + GetIndexValue2(shift+cnt);
	End;
	SetIndexValue2(shift,sum/SignalMAPeriod);
	loopbegin4 = loopbegin4-1;   
End;
2楼 
沉了,俺顶~~~~~~~~~~~
韬客社区www.talkfx.co
发表于:2006-05-16 11:36只看该作者
3楼 
帮顶
韬客社区www.talkfx.co
4楼 
谢谢3楼,感动ING :')  :handshake
韬客社区www.talkfx.co
发表于:2006-05-16 12:41只看该作者
5楼 
不用谢,4楼的
韬客社区www.talkfx.co
发表于:2006-05-16 22:38只看该作者
6楼 
请问lz这个指标叫啥名啊?谢谢
韬客社区www.talkfx.co
7楼 
原帖由 fcz 于 2006-5-17 06:38 发表 请问lz这个指标叫啥名啊?谢谢
韬客社区www.talkfx.co
9楼 
原帖由 atspyche 于 2006-5-17 10:16 发表 感觉象天文,能懂的人应该是高手。
韬客社区www.talkfx.co
13楼 
谢谢12楼的帮顶 :lol
韬客社区www.talkfx.co
发表于:2006-05-18 02:18只看该作者
14楼 
你去『 外汇软件品评 』应该会有人能帮到你!
15楼 
原帖由 繁体字 于 2006-5-18 10:18 发表 你去『 外汇软件品评 』应该会有人能帮到你!
韬客社区www.talkfx.co
发表于:2006-05-18 03:21只看该作者
16楼 
原帖由 yzx 于 2006-5-18 11:01 发表 那些高手应该不会只进『 外汇软件品评 』吧。:L
韬客社区www.talkfx.co
发表于:2006-05-18 10:29只看该作者
18楼 
原帖由 yzx 于 2006-5-18 13:33 发表 既然大家都这样说,那就浪费一下论坛的资源吧。:L
韬客社区www.talkfx.co
发表于:2006-05-18 10:58只看该作者
19楼 
其实可以用MT4自带的 ADX,调一下自己喜欢的参数就行了
韬客社区www.talkfx.co
20楼 
原帖由 隆昌运 于 2006-5-18 18:58 发表 其实可以用MT4自带的 ADX,调一下自己喜欢的参数就行了
韬客社区www.talkfx.co














