金字塔决策交易系统

 找回密码
 

微信登录

微信扫一扫,快速登录

搜索
查看: 2812|回复: 5

老师看能帮完善一下,改成程序化交易吗?、增加平空反手开多和反手开空??

[复制链接]

4

主题

6

帖子

6

积分

Rank: 1

等级: 新手上路

注册:
2021-10-30
曾用名:
发表于 2021-10-30 14:01 | 显示全部楼层 |阅读模式

开始:OPEN;VAR2:=EMA(CLOSE,120);
VAR3:=(CLOSE-VAR2)*2/(120+1)+VAR2;
生命线:=VAR3,LINETHICK2,COLORRED;
XCLOSE2:=EMA((OPEN+HIGH+LOW+CLOSE)/4,3);
//PARTLINE1((生命线>=XCLOSE2),生命线),LINETHICK2,COLORGREEN;
//PARTLINE1((生命线<XCLOSE2),生命线),LINETHICK2,COLORRED;
MA3:=MA(C,170);
HH1:=IFELSE(H<REF(H,1)&&REF(H,1)<REF(H,2),REF(H,2),0);
LL1:=IFELSE(L>REF(L,1)&&REF(L,1)>REF(L,2),REF(L,2),0);
HH2:=VALUEWHEN(HH1>0,HH1);
LL2:=VALUEWHEN(LL1>0,LL1);
HH:=HHV(HIGH,1)/10+HHV(HIGH,2)/10+HHV(HIGH,2)/10+HHV(HIGH,4)/10+HHV(HIGH,4)/10+HHV(HIGH,8)/10+HHV(HIGH,8)/10+HHV(HIGH,13)/10+HHV(HIGH,40)/10+HHV(HIGH,20)/10;
LL:=LLV(LOW,1)/10+LLV(LOW,2)/10+LLV(LOW,2)/10+LLV(LOW,4)/10+LLV(LOW,4)/10+LLV(LOW,8)/10+LLV(LOW,8)/10+LLV(LOW,13)/10+LLV(LOW,40)/10+LLV(LOW,20)/10;
H1:=IFELSE(HH<REF(HH,1)&&LL<REF(LL,1)&&REF(OPEN,1)>CLOSE&&OPEN>CLOSE&&(HHV(OPEN,0)-CLOSE)>0,REF(HH,2),0);
L1:=IFELSE(LL>REF(LL,1)&&HH>REF(HH,1)&&REF(OPEN,1)<CLOSE&&OPEN<CLOSE&&(CLOSE-LLV(OPEN,0))>0,REF(LL,2),0);
X:=DATE;
X0:=H1,LINETHICK2;
X00:=L1;
XXX0:=O,LINETHICK2;
XXX00:=C;
XXX000:=H;
XXX0000:=L;
H2:=VALUEWHEN(X0>0,X0),LINETHICK2;
L2:=VALUEWHEN(X00>0,X00),LINETHICK2;
K1:=IFELSE(CLOSE>H2,-3,IFELSE(CLOSE<L2,1,0));
K2:=VALUEWHEN(K1<>0,K1);
G:=IFELSE(K2=1,H2,L2);
G1:=VALUEWHEN(ISLASTBAR,G);
DRAWNUMBER(L>0,G1,G1,0,COLORCYAN);

X000:=K2,LINETHICK2;
TMP:=K2,LINETHICK2;
W1:=X000,LINETHICK2;
X0000:=OPEN-CLOSE,LINETHICK2;
W2:=X0000,LINETHICK2;
HT:=IFELSE(OPEN>CLOSE,OPEN,CLOSE),LINETHICK2;
LT:=IFELSE(OPEN<CLOSE,OPEN,CLOSE),LINETHICK2;
DRAWLINE(W1=1,XXX000,W1=1,HT,COLORCYAN);//青色上影线
DRAWLINE(W1=1,XXX0000,W1=1,LT,COLORCYAN);//青色下影线
DRAWLINE(W1=-3,XXX000,W1=-3,HT,COLORRED);//红色上影线
DRAWLINE(W1=-3,XXX0000,W1=-3,LT,COLORRED);//红色下影线
STICKLINE(W1>0,XXX0,XXX00,COLORCYAN,1);//青色空心K线
STICKLINE(W1<=0,XXX0,XXX00,COLORRED,1);//红色空心K线
STICKLINE(W2>0&&W1<=0,XXX0,XXX00,COLORRED,0);//红色实心K线
STICKLINE(W2>0&&W1>0,XXX0,XXX00,COLORCYAN,0);//青色实心K线
DRAWLINE(TMP=1&&REF(TMP,1)=1,G,TMP=1&&REF(TMP,1)=1,REF(G,1),COLORCYAN),DOT;//青色折竖线
DRAWLINE(TMP=-3&&REF(TMP,1)=-3,G,TMP=-3&&REF(TMP,1)=-3,REF(G,1),COLORRED),DOT;//红色折竖线
DRAWSL(K2=1,G,0,1,0,COLORCYAN),DOT;//青色折横线
DRAWSL(K2=-3,G,0,1,0,COLORRED),DOT;//红色折横线
DRAWTEXT(CROSS(TMP,0),HH,'空'),COLORGREEN,FONTSIZE25;
DRAWTEXT(CROSS(0,TMP),LL,'多'),FONTSIZE25,VALIGN0;
N3:=BARSLAST(CROSS(W1>0,0.5)),LINETHICK2;
N4:=BARSLAST(CROSS(W1<=0,0.5)),LINETHICK2;
HH3:=IF(W1<=0,REF(HV(H,N4),N3),NULL),COLORYELLOW,DOT;
LL3:=IF(W1>0,REF(LV(L,N3),N4),NULL),COLORGREEN,DOT;
B:=CROSSUP(C,HH3)||REF(ISNULL(HH3),1)&&C>HH3;
S:=CROSSDOWN(C,LL3)||REF(ISNULL(LL3),1)&&C<LL3;

LC:= REF(CLOSE,1),LINETHICK2;
RSI:=SMA(MAX(CLOSE-LC, 0), 6, 1)/SMA(ABS(CLOSE-LC), 6, 1)*100,LINETHICK2;

CROSS(TMP,0),SOUND('A');
CROSS(0,TMP),SOUND('B');
DRAWSL(ISLASTBAR,HHV(H,60),0,-59,0,COLORYELLOW);
DRAWSL(ISLASTBAR,LLV(L,60),0,-59,0,COLORYELLOW);

DRAWSL(ISLASTBAR,HHV(H,60)-(HHV(H,60)-LLV(L,60))*0.168,0,-59,0,COLORYELLOW);
DRAWSL(ISLASTBAR,LLV(L,60)+(HHV(H,60)-LLV(L,60))*0.168,0,-59,0,COLORYELLOW);

DRAWNUMBER(ISLASTBAR,HHV(H,60),HHV(H,60),0,COLORYELLOW);
DRAWNUMBER(ISLASTBAR,LLV(L,60),LLV(L,60),0,COLORYELLOW);

DRAWNUMBER(ISLASTBAR,HHV(H,60)-(HHV(H,60)-LLV(L,60))*0.168,HHV(H,60)-(HHV(H,60)-LLV(L,60))*0.168,0,COLORYELLOW);
DRAWNUMBER(ISLASTBAR,LLV(L,60)+(HHV(H,60)-LLV(L,60))*0.168,LLV(L,60)+(HHV(H,60)-LLV(L,60))*0.168,0,COLORYELLOW);
回复

使用道具 举报

25

主题

66

帖子

66

积分

等级: 免费版

注册:
2021-10-23
曾用名:
发表于 2021-10-31 07:44 来自手机 | 显示全部楼层
这么复杂,看着就眼花
回复

使用道具 举报

4

主题

6

帖子

6

积分

Rank: 1

等级: 新手上路

注册:
2021-10-30
曾用名:
 楼主| 发表于 2021-10-31 09:37 | 显示全部楼层
天道酬勤 发表于 2021-10-31 07:44
这么复杂,看着就眼花

你会编写吗?能不能帮忙
回复

使用道具 举报

34

主题

9006

帖子

5万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
wenarm
发表于 2021-11-1 08:56 | 显示全部楼层
本帖最后由 技术006 于 2021-11-2 08:19 编辑

1.开平仓条件是什么?下面是修改后的代码。你自己可以尝试根据下单函数的说明自行添加试试。
2.REF(ISNULL(LL3),1) 这个在金字塔不需要

[PEL] 复制代码
开始:OPEN;VAR2:=EMA(CLOSE,120);VAR3:=(CLOSE-VAR2)*2/(120+1)+VAR2;
生命线:=VAR3,LINETHICK2,COLORRED;
XCLOSE2:=EMA((OPEN+HIGH+LOW+CLOSE)/4,3);
//PARTLINE1((生命线>=XCLOSE2),生命线),LINETHICK2,COLORGREEN;
//PARTLINE1((生命线<XCLOSE2),生命线),LINETHICK2,COLORRED;
MA3:=MA(C,170);
HH1:=IFELSE(H<REF(H,1) AND REF(H,1)<REF(H,2),REF(H,2),0);
LL1:=IFELSE(L>REF(L,1) AND REF(L,1)>REF(L,2),REF(L,2),0);
HH2:=VALUEWHEN(HH1>0,HH1);
LL2:=VALUEWHEN(LL1>0,LL1);
HH:=HHV(HIGH,1)/10+HHV(HIGH,2)/10+HHV(HIGH,2)/10+HHV(HIGH,4)/10+HHV(HIGH,4)/10+HHV(HIGH,8)/10+HHV(HIGH,8)/10+HHV(HIGH,13)/10+HHV(HIGH,40)/10+HHV(HIGH,20)/10;
LL:=LLV(LOW,1)/10+LLV(LOW,2)/10+LLV(LOW,2)/10+LLV(LOW,4)/10+LLV(LOW,4)/10+LLV(LOW,8)/10+LLV(LOW,8)/10+LLV(LOW,13)/10+LLV(LOW,40)/10+LLV(LOW,20)/10;
H1:=IFELSE(HH<REF(HH,1) AND LL<REF(LL,1) AND REF(OPEN,1)>CLOSE AND OPEN>CLOSE AND (HHV(OPEN,0)-CLOSE)>0,REF(HH,2),0);
L1:=IFELSE(LL>REF(LL,1) AND HH>REF(HH,1) AND REF(OPEN,1)<CLOSE AND OPEN<CLOSE AND (CLOSE-LLV(OPEN,0))>0,REF(LL,2),0);
X:=DATE;
X0:=H1,LINETHICK2;
X00:=L1;
XXX0:=O,LINETHICK2;
XXX00:=C;
XXX000:=H;
XXX0000:=L;
H2:=VALUEWHEN(X0>0,X0),LINETHICK2;
L2:=VALUEWHEN(X00>0,X00),LINETHICK2;
K1:=IFELSE(CLOSE>H2,-3,IFELSE(CLOSE<L2,1,0));
K2:=VALUEWHEN(K1<>0,K1);
G:=IFELSE(K2=1,H2,L2);
G1:=VALUEWHEN(ISLASTBAR,G);
DRAWNUMBER(L>0,G1,G1,0,COLORCYAN);

X000:=K2,LINETHICK2;
TMP:=K2,LINETHICK2;
W1:=X000,LINETHICK2;
X0000:=OPEN-CLOSE,LINETHICK2;
W2:=X0000,LINETHICK2;
HT:=IFELSE(OPEN>CLOSE,OPEN,CLOSE),LINETHICK2;
LT:=IFELSE(OPEN<CLOSE,OPEN,CLOSE),LINETHICK2;
DRAWLINE(W1=1,XXX000,W1=1,HT,COLORCYAN);//青色上影线
DRAWLINE(W1=1,XXX0000,W1=1,LT,COLORCYAN);//青色下影线
DRAWLINE(W1=-3,XXX000,W1=-3,HT,COLORRED);//红色上影线
DRAWLINE(W1=-3,XXX0000,W1=-3,LT,COLORRED);//红色下影线
STICKLINE(W1>0,XXX0,XXX00,COLORCYAN,1);//青色空心K线
STICKLINE(W1<=0,XXX0,XXX00,COLORRED,1);//红色空心K线
STICKLINE(W2>0 AND W1<=0,XXX0,XXX00,COLORRED,0);//红色实心K线
STICKLINE(W2>0 AND W1>0,XXX0,XXX00,COLORCYAN,0);//青色实心K线
DRAWLINE(TMP=1 AND REF(TMP,1)=1,G,TMP=1 AND REF(TMP,1)=1,REF(G,1),COLORCYAN),DOT;//青色折竖线
DRAWLINE(TMP=-3 AND REF(TMP,1)=-3,G,TMP=-3 AND REF(TMP,1)=-3,REF(G,1),COLORRED),DOT;//红色折竖线
DRAWSL(K2=1,G,0,1,0,COLORCYAN),DOT;//青色折横线
DRAWSL(K2=-3,G,0,1,0,COLORRED),DOT;//红色折横线
DRAWTEXT(CROSS(TMP,0),HH,'空',COLORGREEN);
DRAWTEXT(CROSS(0,TMP),LL,'多');
N3:=BARSLAST(CROSS(W1>0,0.5)),LINETHICK2;
N4:=BARSLAST(CROSS(W1<=0,0.5)),LINETHICK2;
HH3:=IF(W1<=0,REF(HHV(H,N4),N3+1),NULL),COLORYELLOW;
LL3:=IF(W1>0,REF(LLV(L,N3),N4+1),NULL),COLORGREEN;
B:=CROSS(C,HH3)  AND C>HH3;
S:=CROSS(LL3,C)  AND C<LL3;

LC:= REF(CLOSE,1),LINETHICK2;
RSI:=SMA(MAX(CLOSE-LC, 0), 6, 1)/SMA(ABS(CLOSE-LC), 6, 1)*100,LINETHICK2;

SPEAK(CROSS(TMP,0)=1 ,'A' );
SPEAK(CROSS(0,TMP)=1 ,'B' );

DRAWSL(ISLASTBAR,HHV(H,60),0,-59,0,COLORYELLOW);
DRAWSL(ISLASTBAR,LLV(L,60),0,-59,0,COLORYELLOW);

DRAWSL(ISLASTBAR,HHV(H,60)-(HHV(H,60)-LLV(L,60))*0.168,0,-59,0,COLORYELLOW);
DRAWSL(ISLASTBAR,LLV(L,60)+(HHV(H,60)-LLV(L,60))*0.168,0,-59,0,COLORYELLOW);

DRAWNUMBER(ISLASTBAR,HHV(H,60),HHV(H,60),0,COLORYELLOW);
DRAWNUMBER(ISLASTBAR,LLV(L,60),LLV(L,60),0,COLORYELLOW);

DRAWNUMBER(ISLASTBAR,HHV(H,60)-(HHV(H,60)-LLV(L,60))*0.168,HHV(H,60)-(HHV(H,60)-LLV(L,60))*0.168,0,COLORYELLOW);
DRAWNUMBER(ISLASTBAR,LLV(L,60)+(HHV(H,60)-LLV(L,60))*0.168,LLV(L,60)+(HHV(H,60)-LLV(L,60))*0.168,0,COLORYELLOW);
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

4

主题

6

帖子

6

积分

Rank: 1

等级: 新手上路

注册:
2021-10-30
曾用名:
 楼主| 发表于 2021-11-1 20:59 | 显示全部楼层
技术006 发表于 2021-11-1 08:56
1.开平仓条件是什么?下面是修改后的代码。你自己可以尝试根据下单函数的说明自行添加试试。
2.REF(ISNULL ...

老师我不会编程,这是我当指标用别人给的,但是我新手还是克服不了心理,所以想尝试程序化,辛苦老师把指标加载在图看一下就明白了开平仓条件,

补充内容 (2021-11-1 21:01):
在图上就一目了然开平仓条件,我只能这么说了我不懂编程
回复

使用道具 举报

34

主题

9006

帖子

5万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
wenarm
发表于 2021-11-2 08:20 | 显示全部楼层
抱歉,必须明确给出开平仓条件。否者我无法帮你添加这部分代码。
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 微信登录

本版积分规则

手机版|小黑屋|上海金之塔信息技术有限公司 ( 沪ICP备13035422号 )

GMT+8, 2024-11-17 07:46 , Processed in 0.256972 second(s), 22 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表