关于mt
下面这个指标为什么不会在图上显示呢,有哪位高手能给我看看吗谢谢了
/*[[
Name := hua
Author := Copyright ?2003, MetaQuotes Software Corp.
Link := http://www.metaquotes.ru/
Separate Window := Yes
First Color := Blue
First Draw Type := Line
Use Second Data := Yes
Second Color := Red
Second Draw Type := Line
]]*/
Inputs : FastMAPeriod(6), SlowMAPeriod(10), SignalMAPeriod(2);
Variables : shift(0), cnt(0), sum(0), loopbegin1(0), loopbegin2(0), first(True), prevbars(0);
Variables : FastMA(0), SlowMA(0);
Variables : loopbegin3(0), shift1(0), KK(0), DD(0);
SetLoopCount(0);
// initial checkings
If FastMAPeriod ( 1 Or SlowMAPeriod ( 1 Or SignalMAPeriod ( 1 Then Exit;
If FastMAPeriod >= SlowMAPeriod Then Exit;
// check for additional bars loading or total reloading
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-SlowMAPeriod-1;
If loopbegin1 ( 0 Then Exit; // not enough bars for counting
loopbegin2 = Bars-SlowMAPeriod-SignalMAPeriod-2;
If loopbegin2 ( 0 Then Exit; // not enough bars for counting
loopbegin3 = Bars-SlowMAPeriod-SignalMAPeriod-2;
If loopbegin3 ( 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 = iMAEx(FastMAPeriod,MODE_EMA,0,(2*PRICE_CLOSE+PRICE_HIGH+PRICE_LOW+PRICE_OPEN)/5,shift);
SlowMA = iMAEx(SlowMAPeriod,MODE_EMA,0,(2*PRICE_CLOSE+PRICE_HIGH+PRICE_LOW+PRICE_OPEN)/5,shift);
SetIndexValue(shift,FastMA-SlowMA);
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 SignalMAPeriod-1 Begin
sum = sum + GetIndexValue(shift+cnt);
End;
SetIndexValue2(shift,sum/SignalMAPeriod);
// SetIndexValue2(shift,sum/SignalMAPeriod);
loopbegin2 = loopbegin2-1; // prevent to previous bars recounting
End;
/*
//test
loopbegin3 = loopbegin3+1; // current bar is to be recounted too
For shift = loopbegin3 Downto 0 Begin
KK = 0;
DD = 0;
KK = 2*(GetIndexValue(shift) - GetIndexValue2(shift))*3.8;
DD = -2*(GetIndexValue(shift) - GetIndexValue2(shift))*3.8;
SetIndexValue(shift,KK);
SetIndexValue2(shift,DD);
loopbegin3 = loopbegin3-1; // prevent to previous bars recounting
End;
*/
2楼
啊啊啊啊高手快来啊
韬客外汇论坛TALKFOREX.COM
发表于:2004-05-03 00:49只看该作者
3楼
/*[[
Name := hua
Author := Copyright ?2003, MetaQuotes Software Corp.
Link := http://www.metaquotes.ru/
Separate Window := Yes
First Color := Blue
First Draw Type := Line
Use Second Data := Yes
Second Color := Red
Second Draw Type := Line
]]*/
Inputs : FastMAPeriod(6), SlowMAPeriod(10), SignalMAPeriod(2);
Variables : shift(0), cnt(0), sum(0), loopbegin1(0), loopbegin2(0), first(True), prevbars(0);
Variables : FastMA(0), SlowMA(0);
Variables : loopbegin3(0), shift1(0), KK(0), DD(0);
SetLoopCount(0);
// initial checkings
If FastMAPeriod<1 Or SlowMAPeriod<1 Or SignalMAPeriod<1 Then Exit;
If FastMAPeriod >= SlowMAPeriod Then Exit;
// check for additional bars loading or total reloading
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-SlowMAPeriod-1;
If loopbegin1<0 Then Exit; // not enough bars for counting
loopbegin2 = Bars-SlowMAPeriod-SignalMAPeriod-2;
If loopbegin2<0 Then Exit; // not enough bars for counting
loopbegin3 = Bars-SlowMAPeriod-SignalMAPeriod-2;
If loopbegin3<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 = iMAEx(FastMAPeriod,MODE_EMA,0,(2*PRICE_CLOSE+PRICE_HIGH+PRICE_LOW+PRICE_OPEN)/5,shift);
SlowMA = iMAEx(SlowMAPeriod,MODE_EMA,0,(2*PRICE_CLOSE+PRICE_HIGH+PRICE_LOW+PRICE_OPEN)/5,shift);
SetIndexValue(shift,FastMA-SlowMA);
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 SignalMAPeriod-1 Begin
sum = sum + GetIndexValue(shift+cnt);
End;
SetIndexValue2(shift,sum/SignalMAPeriod);
// SetIndexValue2(shift,sum/SignalMAPeriod);
loopbegin2 = loopbegin2-1; // prevent to previous bars recounting
End;
/*
//test
loopbegin3 = loopbegin3+1; // current bar is to be recounted too
For shift = loopbegin3 Downto 0 Begin
KK = 0;
DD = 0;
KK = 2*(GetIndexValue(shift) - GetIndexValue2(shift))*3.8;
DD = -2*(GetIndexValue(shift) - GetIndexValue2(shift))*3.8;
SetIndexValue(shift,KK);
SetIndexValue2(shift,DD);
loopbegin3 = loopbegin3-1; // prevent to previous bars recounting
End;
*/
发表于:2004-05-03 00:52只看该作者
5楼
你成心捣乱呐?连校验都没通过就拿上来。
我没细看你想写的是什么东西,就是帮你校验了一下.
啥都不会,啥都想学
4楼
太谢谢你了啊:)这也是我一朋友写的,他说他用这指标结合布林线打GBP/USD15分钟图很有效果的可能是他那论坛里把尖括号都变成圆括号了:)
韬客外汇论坛TALKFOREX.COM