Rss & SiteMap

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

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

标题:求助写个指标

1楼
梵夫 发表于:2011/11/24 10:01:39

MACD底背离时候开多,顶背离时候开空

背离时候结合前面一个底部或是顶部情况,联动K线符合即可。

2楼
26327756l 发表于:2011/11/24 10:08:28

请详细说明

3楼
梵夫 发表于:2011/12/1 11:17:41

开多情况:K线行情较前面30根K线比较有创出新低后,此时MACD,diff高于这30根K线周期内diff最低值,在之后的10根K线周期内MACD若出现金叉则开多。

平多: 在开多之后第一次出现死叉则平多

开空情况:K线行情较前面30根K线比较有创出新高后,此时MACD,diff低于这30根K线周期内diff最高值,在之后的10根K线周期内MACD若出现死叉则开空。

平空: 在开空之后第一次出现金叉则平空

4楼
26327756l 发表于:2011/12/1 11:25:28
问题正在解决中
5楼
阿火 发表于:2011/12/1 12:56:22

variable:flag=0;
hi30:=ref(hhv(h,30),1);
lo30:=ref(llv(l,30),1);
diff:=ema(close,12) - ema(close,26);
dea:=ema(diff,9);
sc:=cross(dea,diff);
jc:=cross(diff,dea);
hi30_diff:=ref(hhv(diff,30),1);
lo30_diff:=ref(llv(diff,30),1);

if flag<>-1 and h>hi30 and diff<hi30_diff then begin
 flag:=-1;
 kpos:=barpos;
end

if flag<>1 and l<lo30 and diff>lo30_diff then begin
 flag:=1;
 kpos:=barpos;
end

if holding>0 and cross(dea,diff) then begin
 sell(1,1,limitr,c);
 flag:=0;
end

if holding<0 and cross(diff,dea) then begin
 sellshort(1,1,limitr,c);
 flag:=0;
end

if flag=1 and holding=0 then begin
 if barpos-kpos<=10 and jc then begin
  buy(1,1,limitr,c);
 end
 if barpos-kpos=10 then flag:=0;
end

if flag=-1 and holding=0 then begin
 if barpos-kpos<=10 and sc then begin
  buyshort(1,1,limitr,c);
 end
 if barpos-kpos=10 then flag:=0;
end

zichan:asset,noaxis;
if barpos=1 then begin
 MaxAsset:=zichan;
 hc:=0; 
end
if zichan>MaxAsset then MaxAsset:=zichan;
if MaxAsset-zichan>hc then hc:=MaxAsset-zichan;
Maxhc:hc,linethick0;
交易次数:totaltrade,linethick0;
正确率:percentwin,linethick0;

[此贴子已经被作者于2011-12-1 12:58:38编辑过]
6楼
26327756l 发表于:2011/12/1 14:49:53

你看看行不行

variable:b1=0,b2=0;
input:P(26,20,100,8),S(12,5,40,4),M(9,2,60,6);
DIFF := EMA(CLOSE,S) - EMA(CLOSE,P);
DEA  := EMA(DIFF,M);
MACD1 := 2*(DIFF-DEA), COLORSTICK;


if l<ref(llv(l,30),1) and diff>ref(llv(l,30),1) then b1:=BARPOS;
if BARPOS-b1<10 and diff>MACD1 then
begin
sellshort(holding<0,0,market);
buy(holding=0,1,market);
end
if TYPE(1)=1 and diff<MACD1 then sell(holding>0,0,market);


if H>ref(hhv(h,30),1) and diff<ref(hhv(h,30),1) then b2:=BARPOS;
if BARPOS-b1<10 and diff<MACD1 then
begin
sell(holding>0,0,market);
buyshort(holding=0,1,market);
end
if TYPE(1)=3 and diff<MACD1 then sellshort(holding<0,0,market);


 

7楼
蔡宛宏 发表于:2011/12/19 16:52:23
谢谢斑竹分享
共7 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in .04883 s, 2 queries.