欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 改写代码-请求老师帮助

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有3146人关注过本帖树形打印复制链接

主题:改写代码-请求老师帮助

帅哥哟,离线,有人找我吗?
FireScript
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:14496 积分:0 威望:0 精华:0 注册:2017/7/4 13:40:18
  发帖心情 Post By:2019/11/15 13:53:58    Post IP:180.169.30.6[显示全部帖子]

 大部分逻辑能进行转换,但是部分函数不能或无法等效替换。这些部分建议提供一些替代思路,这样会比较好点。此外部分变量未提供原始定义,请用户自行完善。

//结算价,需要在1分钟周期上才能正常计算。如果你当前指标是其他周期,那么请将下面结算价部分的代码单独放到一个指标中,再用stkindi函数进行调用。
n1:=todaybar;
dm:=4-INTPART(LOG(C));
SETTLE:ROUNDS(IF(sum(vol,n1)=0,C,sum(C*vol,n1)/sum(vol,n1)),2+dm),colorred;


DRAWNUMBER(ISLASTBAR,SETTLE,SETTLE,2,COLORYELLOW,0);
//DRAWSL(ISLASTBAR,SETTLE,0,30,0,COLORYELLOW);  无法从起点是最新K的位置绘制直线

TR1 := MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR:=MA(TR1,26),COLORBLACK;
MA26:=MA(C,26);

RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);

A9:=1;//变量
AA9:=1;//变量
B9:=1;//变量
BB9:=1;//变量

DRAWTEXT(C-REF(C,1)>REF(ATR,1) and K>REF(K,1) and K>D and ISUP and (A9 or AA9),L,'阳',COLORRED,0);
DRAWTEXT(C-REF(C,1)<REF(ATR,1) and K<REF(K,1) and K<D and ISDOWN and (B9 or BB9),H,'阴',COLORGREEN,0);


TT:=TIME>=131500 and TIME<185500 or TIME>=11500 and TIME<45500;//9点15-14点55 或者21点15-0点55

if TT and CROSS(C,SETTLE) and A9 or AA9 and holding=0  then
begin
sellshort(holding<0,holding,market);
buy(1,1,market);
end

if TT and C>AvGENTERPRICE and A9 or AA9 then  buy(holding>0,1,market);
if TT and CROSS(SETTLE,c) and B9 or BB9 and holding=0 then
begin
sell(holding>0,holding,market);
buyshort(holding=0,1,market);
end

if TT and C<AvGENTERPRICE and B9 or BB9 then buyshort(holding<0,1,market);

if TIME>=185700 and TIME<190000 or TIME>=45700 and TIME<50000  then
begin
sell(holding>0,holding,market);
sellshort(holding<0,holding,market);     
end

//TRADE_AGAIN(100); 这个无法实现 

DIFF := EMA(CLOSE,12) - EMA(CLOSE,26);
DEA := EMA(DIFF,9);
MACD:=2*(DIFF-DEA),COLORSTICK;

//DRAWCOLORKLINE无法等效替换 使用柱形近似替代。效果相近
STICKLINE(EVERY(C>=SETTLE,2) or EVERY(C>MA(C,26),2) or EVERY(C<SETTLE,2) or EVERY(C<MA(C,26),2),c,o,0.8,0,COLORYELLOW);
STICKLINE((EVERY(C>SETTLE and C>MA(C,26),2) or (EVERY(C>SETTLE,2) or EVERY(C>MA(C,26),2))) and MA(C,26)>REF(MA(C,26),1) and DEA>REF(DEA,1),c,o,0.8,1,RGB(188,58,3));
STICKLINE((EVERY(C<SETTLE and C<MA(C,26),2) or (EVERY(C<SETTLE,2) or EVERY(C<MA(C,26),2))) and MA(C,26)<REF(MA(C,26),1) and DEA<REF(DEA,1),c,o,0.8,1,COLORWHITE);

DRAWTEXT(CROSS(C,SETTLE) and A9 or AA9,L,'阳',COLORMAGENTA,0);
DRAWTEXT(CROSS(SETTLE,C) and (B9 or BB9),H,'阴',COLORGREEN,0);

//DRAWCOLORKLINE无法等效替换 使用柱形近似替代。效果相近
STICKLINE(CROSS(C,SETTLE) and A9 or AA9,c,o,0.8,0,COLORMAGENTA);
STICKLINE(CROSS(SETTLE,C) and (B9 or BB9),c,o,0.8,0,COLORGREEN);
STICKLINE((C>SETTLE) and A9 or AA9,c,o,0.8,0,COLORRED);
STICKLINE((C<SETTLE) and (B9 or BB9),c,o,0.8,0,COLORBLUE);


DRAWSL(HOLDING>0 and CROSS(C,SETTLE) and A9 or AA9,h,0,2,0,COLORRED),LINETHICK5;
DRAWNUMBER(HOLDING<0 and CROSS(C,SETTLE) and A9 or AA9,h,h,2,COLORWHITE);

DRAWSL(holding>0 and C>ENTERPRICE and A9 or AA9 and holding>0,h,0,2,0,COLORRED),LINETHICK5;
DRAWNUMBER(holding>0 and C>ENTERPRICE and A9 or AA9 and holding>0,H,H,2,COLORWHITE);


DRAWSL(HOLDING<0 and CROSS(SETTLE,c) and B9 or BB9  ,L,0,2,0,COLORRED),LINETHICK5;
DRAWNUMBER(HOLDING<0 and CROSS(SETTLE,c) and B9 or BB9,L,L,2,COLORWHITE);

DRAWSL( HOLDING<0 and C<ENTERPRICE and B9 or BB9,L,0,2,0,COLORRED),LINETHICK5;
DRAWNUMBER(HOLDING<0 and C<ENTERPRICE and B9 or BB9,L,L,2,COLORWHITE);





命数如织,当如磐石。
 回到顶部