以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://222.73.7.161/bbs/index.asp)
--  公式模型编写问题提交  (http://222.73.7.161/bbs/list.asp?boardid=4)
----  [讨论]公式编写问题  (http://222.73.7.161/bbs/dispbbs.asp?boardid=4&id=181985)

--  作者:黑色键盘
--  发布时间:2020/9/1 9:10:15
--  [讨论]公式编写问题
有老师可以帮忙把文华的公式改成金字塔的吗?万分感谢!下面是文华的代码:
REFX1(C,10000),COLORYELLOW,DOT;
DRAWNUMBER(ISLASTBAR,C,C,4,COLORYELLOW),FONTSIZE20,ALIGN0,VALIGN0;


--  作者:FireScript
--  发布时间:2020/9/1 9:33:10
--  
 LEN:DATACOUNT-BARPOS;
A:REFX(C,IF(LEN>10000,10000,LEN)),COLORYELLOW,DOT;//不定义成变量,无法输出和显示
DRAWNUMBER(ISLASTBAR,C,C,4,COLORYELLOW,4);
[此贴子已经被作者于2020/9/1 9:34:14编辑过]

--  作者:黑色键盘
--  发布时间:2020/9/1 10:51:04
--  
有没有表示字体字号的函数呢
--  作者:FireScript
--  发布时间:2020/9/1 11:05:48
--  
 这个目前没有。我们软件只能系统性的设置,不能在代码里面单独指定。
--  作者:黑色键盘
--  发布时间:2020/9/14 12:36:05
--  
 LEN:DATACOUNT-BARPOS;
A:REFX(C,IF(LEN>10000,10000,LEN)),COLORYELLOW,DOT;//不定义成变量,无法输出和显示
DRAWNUMBER(ISLASTBAR,C,C,4,COLORYELLOW,4);
这代码怎么有一条斜线呢?

图片点击可在新窗口打开查看此主题相关图片如下:qq截图20200914122950.jpg
图片点击可在新窗口打开查看


--  作者:wenarm
--  发布时间:2020/9/14 13:10:46
--  

这个是你手工画的线吧。和代码没有关系。

 


--  作者:黑色键盘
--  发布时间:2020/9/14 14:22:55
--  
不是,这是FireScript老师给我的这条代码的,K线多了就会出现这条斜线
--  作者:FireScript
--  发布时间:2020/9/14 14:26:40
--  
  LEN:=DATACOUNT-BARPOS;

这里改下

--  作者:黑色键盘
--  发布时间:2020/9/14 16:45:56
--  
感谢老师,改好了!
--  作者:黑色键盘
--  发布时间:2020/9/14 17:13:47
--  
这是文华的代码能改金字塔的吗?
N:=BARSLAST(DATE<>REF(DATE,1))+1;

TJX:=MONTH=3&&CROSS(COUNT(CROSS(WEEKDAY=1,0.5),BARSLAST(CROSS(MONTH=3,0.5))+1)=2,0.5);
TJY:=MONTH=11&&CROSS(COUNT(CROSS(WEEKDAY=1,0.5),BARSLAST(CROSS(MONTH=11,0.5))+1)=1,0.5);
M1:=BARSLAST(TJX)+1;
M2:=BARSLAST(TJY)+1;
TJ1:=M1>0&&(M1<M2||ISNULL(M2))&&TIME=0600;
TJ2:=M1>0&&(M1<M2||ISNULL(M2))&&TIME=1400;
TJ3:=M1>0&&(M1<M2||ISNULL(M2))&&TIME=2000;
TJ4:=M1>0&&(M1<M2||ISNULL(M2))&&DATE<>REFX(DATE,1);

H1:=REFX1(HHV(H,16),15);
L1:=REFX1(LLV(L,16),15);
DRAWSL(TJ1,H1,0,15,0,COLORWHITE),DOT;
DRAWSL(TJ1,L1,0,15,0,COLORWHITE),DOT;
DRAWLINE(TJ1,H1,TJ1,L1,COLORWHITE),DOT;
DRAWLINE(REFX(TJ2,1),HHV(H,16),REFX(TJ2,1),LLV(L,16),COLORWHITE),DOT;
DRAWNUMBER(TJ1,H1,H1,4,COLORRED),ALIGN0,VALIGN2;
DRAWNUMBER(TJ1,L1,L1,4,COLORGREEN),ALIGN0,VALIGN0;

H2:=REFX1(HHV(H,12),11);
L2:=REFX1(LLV(L,12),11);
DRAWSL(TJ2,H2,0,11,0,COLORWHITE),DOT;
DRAWSL(TJ2,L2,0,11,0,COLORWHITE),DOT;
DRAWLINE(TJ2,H2,TJ2,L2,COLORWHITE),DOT;
DRAWLINE(REFX(TJ3,1),HHV(H,12),REFX(TJ3,1),LLV(L,12),COLORWHITE),DOT;
DRAWNUMBER(TJ2,H2,H2,4,COLORRED),ALIGN0,VALIGN2;
DRAWNUMBER(TJ2,L2,L2,4,COLORGREEN),ALIGN0,VALIGN0;

H3:=REFX1(HHV(H,18),17);
L3:=REFX1(LLV(L,18),17);
DRAWSL(TJ3,H3,0,17,0,COLORWHITE),DOT;
DRAWSL(TJ3,L3,0,17,0,COLORWHITE),DOT;
DRAWLINE(TJ3,H3,TJ3,L3,COLORWHITE),DOT;
DRAWLINE(TJ4,HHV(H,18),TJ4,LLV(L,18),COLORWHITE),DOT;
DRAWNUMBER(TJ3,H3,H3,4,COLORRED),ALIGN0,VALIGN2;
DRAWNUMBER(TJ3,L3,L3,4,COLORGREEN),ALIGN0,VALIGN0;

TJ5:=M2>0&&(M2<M1||ISNULL(M1))&&TIME=0700;
TJ6:=M2>0&&(M2<M1||ISNULL(M1))&&TIME=1500;
TJ7:=M2>0&&(M2<M1||ISNULL(M1))&&TIME=2100;
TJ8:=M2>0&&(M2<M1||ISNULL(M1))&&DATE<>REFX(DATE,1);

H5:=REFX1(HHV(H,16),15);
L5:=REFX1(LLV(L,16),15);
DRAWSL(TJ5,H5,0,15,0,COLORWHITE),DOT;
DRAWSL(TJ5,L5,0,15,0,COLORWHITE),DOT;
DRAWLINE(TJ5,H5,TJ5,L5,COLORWHITE),DOT;
DRAWLINE(REFX(TJ6,1),HHV(H,16),REFX(TJ6,1),LLV(L,16),COLORWHITE),DOT;
DRAWNUMBER(TJ5,H5,H5,4,COLORRED),ALIGN0,VALIGN2;
DRAWNUMBER(TJ5,L5,L5,4,COLORGREEN),ALIGN0,VALIGN0;

H6:=REFX1(HHV(H,12),11);
L6:=REFX1(LLV(L,12),11);
DRAWSL(TJ6,H6,0,11,0,COLORWHITE),DOT;
DRAWSL(TJ6,L6,0,11,0,COLORWHITE),DOT;
DRAWLINE(TJ6,H6,TJ6,L6,COLORWHITE),DOT;
DRAWLINE(REFX(TJ7,1),HHV(H,12),REFX(TJ7,1),LLV(L,12),COLORWHITE),DOT;
DRAWNUMBER(TJ6,H6,H6,4,COLORRED),ALIGN0,VALIGN2;
DRAWNUMBER(TJ6,L6,L6,4,COLORGREEN),ALIGN0,VALIGN0;

H7:=REFX1(HHV(H,18),17);
L7:=REFX1(LLV(L,18),17);
DRAWSL(TJ7,H7,0,17,0,COLORWHITE),DOT;
DRAWSL(TJ7,L7,0,17,0,COLORWHITE),DOT;
DRAWLINE(TJ7,H7,TJ7,L7,COLORWHITE),DOT;
DRAWLINE(TJ8,HHV(H,18),TJ8,LLV(L,18),COLORWHITE),DOT;
DRAWNUMBER(TJ7,H7,H7,4,COLORRED),ALIGN0,VALIGN2;
DRAWNUMBER(TJ7,L7,L7,4,COLORGREEN),ALIGN0,VALIGN0;

Z1:=M1>0&&(M1<M2||ISNULL(M2))&&DATE<>REFX(DATE,1);
P1:=M1>0&&(M1<M2||ISNULL(M2))&&TIME>=1000&&TIME<1330&&CROSS(COUNT(ABS(C-O)<=(H-L)/2,BARSLAST(TIME=1000)+1)=1,0.5);
DRAWLINE(Z1,REF(H,BARSLAST(P1)),Z1,REF(L,BARSLAST(P1)),COLORYELLOW);
DRAWLINE(P1,H,P1,L,COLORYELLOW);
DRAWSL(Z1,REF(H,BARSLAST(P1)),0,-BARSLAST(P1),0,COLORYELLOW);
DRAWSL(Z1,REF(L,BARSLAST(P1)),0,-BARSLAST(P1),0,COLORYELLOW);

P2:=M1>0&&(M1<M2||ISNULL(M2))&&TIME>=1700&&TIME<1930&&CROSS(COUNT(ABS(C-O)<=(H-L)/2,BARSLAST(TIME=1700)+1)=1,0.5);
DRAWLINE(Z1,REF(H,BARSLAST(P2)),Z1,REF(L,BARSLAST(P2)),COLORBLUE);
DRAWLINE(P2,H,P2,L,COLORBLUE);
DRAWSL(Z1,REF(H,BARSLAST(P2)),0,-BARSLAST(P2),0,COLORBLUE);
DRAWSL(Z1,REF(L,BARSLAST(P2)),0,-BARSLAST(P2),0,COLORBLUE);

P3:=M1>0&&(M1<M2||ISNULL(M2))&&(TIME>=2100||TIME<0000)&&CROSS(COUNT(ABS(C-O)<=(H-L)/2,BARSLAST(TIME=2100)+1)=1,0.5);
DRAWLINE(Z1,REF(H,BARSLAST(P3)),Z1,REF(L,BARSLAST(P3)),COLORGREEN);
DRAWLINE(P3,H,P3,L,COLORGREEN);
DRAWSL(Z1,REF(H,BARSLAST(P3)),0,-BARSLAST(P3),0,COLORGREEN);
DRAWSL(Z1,REF(L,BARSLAST(P3)),0,-BARSLAST(P3),0,COLORGREEN);

P4:=M1>0&&(M1<M2||ISNULL(M2))&&(TIME>=0030||TIME<0430)&&CROSS(COUNT(ABS(C-O)<=(H-L)/2,BARSLAST(TIME=0030)+1)=1,0.5);
DRAWLINE(Z1,REF(H,BARSLAST(P4)),Z1,REF(L,BARSLAST(P4)),COLORRED);
DRAWLINE(P4,H,P4,L,COLORRED);
DRAWSL(Z1,REF(H,BARSLAST(P4)),0,-BARSLAST(P4),0,COLORRED);
DRAWSL(Z1,REF(L,BARSLAST(P4)),0,-BARSLAST(P4),0,COLORRED);


Z2:=M2>0&&(M1>M2||ISNULL(M1))&&DATE<>REFX(DATE,1);
Q1:=M2>0&&(M1>M2||ISNULL(M1))&&TIME>=1100&&TIME<1430&&CROSS(COUNT(ABS(C-O)<=(H-L)/2,BARSLAST(TIME=1100)+1)=1,0.5);
DRAWLINE(Z2,REF(H,BARSLAST(Q1)),Z2,REF(L,BARSLAST(Q1)),COLORYELLOW);
DRAWLINE(Q1,H,Q1,L,COLORYELLOW);
DRAWSL(Z2,REF(H,BARSLAST(Q1)),0,-BARSLAST(Q1),0,COLORYELLOW);
DRAWSL(Z2,REF(L,BARSLAST(Q1)),0,-BARSLAST(Q1),0,COLORYELLOW);

Q2:=M2>0&&(M1>M2||ISNULL(M1))&&TIME>=1800&&TIME<2030&&CROSS(COUNT(ABS(C-O)<=(H-L)/2,BARSLAST(TIME=1800)+1)=1,0.5);
DRAWLINE(Z2,REF(H,BARSLAST(Q2)),Z2,REF(L,BARSLAST(Q2)),COLORBLUE);
DRAWLINE(Q2,H,Q2,L,COLORBLUE);
DRAWSL(Z2,REF(H,BARSLAST(Q2)),0,-BARSLAST(Q2),0,COLORBLUE);
DRAWSL(Z2,REF(L,BARSLAST(Q2)),0,-BARSLAST(Q2),0,COLORBLUE);

Q3:=M2>0&&(M1>M2||ISNULL(M1))&&(TIME>=2200||TIME<0100)&&CROSS(COUNT(ABS(C-O)<=(H-L)/2,BARSLAST(TIME=2200)+1)=1,0.5);
DRAWLINE(Z2,REF(H,BARSLAST(Q3)),Z2,REF(L,BARSLAST(Q3)),COLORGREEN);
DRAWLINE(Q3,H,Q3,L,COLORGREEN);
DRAWSL(Z2,REF(H,BARSLAST(Q3)),0,-BARSLAST(Q3),0,COLORGREEN);
DRAWSL(Z2,REF(L,BARSLAST(Q3)),0,-BARSLAST(Q3),0,COLORGREEN);

Q4:=M2>0&&(M1>M2||ISNULL(M1))&&(TIME>=0130||TIME<0530)&&CROSS(COUNT(ABS(C-O)<=(H-L)/2,BARSLAST(TIME=0130)+1)=1,0.5);
DRAWLINE(Z2,REF(H,BARSLAST(Q4)),Z2,REF(L,BARSLAST(Q4)),COLORRED);
DRAWLINE(Q4,H,Q4,L,COLORRED);
DRAWSL(Z2,REF(H,BARSLAST(Q4)),0,-BARSLAST(Q4),0,COLORRED);
DRAWSL(Z2,REF(L,BARSLAST(Q4)),0,-BARSLAST(Q4),0,COLORRED);

Z31:=ISLASTBAR&&M1>0&&(M1<M2||ISNULL(M2))&&BARSLAST(P1)<DAYBARPOS;
DRAWLINE(Z31,REF(H,BARSLAST(P1)),Z31,REF(L,BARSLAST(P1)),COLORYELLOW);
DRAWLINE(P1,H,P1,L,COLORYELLOW);
DRAWSL(Z31,REF(H,BARSLAST(P1)),0,-BARSLAST(P1),0,COLORYELLOW);
DRAWSL(Z31,REF(L,BARSLAST(P1)),0,-BARSLAST(P1),0,COLORYELLOW);

Z32:=ISLASTBAR&&M1>0&&(M1<M2||ISNULL(M2))&&BARSLAST(P2)<DAYBARPOS;
DRAWLINE(Z32,REF(H,BARSLAST(P2)),Z32,REF(L,BARSLAST(P2)),COLORBLUE);
DRAWLINE(P2,H,P2,L,COLORBLUE);
DRAWSL(Z32,REF(H,BARSLAST(P2)),0,-BARSLAST(P2),0,COLORBLUE);
DRAWSL(Z32,REF(L,BARSLAST(P2)),0,-BARSLAST(P2),0,COLORBLUE);

Z33:=ISLASTBAR&&M1>0&&(M1<M2||ISNULL(M2))&&BARSLAST(P3)<DAYBARPOS;
DRAWLINE(Z33,REF(H,BARSLAST(P3)),Z33,REF(L,BARSLAST(P3)),COLORGREEN);
DRAWLINE(P3,H,P3,L,COLORGREEN);
DRAWSL(Z33,REF(H,BARSLAST(P3)),0,-BARSLAST(P3),0,COLORGREEN);
DRAWSL(Z33,REF(L,BARSLAST(P3)),0,-BARSLAST(P3),0,COLORGREEN);

Z34:=ISLASTBAR&&M1>0&&(M1<M2||ISNULL(M2))&&BARSLAST(P4)<DAYBARPOS;
DRAWLINE(Z34,REF(H,BARSLAST(P4)),Z34,REF(L,BARSLAST(P4)),COLORRED);
DRAWLINE(P4,H,P4,L,COLORRED);
DRAWSL(Z34,REF(H,BARSLAST(P4)),0,-BARSLAST(P4),0,COLORRED);
DRAWSL(Z34,REF(L,BARSLAST(P4)),0,-BARSLAST(P4),0,COLORRED);

Z41:=ISLASTBAR&&M2>0&&(M1>M2||ISNULL(M1))&&BARSLAST(Q1)<DAYBARPOS;
DRAWLINE(Z41,REF(H,BARSLAST(Q1)),Z41,REF(L,BARSLAST(Q1)),COLORYELLOW);
DRAWLINE(Q1,H,Q1,L,COLORYELLOW);
DRAWSL(Z41,REF(H,BARSLAST(Q1)),0,-BARSLAST(Q1),0,COLORYELLOW);
DRAWSL(Z41,REF(L,BARSLAST(Q1)),0,-BARSLAST(Q1),0,COLORYELLOW);

Z42:=ISLASTBAR&&M2>0&&(M1>M2||ISNULL(M1))&&BARSLAST(Q2)<DAYBARPOS;
DRAWLINE(Z42,REF(H,BARSLAST(Q2)),Z42,REF(L,BARSLAST(Q2)),COLORBLUE);
DRAWLINE(Q2,H,Q2,L,COLORBLUE);
DRAWSL(Z42,REF(H,BARSLAST(Q2)),0,-BARSLAST(Q2),0,COLORBLUE);
DRAWSL(Z42,REF(L,BARSLAST(Q2)),0,-BARSLAST(Q2),0,COLORBLUE);

Z43:=ISLASTBAR&&M2>0&&(M1>M2||ISNULL(M1))&&BARSLAST(Q3)<DAYBARPOS;
DRAWLINE(Z43,REF(H,BARSLAST(Q3)),Z43,REF(L,BARSLAST(Q3)),COLORGREEN);
DRAWLINE(Q3,H,Q3,L,COLORGREEN);
DRAWSL(Z43,REF(H,BARSLAST(Q3)),0,-BARSLAST(Q3),0,COLORGREEN);
DRAWSL(Z43,REF(L,BARSLAST(Q3)),0,-BARSLAST(Q3),0,COLORGREEN);

Z44:=ISLASTBAR&&M2>0&&(M1>M2||ISNULL(M1))&&BARSLAST(Q4)<DAYBARPOS;
DRAWLINE(Z44,REF(H,BARSLAST(Q4)),Z44,REF(L,BARSLAST(Q4)),COLORRED);
DRAWLINE(Q4,H,Q4,L,COLORRED);
DRAWSL(Z44,REF(H,BARSLAST(Q4)),0,-BARSLAST(Q4),0,COLORRED);
DRAWSL(Z44,REF(L,BARSLAST(Q4)),0,-BARSLAST(Q4),0,COLORRED);