Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共4 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:请问一下,在序列模式下,标注MACD红绿柱面积的代码,错在哪?

1楼
ljact 发表于:2013/7/21 21:54:51
DIFF :=EMA(C,12) - EMA(C,26);
DEA  :=EMA(DIFF,9);
MACD :=2*(DIFF-DEA), COLORSTICK;
MJ:=C;
MJ[1]:=macd[1];
if (ref(macd,1)<=0 and macd>0) or (ref(macd,1)>=0 and macd<0) then MJ:=MACD;
else MJ[barpos]:=MJ[barpos-1]+macd[barpos];
drawnumber((refx(macd,1)<=0 and macd>0) or (refx(macd,1)>=0 and macd<0),C,MJ[barpos],0,colormagenta);
2楼
jinzhe 发表于:2013/7/22 9:31:51

数组用序列,就会最后一根值全部往前赋值成一个值。

 

下列公式用逐k线模式

DIFF :=EMA(C,12) - EMA(C,26);
DEA  :=EMA(DIFF,9);
MACD :=2*(DIFF-DEA), COLORSTICK;
MJ:=C;
MJ[1]:=macd[1];

if (ref(macd,1)<=0 and macd>0) or (ref(macd,1)>=0 and macd<0) and barpos>1 then MJ:=MACD;
if barpos>1 and ref(macd,1)>0 and macd<=0 or ref(macd,1)<0 and macd>=0 then  MJ[barpos]:=MJ[barpos-1]+macd[barpos];
drawnumber((refx(macd,1)<=0 and macd>0) or (refx(macd,1)>=0 and macd<0),C,MJ[barpos],0,colormagenta);

3楼
ljact 发表于:2013/7/22 20:22:07

是否说明这段代码没法改成序列模式?因为我的指标中,还有其他代码,只能采用序列模式。

4楼
jinzhe 发表于:2013/7/23 9:07:52
不能用序列,或者说序列很难改,和数组的赋值思路相反
[此贴子已经被作者于2013/7/23 9:08:01编辑过]
共4 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.01172 s, 3 queries.