请老师修改成博易的指标,谢谢 [博易POBO]
咨询内容:
VARIABLE:dayCount=1,PositionCount=1,SellSign=0,dK=0;//加多空标志,1:多,-1:空 0:空仓
VARIABLE:EntAndExitSign=1,EntPoint=0,ExitPoint=0;
VARIABLE:N=0;
N:=MA(TR,trn);
BUYHHV:=HHV(H,hn);
SELLLLV:=LLV(L,ln);
sellshortllv:=llv(l,hn);
buyshorthhv:=hhv(h,ln);
IF BARPOS>=hn THEN
BEGIN
IF BARPOS=hn THEN
IF DayCount=hn/2 OR BARPOS=hn THEN
BEGIN{hn/2天调整N值}
N:=((hn-1)*N+TR)/hn;{计算N值}
DayCount:=2;
END
DayCount:=DayCount+1;
EntPoint:=ENTERBARS+1;
IF EntPoint=EntAndExitSign THEN
BEGIN{说明STOP指令买进头寸成功}
PositionCount:=PositionCount+1;{头寸计数}
SellSign:=True;{可以平仓信号,如果达到指定的价格}
END
IF PositionCount=1 THEN BEGIN{第一头寸}
HOW:=CASH(0)*0.01/N;{波动性百分比决定头寸规模}
if high=buyhhv then
BEGIN
dk:=1;
多开1:BUY(1,HOW,STOP,BUYHHV);{在20日新高STOP指令买进}
END;
if low=sellshortllv then
begin
dk:=-1;
空开1:buyshort(1,HOW,STOP,sellshortllv);{在20日新低STOP指令空开}
end;
END
IF PositionCount=2 THEN BEGIN{如到第二头寸}
HOW:=CASH(0)*0.01/N;{波动性百分比决定头寸规模}
if dk=1 then 多开2:BUY(1,HOW,STOP,ENTERPRICE+0.5*N);{在上头寸(即第一头寸)+0.5个N以STOP指令买进}
if dk=-1 then 空开2:buyshort(1,HOW,STOP,ENTERPRICE-0.5*N);
END
IF PositionCount=3 THEN BEGIN{如到第三头寸}
HOW:=CASH(0)*0.01/N;
if dk=1 then 多开3:BUY(1,HOW,STOP,ENTERPRICE+0.5*N);{在上头寸(即第二头寸)+0.5个N以STOP指令买进}
if dk=-1 then 空开3:buyshort(1,HOW,STOP,ENTERPRICE-0.5*N);
END
IF PositionCount=4 THEN BEGIN
HOW:=CASH(0)*0.01/N;
if dk=1 then 多开4:BUY(1,HOW,STOP,ENTERPRICE+0.5*N);
if dk=-1 then 空开4:buyshort(1,HOW,STOP,ENTERPRICE-0.5*N);
END
IF SellSign=True THEN
BEGIN
ExitPoint:=EXITBARS+1;
if dk=1 then
begin
IF ExitPoint=EntAndExitSign THEN
BEGIN {说明卖出成功}
PositionCount:=1;{头寸计算复原}
SellSign:=False;
dk:=0;
END
IF ENTERPRICE-2*N then
SELL(1,100%,STOP,SELLLLV);{退出离盈利头寸}
ELSE
SELL(1,100%,STOP,ENTERPRICE-2*N);{退出亏损头寸}
end;
if dk=-1 then
begin
IF ExitPoint=EntAndExitSign THEN
BEGIN
PositionCount:=1;
SellSign:=False;
dk:=0;
END
IF ENTERPRICE+2*N then
sellSHORT(1,100%,STOP,BUYSHORTHHV);
ELSE
sellSHORT(1,100%,STOP,ENTERPRICE+2*N);
END;
END
END;
请老师修改成博易的指标,谢谢
input:trn(20,5,30),hn(20,5,30),ln(10,5,20);VARIABLE:dayCount=1,PositionCount=1,SellSign=0,dK=0;//加多空标志,1:多,-1:空 0:空仓
VARIABLE:EntAndExitSign=1,EntPoint=0,ExitPoint=0;
VARIABLE:N=0;
N:=MA(TR,trn);
BUYHHV:=HHV(H,hn);
SELLLLV:=LLV(L,ln);
sellshortllv:=llv(l,hn);
buyshorthhv:=hhv(h,ln);
IF BARPOS>=hn THEN
BEGIN
IF BARPOS=hn THEN
IF DayCount=hn/2 OR BARPOS=hn THEN
BEGIN{hn/2天调整N值}
N:=((hn-1)*N+TR)/hn;{计算N值}
DayCount:=2;
END
DayCount:=DayCount+1;
EntPoint:=ENTERBARS+1;
IF EntPoint=EntAndExitSign THEN
BEGIN{说明STOP指令买进头寸成功}
PositionCount:=PositionCount+1;{头寸计数}
SellSign:=True;{可以平仓信号,如果达到指定的价格}
END
IF PositionCount=1 THEN BEGIN{第一头寸}
HOW:=CASH(0)*0.01/N;{波动性百分比决定头寸规模}
if high=buyhhv then
BEGIN
dk:=1;
多开1:BUY(1,HOW,STOP,BUYHHV);{在20日新高STOP指令买进}
END;
if low=sellshortllv then
begin
dk:=-1;
空开1:buyshort(1,HOW,STOP,sellshortllv);{在20日新低STOP指令空开}
end;
END
IF PositionCount=2 THEN BEGIN{如到第二头寸}
HOW:=CASH(0)*0.01/N;{波动性百分比决定头寸规模}
if dk=1 then 多开2:BUY(1,HOW,STOP,ENTERPRICE+0.5*N);{在上头寸(即第一头寸)+0.5个N以STOP指令买进}
if dk=-1 then 空开2:buyshort(1,HOW,STOP,ENTERPRICE-0.5*N);
END
IF PositionCount=3 THEN BEGIN{如到第三头寸}
HOW:=CASH(0)*0.01/N;
if dk=1 then 多开3:BUY(1,HOW,STOP,ENTERPRICE+0.5*N);{在上头寸(即第二头寸)+0.5个N以STOP指令买进}
if dk=-1 then 空开3:buyshort(1,HOW,STOP,ENTERPRICE-0.5*N);
END
IF PositionCount=4 THEN BEGIN
HOW:=CASH(0)*0.01/N;
if dk=1 then 多开4:BUY(1,HOW,STOP,ENTERPRICE+0.5*N);
if dk=-1 then 空开4:buyshort(1,HOW,STOP,ENTERPRICE-0.5*N);
END
IF SellSign=True THEN
BEGIN
ExitPoint:=EXITBARS+1;
if dk=1 then
begin
IF ExitPoint=EntAndExitSign THEN
BEGIN {说明卖出成功}
PositionCount:=1;{头寸计算复原}
SellSign:=False;
dk:=0;
END
IF ENTERPRICE-2*N then
SELL(1,100%,STOP,SELLLLV);{退出离盈利头寸}
ELSE
SELL(1,100%,STOP,ENTERPRICE-2*N);{退出亏损头寸}
end;
if dk=-1 then
begin
IF ExitPoint=EntAndExitSign THEN
BEGIN
PositionCount:=1;
SellSign:=False;
dk:=0;
END
IF ENTERPRICE+2*N then
sellSHORT(1,100%,STOP,BUYSHORTHHV);
ELSE
sellSHORT(1,100%,STOP,ENTERPRICE+2*N);
END;
END
END;
来源:程序化99网( WWW.CXH99.COM )
博易技术人员: 您好,无法修改 来源 程序化久久网
有思路,想编写各种指标公式,交易模型,选股公式,还原公式的朋友
可联系技术人员 QQ: 262069696 或微信号:cxh99cxh99 进行 有偿收费 编写!
(注:由于人数限制,QQ或微信请选择方便的一个联系我们就行,加好友时请简单备注下您的需求,否则无法通过。谢谢您!)
相关文章
-
没有相关内容