求教编程高手~~
我有个在mt3.83上的自编指标,在mt4.0上调不出来了,哪位高手能帮我一下吗?先谢过了
指标如下:
/*[[
Name := RSI MA
Author := Copyright ?2003, Fostar
Link := [email protected]
Separate Window := Yes
First Color := Lime
First Draw Type := Line
First Symbol := 217
Use Second Data := Yes
Second Color := Red
Second Draw Type := Line
Second Symbol := 218
]]*/
Inputs:
RsiPeriod(14),
Price_C_O_H_L_M_T_W(0), //0..6
/*
PRICE_CLOSE - 0
PRICE_OPEN - 1
PRICE_HIGH - 2
PRICE_LOW - 3
PRICE_MEDIAN - 4
PRICE_TYPICAL - 5
PRICE_WEIGHTED - 6
*/
MAPeriod(8),
MAType_Simp_E_Smo_W(0), //0..3
/*
MODE_SMA - 0
MODE_EMA - 2
MODE_SMMA - 2
MODE_WMA - 3
*/
MAShift(0),
BarsCount(300);
Variable : shift(0), value(0), sum(0), n(0), MA(0), bars_(0), smconst(0), prev(0);
Variable: weight(0), linear(0);
SetLoopCount(0);
if BarsCount > 0 then {
if BarsCount > Bars then {bars_ = Bars;}
else {bars_ = BarsCount;}
}
else {bars_ = Bars;};
smconst = 2 / (1 + MAPeriod);
For shift = bars_-1 Downto 0 Begin
value = iRSIEx(RsiPeriod, 1, Price_C_O_H_L_M_T_W, MODE_FIRST, shift);
SetIndexValue(shift, value);
if (shift < bars_ - (RsiPeriod + MAPeriod + MAShift)) and (MAPeriod > 1) then begin
Switch MAType_Simp_E_Smo_W
Begin
case 0://Simple
sum = 0;
for n = 0 to MAPeriod -1 begin
sum = sum + GetIndexValue(shift + n + MAShift);
end;
MA = sum/MAPeriod;
SetIndexValue2(shift, MA);
case 1://Exponential
prev = GetIndexValue2(shift + 1 - MAShift);
MA = smconst * (value - prev) + prev;
SetIndexValue2(shift - MAShift, MA);
case 2://Smoothed
If shift = bars_ - MAPeriod Then Begin
sum = 0;
For n = 0 To MAPeriod-1 Begin
sum = sum + GetIndexValue(shift+n + MAShift);
End;
End
Else Begin
prev = GetIndexValue2(shift + 1);
sum = prev*MAPeriod - prev + GetIndexValue(shift + MAShift);
End;
MA = sum/MAPeriod;
SetIndexValue2(shift, MA);
case 3: //Linear weighted
sum = 0; weight = 0; linear = MAPeriod;
For n = 0 To MAPeriod-1 Begin
sum = sum + GetIndexValue(shift + n + MAShift) * linear;
weight = weight + linear;
linear = linear - 1;
End;
MA = sum/weight;
SetIndexValue2(shift, MA);
default://Simple
sum = 0;
for n = 0 to MAPeriod -1 begin
sum = sum + GetIndexValue(shift + n + MAShift);
end;
MA = sum/MAPeriod;
SetIndexValue2(shift, MA);
end;
end;
End;
发表于:2005-07-12 04:13只看该作者
2楼
你太强了
指标有用吗?
不要把赚钱的经历当作赚钱的能力
随波逐流 踏浪而行
发表于:2005-07-12 04:22只看该作者
3楼
mt3和mt4的编程本来就不一样嘛。
楼主聪明一世糊涂一时了。
韬客社区www.talkfx.co