[MT4指标]哪位能将下面想法编成MT3.84指标?
烦请论坛高手将下面想法编成MT3.84指标,谢谢!
AA=收盘价-开盘价
if AA大于等于0,then
BB=开盘价-最低价
else
BB=收盘价-最低价
if AA大于等于0,then
CC=最高价-收盘价
else
CC=最高价-开盘价
if AA=0 then
SUM=0.5*BB+0.5CC
if AA大于0 then
SUM=0.6*AA-0.25BB-0.15CC
if AA小于0 then
SUM=0.6AA+0.15BB+0.25CC
最后能够在副图窗口绘制出SUM 方块图(SUM为正值或负值时用不同颜色表达)和不同时间周期(周期可调)的移动平均线。
[ Last edited by momore on 2005-6-12 at 09:48 ]
2楼
Originally posted by momore at 2005-6-12 09:46 烦请论坛高手将下面想法编成MT3.84指标,谢谢! AA=收盘价-开盘价 if AA大于等于0,then BB=开盘价-最低价 else BB=收盘价-最低价 if AA大于等于0,then CC=最高价-收盘价 else CC=最高价-开盘价 ...
韬客外汇论坛TALKFOREX.COM
发表于:2005-06-15 16:18只看该作者
3楼
哥们儿,这是我写的程序
/*[[
Name := TMI
Author := Copyright ?2003, MetaQuotes Software Corp.
Link := http://www.metaquotes.ru/
Separate Window := Yes
First Color := White
First Draw Type := Histogram
Use Second Data := Yes
Second Color := Red
Second Draw Type := Line
]]*/
Inputs : MAPeriod(13);
Variables : shift(0), cnt(0), loopbegin1(0), loopbegin2(0), first(True), prevbars(0);
Variables : MA(0), Diff(0), Up(0), Down(0), Sum(0), MASum(0);
SetLoopCount(0);
// initial checkings
If MAPeriod < 1 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-1;
If loopbegin1 < 0 Then Exit; // not enough bars for counting
loopbegin2 = Bars-MAPeriod-1;
If loopbegin2 < 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
Diff = Close[shift] - Open[shift];
if (Diff >= 0) then
Begin
Up = High[shift] - Close[shift];
Down = Open[shift] - Low[shift];
end
else if(Diff < 0) then
Begin
Up = High[shift] - Open[shift];
Down = Close[shift] - Low[shift];
end;
if (Diff == 0) then
Begin
Sum = Up*0.5 + Down*0.5;
end
else if(Diff > 0) then
Begin
Sum = 0.6*Diff-0.25*Down - 0.15*Up;
end
else if(Diff <0) then
Begin
Sum = 0.6*Diff + 0.15*Down + 0.25*Up;
End;
SetIndexValue(shift, Sum);
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
MASum = 0;
for cnt = 0 To MAPeriod-1 Begin
MASum = MASum + GetIndexValue(shift+cnt);
End;
SetIndexValue2(shift,MASum/MAPeriod);
loopbegin2 = loopbegin2-1; // prevent to previous bars recounting
End;
[ Last edited by 老正 on 2005-6-16 at 15:23 ]
发表于:2005-06-18 22:38只看该作者
4楼
Originally posted by shunshi at 2005-6-16 00:18 哥们儿,这是我写的程序 /*[[ Name := TMI Author := Copyright ?2003, MetaQuotes Software Corp. Link := http://www.metaquotes.ru/ Separate Window := Yes First Color := ...
发表于:2005-10-01 13:55只看该作者
5楼
y
韬客社区www.talkfx.co
发表于:2005-11-14 03:45只看该作者
6楼
很好,非常好
不识庐山真面貌,只缘身在此山中