金字塔决策交易系统

 找回密码
 

微信登录

微信扫一扫,快速登录

搜索
查看: 2953|回复: 15

求助:如何标注高低点的序列数字

[复制链接]

32

主题

1364

帖子

1364

积分

等级: 免费版

注册:
2021-6-5
曾用名:
发表于 2023-5-31 07:43 | 显示全部楼层 |阅读模式
截图202305310549223052.png
截图202305310554031983.png
问题
1 序列i1与i3重叠
2 序列2位置不对

ma10:=ma(c,10);
ma20:=ma(c,20);
majc:=cross(ma10,ma20);
masc:=cross(ma20,ma10);

LEN1:=BARSLAST(majc)+1;
LEN2:=BARSLAST(masc)+1;

redH_location:=HHVBARS(c,len1);
greenL_location:=LLVBARS(c,LEN2);

S1:BACKSET(masc,redH_location+1);
S2:BACKSET(majc,greenL_location+1);

A:DRAWLINE(cross(s1,0),H,cross(s2,0) OR ISLASTBAR,L,0),COLORYELLOW,LINETHICK2;
B:DRAWLINE(cross(s2,0),L,cross(s1,0) OR ISLASTBAR,H,0),COLORwhite,LINETHICK2;

len_5:=SUMBARS(cross(s2,0),1),NODRAW;
len_4:=SUMBARS(cross(s1,0),1);
len_3:=SUMBARS(cross(s2,0),2);
len_2:=SUMBARS(cross(s1,0),2);
len_1:=SUMBARS(cross(s2,0),3);
len_0:=SUMBARS(cross(s1,0),3);

i5:=ref(l,len_5-1),NODRAW;
i4:=ref(h,len_4-1),NODRAW;
i3:=ref(l,len_3-1),NODRAW;
i2:=ref(h,len_2-1),NODRAW;
i1:=ref(l,len_1-1),NODRAW;
i0:=ref(h,len_0-1),NODRAW;


cd1:=i1>i3 and i3>i5 and i0>i2 and i2>i4 and i4<i0 and i1<i0 and i3<i2 and i5<i4;
cd2:=((i3-i2))<((i1-i0))  and ((i3-i2))<((i5-i4));
cd3:=(i0-i5)/i0>=0.005;

cd:cd1 and cd2 and cd3,NODRAW;

DRAWICON(cd and cross(s2,0),h,3);


MA(C,50);
一:cross(s2,0) and i1<i0 ;,NODRAW;
DRAWTEXT(一 ,  (l*0.99995), 'i1'),COLORyellow,LINETHICK6;

二: cross(s1,0) and i0>i1  and i0>i2 and i2>i1 and i2>MA(C,50) ,NODRAW;//and ma(c,10)>ref(ma(c,10),1)  and i2>ma(c,10)and i2>ma(c,20)and ma(c,10)>ma(c,20),
DRAWTEXT(二 ,  (H*1.008), '2'),COLORGREEN,LINETHICK6;

三:cross(s2,0) and i3<i2 and i3<i1 ,NODRAW;
DRAWTEXT(三 ,  L*0.9916, 'i3'),COLORwhite,LINETHICK6;

四:cross(s1,0) and i2<i1 and i2<i0  and i1<i0 and i4<i2{and i4>i3 and i4<i1  },NODRAW;// and i4>ma(c,20)and i4>ma(c,10)and ma(c,20)>ma(c,10)and ma(c,10)>ref(ma(c,10),1)
DRAWTEXT(四 ,  (H*1.008), '4'),COLORCYAN,LINETHICK6;


五:cross(s2,0) and cd,NODRAW;
DRAWTEXT(五 ,  REF(H,1), '五'),COLORCYAN,LINETHICK6;

高低连接用了金字塔模板代码
回复

使用道具 举报

19

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
FireScript
发表于 2023-5-31 09:59 | 显示全部楼层
你这里其实i3和i1 本身就是可能会同时满足的。本身他们条件是没有其他限制保证他们不会一起满足的。


首先我要确认下你的思路:我从你截图(上面最后一张图)标注的来看我理解是:相邻的二组高低点,共四个点。最近的高低点分别比之前的高和低点分别都低。且当前的高点比前面那个低点还要低,就进行标注。此外四个点均值均线之下。是这样的思路吗?




金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

32

主题

1364

帖子

1364

积分

等级: 免费版

注册:
2021-6-5
曾用名:
 楼主| 发表于 2023-5-31 11:52 | 显示全部楼层
技术009 发表于 2023-5-31 09:59
你这里其实i3和i1 本身就是可能会同时满足的。本身他们条件是没有其他限制保证他们不会一起满足的。

最近的高低点分别比之前的高和低点分别都低。且当前的高点比前面那个低点还要低,就进行标注


四个点均值均线之下
i1 i2可以不在均线之下

均线是在没有办法编写实现情况下添加试试的,当MACD零轴使用
这就是五段下跌,i2 i4开空位置
反之为开多位置
回复

使用道具 举报

19

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
FireScript
发表于 2023-5-31 14:07 | 显示全部楼层
在你原先代码基础上不是很好改,很多逻辑控制在序列模式下无法很好实现。所以换成了在逐K下运行的模式,原先高低点的实现还是在序列模式下,其他控制逻辑改到逐K下。

首先新建一个指标GD,这个指标必须设置成 序列模式
[PEL] 复制代码
ma10:=ma(c,10);
ma20:=ma(c,20);
majc:=cross(ma10,ma20);
masc:=cross(ma20,ma10);

LEN1:=BARSLAST(majc)+1;
LEN2:=BARSLAST(masc)+1;

redH_location:=HHVBARS(c,len1);
greenL_location:=LLVBARS(c,LEN2);

S1:BACKSET(masc,redH_location+1);
S2:BACKSET(majc,greenL_location+1);






然后再新建一个调用上面的指标GD的内容,这个指标必须选择逐K模式
[PEL] 复制代码
variable:index:=0;//全局变量记录最近一次标记的数值。如遇到无法连续进行标记情况,全局变量重置为0,标记过程重新开始
s1:"gd.s1";
s2:"gd.s2";

gd:=cross(s1,0);//高点条件
dd:=cross(s2,0);//低点条件
a:drawline(gd,h,cross(s2,0) or islastbar,l,0),coloryellow,linethick2;
b:drawline(dd,l,cross(s1,0) or islastbar,h,0),colorwhite,linethick2;


ma50:ma(c,50);

d_1:=sumbars(dd,1);//前一个低点位置
g_1:=sumbars(gd,1);//前一个高点位置
d_2:=sumbars(dd,2);
g_2:=sumbars(gd,2);


d1:=ref(l,d_1-1),nodraw;
g1:=ref(h,g_1-1),nodraw;
d2:=ref(l,d_2-1),nodraw;
g2:=ref(h,g_2-1),nodraw;



//算法思路是从历史迭代的方式来标记1-4点。每次标记不仅仅要判断当前条件,还要看前一个标记是不是满足条件,比如当前标记为3,前一个位置必须是2。
//如果不满足连续标记的条件,那么则重置这个标记过程,从标记1 重新开始标记
//初始起点选择从第一个低点开始

//第五个点 不影响正常标记的迭代过程,不做变量的迭代
if  (index=4)  and dd   then 
begin 
DRAWICON(1,l,3);
end 


if   index=3 and  gd  then //高点条件满足;前面标记为是3 前提下进行后续的判断
begin
if d1<d2 and g1<g2 and g1<d2 and h<ma50  then 
begin 
index:=4;
drawtext(1, (h*1.008), 'i4',coloryellow,0),linethick6;
end else index:=0;
end 

if  index=2 and dd then 
begin 
if  d1<d2 and d1<g1 and l<ma50 then 
begin  
index:=3;
drawtext(1 ,  (l*0.99995), 'i3',colorgreen,0),linethick6;	
end 
else index:=0;
end 

if  index=1 and gd then 
begin
index:=2;
drawtext(1 ,  (h*1.008), 'i2',colorwhite,0),linethick6;
end 

if  (index=0 or index=4)  and dd   then 
begin 
index:=1;
drawtext(1 ,  (l*0.99995), 'i1',colorred,0),linethick6;	
end 



大体效果:
截图202305311406509106.png
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

32

主题

1364

帖子

1364

积分

等级: 免费版

注册:
2021-6-5
曾用名:
 楼主| 发表于 2023-5-31 17:10 | 显示全部楼层
技术009 发表于 2023-5-31 14:07
在你原先代码基础上不是很好改,很多逻辑控制在序列模式下无法很好实现。所以换成了在逐K下运行的模式,原 ...

谢谢啊
怪不得,这么难,搞了几个月也不行,只能求助
有标准模板了,可以折腾了。
回复

使用道具 举报

32

主题

1364

帖子

1364

积分

等级: 免费版

注册:
2021-6-5
曾用名:
 楼主| 发表于 2023-8-19 15:32 | 显示全部楼层
技术009 发表于 2023-5-31 14:07
在你原先代码基础上不是很好改,很多逻辑控制在序列模式下无法很好实现。所以换成了在逐K下运行的模式,原 ...

if  (index=0 or index=4)  and dd   then
begin
index:=1;
drawtext(1 ,  (l*0.99995), 'i1',colorred,0),linethick6;
end


这里i1能不能改成i0也就是凡是到i5就从i0开始。因为实在是改不了,用AI写代码也不行.

回复

使用道具 举报

32

主题

1364

帖子

1364

积分

等级: 免费版

注册:
2021-6-5
曾用名:
 楼主| 发表于 2023-8-19 16:48 | 显示全部楼层
本帖最后由 技术006 于 2023-8-22 08:21 编辑
pxr019225 发表于 2023-8-19 15:32
if  (index=0 or index=4)  and dd   then
begin
index:=1;

variable index = 0; // 全局变量记录最近一次标记的数值。
s1 = "gd.s1";
s2 = "gd.s2";
gd = cross(s1, 0); // 高点条件
dd = cross(s2, 0); // 低点条件
a = drawline(gd, h, cross(s2, 0) or islastbar, l, 0), coloryellow, linethick2;
b = drawline(dd, l, cross(s1, 0) or islastbar, h, 0), colorwhite, linethick2;
ma50 = ma(c, 50);
d_1 = sumbars(dd, 1); // 前一个低点位置
g_1 = sumbars(gd, 1); // 前一个高点位置
d_2 = sumbars(dd, 2);
g_2 = sumbars(gd, 2);
d1 = ref(l, d_1 - 1), nodraw;
g1 = ref(h, g_1 - 1), nodraw;
d2 = ref(l, d_2 - 1), nodraw;
g2 = ref(h, g_2 - 1), nodraw;


// 第六个点不影响正常标记的迭代过程,不做变量的迭代
if (index == 5) and dd then
    DRAWICON(1, l, 3);


// 标记 5 点
if index == 4 and gd then
    index = 5;


// 标记 4 点
if index == 3 and gd then
begin
    if d1 < d2 and g1 < g2 and g1 < d2 and h < ma50 then
    begin
        index = 4;
        drawtext(1, h * 1.008, '5', coloryellow, 0), linethick6;
    end
    else
        index = 0;
end


// 标记 3 点
if index == 2 and dd then
begin
    if d1 < d2 and d1 < g1 and l < ma50 then
    begin
        index = 3;
        drawtext(1, l * 0.99995, '4', colorgreen, 0), linethick6;
    end
    else
        index = 0;
end


// 标记 2 点
if index == 1 and gd then
begin
    index = 2;
    drawtext(1, h * 1.008, '3', colorwhite, 0), linethick6;
end


// 标记 1 点
if (index == 0 or index == 5) and dd then
begin
    index = 1;
    drawtext(1, l * 0.99995, '0', colorred, 0), linethick6;
end


把这里帮助写下的代码
用AI改成I5为I0的代码,没有成功










回复

使用道具 举报

19

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
FireScript
发表于 2023-8-21 09:58 | 显示全部楼层
本帖最后由 技术009 于 2023-8-21 09:59 编辑

之前不就是四个点嘛。你这个i0 和i5 是从何而来的,又是如何定义的。

你用ai写代码没啥意义的,pel不是那种通用语言,这种ai模型 更适合处理python 等更普适性的语言的代码编写。
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

32

主题

1364

帖子

1364

积分

等级: 免费版

注册:
2021-6-5
曾用名:
 楼主| 发表于 2023-8-21 22:59 | 显示全部楼层
技术009 发表于 2023-8-21 09:58
之前不就是四个点嘛。你这个i0 和i5 是从何而来的,又是如何定义的。

你用ai写代码没啥意义的,pel不是 ...

一直是零到五啊
只是您做的是四个点
i1 i2 i3 i4 然后那个i5 直接循环到i1了
现在就是把i4 直接循环到i1的i1把它更改成i0。
那样就是i0到i5的循环了

自己改了,没有成功,只有请教求助了

variable:index:=0;//全局变量记录最近一次标记的数值。如遇到无法连续进行标记情况,全局变量重置为0,标记过程重新开始
s1:"gd.s1";
s2:"gd.s2";

gd:=cross(s1,0);//高点条件
dd:=cross(s2,0);//低点条件
a:drawline(gd,h,cross(s2,0) or islastbar,l,0),coloryellow,linethick2;
b:drawline(dd,l,cross(s1,0) or islastbar,h,0),colorwhite,linethick2;


ma50:ma(c,50);

d_1:=sumbars(dd,1);//前一个低点位置
g_1:=sumbars(gd,1);//前一个高点位置
d_2:=sumbars(dd,2);
g_2:=sumbars(gd,2);


d1:=ref(l,d_1-1),nodraw;
g1:=ref(h,g_1-1),nodraw;
d2:=ref(l,d_2-1),nodraw;
g2:=ref(h,g_2-1),nodraw;



//算法思路是从历史迭代的方式来标记1-4点。每次标记不仅仅要判断当前条件,还要看前一个标记是不是满足条件,比如当前标记为3,前一个位置必须是2。
//如果不满足连续标记的条件,那么则重置这个标记过程,从标记1 重新开始标记
//初始起点选择从第一个低点开始

//第五个点 不影响正常标记的迭代过程,不做变量的迭代
if  (index=4)  and dd   then
begin
DRAWICON(1,l,3);
end


if   index=3 and  gd  then //高点条件满足;前面标记为是3 前提下进行后续的判断
begin
if d1<d2 and g1<g2 and g1<d2 and h<ma50  then
begin
index:=4;
drawtext(1, (h*1.008), 'i4',coloryellow,0),linethick6;
end else index:=0;
end

if  index=2 and dd then
begin
if  d1<d2 and d1<g1 and l<ma50 then
begin
index:=3;
drawtext(1 ,  (l*0.99995), 'i3',colorgreen,0),linethick6;   
end
else index:=0;
end

if  index=1 and gd then
begin
index:=2;
drawtext(1 ,  (h*1.008), 'i2',colorwhite,0),linethick6;
end

if  (index=0 or index=4)  and dd   then
begin
index:=1;
drawtext(1 ,  (l*0.99995), 'i1',colorred,0),linethick6;
end



drawtext(1 ,  (l*0.99995), 'i1',colorred,0),linethick6; 这里的i1能否改成i0
回复

使用道具 举报

32

主题

1364

帖子

1364

积分

等级: 免费版

注册:
2021-6-5
曾用名:
 楼主| 发表于 2023-8-21 23:04 | 显示全部楼层
pxr019225 发表于 2023-8-21 22:59
一直是零到五啊
只是您做的是四个点
i1 i2 i3 i4 然后那个i5 直接循环到i1了

//如果不满足连续标记的条件,那么则重置这个标记过程,从标记1 重新开始标记

如果不满足连续标记的条件,那么则重置这个标记过程,这里改成从标记0 重新开始标记

//初始起点选择从第一个低点开始

也就是第一个低点开始为i0

补充内容 (2023-8-21 23:27):
i0也可以是第一个高点

补充内容 (2023-8-22 05:12):
cd1:=i1>i3 and i3>i5 and i0>i2 and i2>i4 and i4<i0 and i1<i0 and i3<i2 and i5<i4;
cd2:=((i3-i2))<((i1-i0))  and ((i3-i2))<((i5-i4));
cd3:=(i0-i5)/i0>=0.005;

cd:cd1 and cd2 and cd3,NODRAW;

ii0 和i5 的定义。
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-19 16:20 , Processed in 0.261257 second(s), 25 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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