求助 [金字塔]
- 咨询内容:
这个模型只有买开仓及平仓语句,请根据这个策略反过来写个卖开仓及平仓的完整策略,谢谢
A:=500;
手数:=1;pc:=0;
N:=BARPOS;
VARIABLE:o_r[]=0;VARIABLE:s_g[]=0;VARIABLE:o_m[]=0;VARIABLE:p[]=0; if N=1 then beginSETUBOUND(o_r,0);SETUBOUND(s_g,0);SETUBOUND(o_m,0);SETUBOUND(p,0); end
n3:=UBOUND(o_r);
IF N3>0 THEN BEGIN for i=1 to n3 do begin if p[i]=1 and close>s_g[i] then begin SELL(1,手数,MARKET);pc:=1;p[i]:=0;CONTINUE; end//止盈 if p[i]=2 and close>s_g[i] then begin SELL(1,手数,MARKET);pc:=1;p[i]:=0;CONTINUE; end//止盈 if p[i]=1 and close<o_m[i] then begin BUY(1,手数,MARKET); p[i]:=2; o_r:=o_m[i];s_g:=o_r+a/8;o_m:=o_r-a/4;p:=1; end//加仓 if p[i]=1 and TIME>185500 then begin SELL(1,手数,MARKET);pc:=1;p[i]:=5; end//收盘平仓 if p[i]=2 and TIME>185500 then begin SELL(1,手数,MARKET);pc:=1;p[i]:=5; end//收盘平仓 end
end
n1:=BARSLAST(pc=1)+1;IF valid(n1)=0 OR n1>n then n2:=N; else n2:=n1 ;zg:=HHV(c,N2);
IF N3>0 THEN BEGIN for i=1 to n3 do begin if p[i]=0 and close<zg-a/4 and time<185000 then begin BUY(1,手数,MARKET);for j=i to n3 do p[j]:=4; o_r:=zg-a/4;s_g:=o_r+a/8;o_m:=o_r-a/4;p:=1; end end
endIF N3=0 THEN BEGIN if c<zg-a/4 and time<185000 then begin BUY(1,手数,MARKET);o_r:=zg-a/4;s_g:=o_r+a/8;o_m:=o_r-a/4;p:=1; endend - 金字塔客服:
这段代码用在哪个合约哪个周期上有信号的?
- 用户回复:
橡胶,1分钟,并且在窗格属性上指定时间是7月2日,谢谢
- 网友回复:
A:=500;
手数:=1;
pc:=0;
N:=BARPOS;
VARIABLE:o_r[]=0;VARIABLE:s_g[]=0;VARIABLE:o_m[]=0;VARIABLE:p[]=0;
if N=1 then begin
SETUBOUND(o_r,0);SETUBOUND(s_g,0);SETUBOUND(o_m,0);SETUBOUND(p,0);
end
n3:=UBOUND(o_r);
IF N3>0 THEN BEGIN
for i=1 to n3 do begin
if p[i]=1 and close>s_g[i] then begin SELL(1,手数,MARKET);pc:=1;p[i]:=0;buyshort(1,手数,market);CONTINUE; end//止盈
if p[i]=2 and close>s_g[i] then begin SELL(1,手数,MARKET);pc:=1;p[i]:=0;buyshort(1,手数,market);CONTINUE; end//止盈
if p[i]=1 and close<o_m[i] then begin BUY(1,手数,MARKET); p[i]:=2; o_r:=o_m[i];s_g:=o_r+a/8;o_m:=o_r-a/4;p:=1; end//加仓
if p[i]=1 and TIME>185500 then begin SELL(1,手数,MARKET);buyshort(1,手数,market);pc:=1;p[i]:=5; end//收盘平仓
if p[i]=2 and TIME>185500 then begin SELL(1,手数,MARKET);buyshort(1,手数,market);pc:=1;p[i]:=5; end//收盘平仓
end
end
n1:=BARSLAST(pc=1)+1;IF valid(n1)=0 OR n1>n then n2:=N; else n2:=n1 ;
zg:=HHV(c,N2);
IF N3>0 THEN BEGIN
for i=1 to n3 do begin
if p[i]=0 and close<zg-a/4 and time<185000 then begin sellshort(1,手数,market);BUY(1,手数,MARKET);for j=i to n3 do p[j]:=4; o_r:=zg-a/4;s_g:=o_r+a/8;o_m:=o_r-a/4;p:=1; end
end
end
IF N3=0 THEN BEGIN
if c<zg-a/4 and time<185000 then begin sellshort(1,手数,market);BUY(1,手数,MARKET);o_r:=zg-a/4;s_g:=o_r+a/8;o_m:=o_r-a/4;p:=1; end
end - 网友回复: 你好,应该是我没有把意思表达清楚,你上面写的是原来的多单平仓时即卖开仓,我不是这个意思
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 511411198 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容