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


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

   

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


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

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

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


加好友 发短信
等级:新手上路 帖子:2 积分:0 威望:0 精华:0 注册:2019/10/9 13:09:26
改写代码-请求老师帮助  发帖心情 Post By:2019/11/7 15:31:59    Post IP:180.169.30.6[只看该作者]

SETTLE;
DRAWNUMBER(ISLASTBAR,SETTLE,SETTLE,2,COLORLIGHTGREY),FONTSIZE20,ALIGN0;
DRAWSL(ISLASTBAR,SETTLE,0,30,0,COLORLIGHTGREY);

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);
DRAWTEXT(C-REF(C,1)>REF(ATR,1)&&K>REF(K,1)&&K>D&&ISUP&&(A9||AA9),L,'阳'),COLORMAGENTA,VALIGN0,FONTSIZE15;
DRAWTEXT(C-REF(C,1)<REF(ATR,1)&&K<REF(K,1)&&K<D&&ISDOWN&&(B9||BB9),H,'阴'),COLORGREEN,VALIGN2,FONTSIZE15;

A9://变量
AA9://变量
B9://变量
BB9://变量
TT:=TIME>=0915&&TIME<1455||TIME>=2115&&TIME<055;
TT&&CROSS(C,SETTLE)&&A9||AA9&&BKVOL=0,BK(1);
TT&&C>BKPRICE&&A9||AA9,BK(1);
TT&&CROSSDOWN(C,SETTLE)&&B9||BB9&&SKVOL=0,SK(1);
TT&&C<SKPRICE&&B9||BB9,SK(1);
TIME>=1457&&TIME<1500||TIME>=057&&TIME<100,CLOSEOUT;
CHECKSIG(CLOSEOUT,'A',0,'C',0,0);
TRADE_AGAIN(100);

DIFF := EMA(CLOSE,12) - EMA(CLOSE,26);
DEA := EMA(DIFF,9);
MACD:=2*(DIFF-DEA),COLORSTICK;
DRAWCOLORKLINE(EVERY(C>=SETTLE,2)||EVERY(C>MA(C,26),2)||EVERY(C<SETTLE,2)||EVERY(C<MA(C,26),2),COLORYELLOW,0);
DRAWCOLORKLINE((EVERY(C>SETTLE&&C>MA(C,26),2)||(EVERY(C>SETTLE,2)||EVERY(C>MA(C,26),2)))&&MA(C,26)>REF(MA(C,26),1)&&DEA>REF(DEA,1),RGB(188,58,3),0);
DRAWCOLORKLINE((EVERY(C<SETTLE&&C<MA(C,26),2)||(EVERY(C<SETTLE,2)||EVERY(C<MA(C,26),2)))&&MA(C,26)<REF(MA(C,26),1)&&DEA<REF(DEA,1),COLORWHITE,0);

DRAWTEXT(CROSS(C,SETTLE)&&A9||AA9,L,'阳'),COLORMAGENTA,VALIGN0,FONTSIZE15;
DRAWTEXT(CROSSDOWN(C,SETTLE)&&(B9||BB9),H,'阴'),COLORGREEN,VALIGN2,FONTSIZE15;

DRAWCOLORKLINE(CROSS(C,SETTLE)&&A9||AA9,COLORMAGENTA,0);
DRAWCOLORKLINE(CROSSDOWN(C,SETTLE)&&(B9||BB9),COLORGREEN,0);
DRAWCOLORKLINE((C>SETTLE)&&A9||AA9,COLORRED,0);
DRAWCOLORKLINE((C<SETTLE)&&(B9||BB9),COLORBLUE,0);

HH:HHV(H,CROSS(C,SETTLE)&&A9||AA9);//买入显示价格
DRAWSL(CROSS(C,SETTLE)&&A9||AA9,HH,0,2,0,COLORRED),LINETHICK5;
DRAWNUMBER(CROSS(C,SETTLE)&&A9||AA9,HH,HH,2,COLORWHITE),ALIGN0;//数字
HH3:HHV(H,C>BKPRICE&&A9||AA9);//买入显示价格
DRAWSL(C>BKPRICE&&A9||AA9,HH3,0,2,0,COLORRED),LINETHICK5;
DRAWNUMBER(C>BKPRICE&&A9||AA9,HH3,HH3,2,COLORWHITE),ALIGN0;//数字

LL:LLV(L,CROSSDOWN(C,SETTLE)&&B9||BB9);//卖出显示价格
DRAWSL(CROSSDOWN(C,SETTLE)&&B9||BB9,LL,0,2,0,COLORRED),LINETHICK5;
DRAWNUMBER(CROSSDOWN(C,SETTLE)&&B9||BB9,LL,LL,2,COLORWHITE),ALIGN0;//数字
LL3:LLV(L,C<SKPRICE&&B9||BB9);//卖出显示价格
DRAWSL(C<SKPRICE&&B9||BB9,LL3,0,2,0,COLORRED),LINETHICK5;
DRAWNUMBER(C<SKPRICE&&B9||BB9,LL3,LL3,2,COLORWHITE),ALIGN0;//数字

请求帮助改成金字塔的程序化

 回到顶部
帅哥哟,离线,有人找我吗?
FireScript
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | 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);





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