在当前运行的公式中引用是否可以? [金字塔]
- 咨询内容:
公式1运行在rb00日线下,请问老师如下引用可以吗?
公式1:
variable:n1=0,n2=0;
VARIABLE:HIGHPRICE=0,LOWPRICE=0;
B:=REF(MA(C,20),1),PRECISION1,LINETHICK0;
KD1:=CROSS(MA(CLOSE,5),MA(CLOSE,30));
Kk1:=CROSS(MA(CLOSE,30),MA(CLOSE,5));
KD2:=CROSS(MA(CLOSE,10),MA(CLOSE,30));
Kk2:=CROSS(MA(CLOSE,30),MA(CLOSE,10));
KD:=(KD1 and n1=0 )OR( KD2 and n1=0 );
KK:=(KK1 and n2=0) OR( KK2 and n2=0);t1:=currenttime>=t0totime(timetot0(closetime(0))-5*60)and currenttime<t0totime(timetot0(closetime(0))-30);//开仓时间
t2:=currenttime>=t0totime(timetot0(closetime(0))-5*60);//平仓时间
多开:BUY(1=1,1,marketr);
IF HOLDING<0 THEN BEGIN
IF (t2 AND CLOSE>B and n2=0 and STKINDIEX('rb01','公式1.收盘空平,0,6,0,200) and islastbar )or (not(islastbar) and CLOSE>B and n2=0) THEN BEGIN
收盘空平:SELLSHORT(1,1,marketr);
n2:=1;
IF islastbar THEN BEGIN
DEBUGFILE('D:\TEST.TXT',' 收盘空平:%.0f',收盘空平);//输出收盘空平
DEBUGFILE('D:\TEST.TXT','holding:%.0f',holding);//输出HOLDING
DEBUGFILE('D:\TEST.TXT','N2:%.0f',N2);//输出N2
END
END
IF HOLDING=0 THEN BEGIN
IF ( t1 AND KK and islastbar and ENTERBARS!=0 )or (not(islastbar) and kk and ENTERBARS!=0 )THEN BEGIN
LOWPRICE:=ENTERPRICE;
END
ENDIF HOLDING>0 THEN BEGIN
多损:SELL(1,1,marketr);
IF (t2 AND CLOSE>B and n2=0 and islastbar )or (not(islastbar) and CLOSE>B and n2=0) THEN BEGIN
收盘多平:SELL(1,1,marketr);
n2:=1;
END
n2:=1;
END
IF L<LOWPRICE THEN LOWPRICE:=L;
IF ENTERPRICE-LOWPRICE>=30 THEN BEGIN
IF H >=LOWPRICE*(1+5/1000)and n2=0 THEN BEGIN
多赢:SELL(1,1,MARKET);
n2:=1;
END
END
ENDIF HOLDING=0 THEN BEGIN
IF ( t1 AND KK and STKINDIEX('rb01','公式1.空开,0,6,0,200) and islastbar and ENTERBARS!=0 )or (not(islastbar) and kk and ENTERBARS!=0 )THEN BEGIN
空开:BUYSHORT(1=1,1,marketr);
LOWPRICE:=ENTERPRICE;
IF islastbar THEN BEGIN
DEBUGFILE('D:\TEST.TXT',' T1f'&numtostr(T1,0)&' ENTERBARS!=0:'&numtostr(ENTERBARS!=0,1)&' KK:'&numtostr(KK,0)&' N2:'&numtostr(N2,0),0); //输出开仓条件
DEBUGFILE('D:\TEST.TXT',' 空开:%.0f',空开);//输出空开
DEBUGFILE('D:\TEST.TXT','holding:%.0f',holding);//输出HOLDING
//DEBUGFILE('D:\TEST.TXT','N2:%.0f',N2);//输出N2
END
END
END
IF H>=ENTERPRICE*(1+0.02) and n2=0 and STKINDIEX('rb01','公式1.空损,0,6,0,200) THEN BEGIN
空损:SELLSHORT(1,1,marketr);
n2:=1;
IF islastbar THEN BEGIN
DEBUGFILE('D:\TEST.TXT',' 空损:%.0f',空损);//输出空损
DEBUGFILE('D:\TEST.TXT','holding:%.0f',holding);//输出HOLDING
DEBUGFILE('D:\TEST.TXT','N2:%.0f',N2);//输出N2
END
END
IF L<LOWPRICE THEN LOWPRICE:=L;
IF ENTERPRICE-LOWPRICE>=30 THEN BEGIN
IF H >=LOWPRICE*(1+5/1000)and n2=0 and STKINDIEX('rb01','公式1. 空赢,0,6,0,200) THEN BEGIN
空赢:SELLSHORT(1,1,MARKET);
n2:=1;
IF islastbar THEN BEGIN
DEBUGFILE('D:\TEST.TXT',' 空赢:%.0f',空赢);//输出空赢
DEBUGFILE('D:\TEST.TXT','holding:%.0f',holding);//输出HOLDING
DEBUGFILE('D:\TEST.TXT','N2:%.0f',N2);//输出N2
END
END
END
END
if (islastbar and currenttime =closetime(0))or (not(islastbar)) then begin
n1:=0;
n2:=0;
end
持仓:holding,linethick0;
资产:asset,PRECISION1,linethick1,noaxis,COLOR8586D8; - 金字塔客服:
自己引用自己?
此主题相关图片如下:1.png
[此贴子已经被作者于2014/6/9 13:20:00编辑过] - 用户回复:
仅品种不同。运行在rb00日线下,引用rb01日线之值。
- 网友回复:
是不是自己引用自己?
- 网友回复: 仅品种不同。公式1运行在rb00日线下,引用rb01日线之值
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 511411198 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容