金字塔决策交易系统

 找回密码
 

微信登录

微信扫一扫,快速登录

搜索
查看: 394|回复: 7

请老师帮忙写一个策略程序 谢谢

[复制链接]

1

主题

5

帖子

5

积分

Rank: 1

等级: 新手上路

注册:
2025-6-5
曾用名:
发表于 2025-6-11 21:35 | 显示全部楼层 |阅读模式
策略说明:
指定特定品种
时间控制:仅在开盘前10分钟(9:00-9:10)执行开仓
均线计算:采用当日分时均价线
开仓条件:价格在5日均价线上且开盘后在分时均价线上方时间超过5分钟时立即开多。价格在5均价线下方且开盘后在均价线下方时间超过5分钟时立即开空。
当日开仓次数不超过2次,平仓次数无限制。
止损机制:固定50个最小变动单位止损或单一品种总资金损失1%,或移动止损100个最小变动单位。
止盈机制:动态跟踪最高价,当从最高点回撤100最小变动单位止盈,
收盘平仓:每日收盘前5分钟强制平仓所有仓位。

回复

使用道具 举报

44

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
发表于 2025-6-12 09:11 | 显示全部楼层
n1:=todaybar;

dm:=4-INTPART(LOG(C));

结算价:ROUNDS(IF(sum(vol,n1)=0,C,sum(C*vol,n1)/sum(vol,n1)),2+dm),colorred;

cond1:time>130000 and time<131000;
cond2:all(c>结算价,5);
cond3:all(c<结算价,5);
if cond1 and cond2 then
begin
        sellshort(1,holding,marketr);
        buy(holding<=2,1,marketr);
END

if cond1 and cond3 then
begin
        sell(1,holding,marketr);
        buyshort(holding>=-2,1,marketr);
END

if OPENPROFITPER<-1/100 then
begin
        sellshort(1,holding,marketr);
        sell(1,holding,marketr);
END

if openprofit<-100*mindiff*abs(holding) then
begin
                sellshort(1,holding,marketr);
        sell(1,holding,marketr);
END

if hhv(openprofit,enterprice)-OPENPROFIT>100*mindiff*abs(holding) then
begin
                sellshort(1,holding,marketr);
        sell(1,holding,marketr);
END

if time>185500 then begin
                        sellshort(1,holding,marketr);
        sell(1,holding,marketr);
END
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

1

主题

5

帖子

5

积分

Rank: 1

等级: 新手上路

注册:
2025-6-5
曾用名:
 楼主| 发表于 2025-6-12 19:40 | 显示全部楼层
麻烦老师将以上策略转为后台交易策略,谢谢!
回复

使用道具 举报

1

主题

5

帖子

5

积分

Rank: 1

等级: 新手上路

注册:
2025-6-5
曾用名:
 楼主| 发表于 2025-6-12 19:41 | 显示全部楼层
技术008 发表于 2025-6-12 09:11
n1:=todaybar;

dm:=4-INTPART(LOG(C));


麻烦老师将以上策略转为后台交易策略,谢谢!
回复

使用道具 举报

1

主题

5

帖子

5

积分

Rank: 1

等级: 新手上路

注册:
2025-6-5
曾用名:
 楼主| 发表于 2025-6-12 21:05 | 显示全部楼层
麻烦老师看下 这个回测报告中  开仓后立马平仓 好像有点奇怪

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号? 微信登录

x
回复

使用道具 举报

44

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
发表于 2025-6-13 09:04 | 显示全部楼层
n1:=todaybar;

dm:=4-INTPART(LOG(C));

结算价:ROUNDS(IF(sum(vol,n1)=0,C,sum(C*vol,n1)/sum(vol,n1)),2+dm),colorred;

cond1:time>130000 and time<131000;
cond2:all(c>结算价,5);
cond3:all(c<结算价,5);
if cond1 and cond2 then
begin
        sellshort(1,holding,marketr);
        buy(holding<=2,1,marketr);
END

if cond1 and cond3 then
begin
        sell(1,holding,marketr);
        buyshort(holding>=-2,1,marketr);
END

if OPENPROFITPER<-1/100 and enterbars>0 then
begin
        sellshort(1,holding,marketr);
        sell(1,holding,marketr);
END

if openprofit<-100*mindiff*abs(holding) and enterbars>0 then
begin
                sellshort(1,holding,marketr);
        sell(1,holding,marketr);
END

if hhv(openprofit,enterprice)-OPENPROFIT>100*mindiff*abs(holding) and enterbars>0 then
begin
                sellshort(1,holding,marketr);
        sell(1,holding,marketr);
END

if time>185500 then begin
                        sellshort(1,holding,marketr);
        sell(1,holding,marketr);
END
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

1

主题

5

帖子

5

积分

Rank: 1

等级: 新手上路

注册:
2025-6-5
曾用名:
 楼主| 发表于 2025-6-13 11:41 | 显示全部楼层
老师好  好像还是对不上

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号? 微信登录

x
回复

使用道具 举报

44

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
发表于 2025-6-13 13:14 | 显示全部楼层
n1:=todaybar;

dm:=4-INTPART(LOG(C));

结算价:ROUNDS(IF(sum(vol,n1)=0,C,sum(C*vol,n1)/sum(vol,n1)),2+dm),colorred;

cond1:time>130000 and time<131000;
cond2:all(c>结算价,5);
cond3:all(c<结算价,5);
if cond1 and cond2 then
begin
        sellshort(1,holding,marketr);
        buy(holding<=2,1,marketr);
END

if cond1 and cond3 then
begin
        sell(1,holding,marketr);
        buyshort(holding>=-2,1,marketr);
END

if OPENPROFITPER<-1 and enterbars>0 then
begin
        p1:sellshort(1,holding,marketr);
        p2:sell(1,holding,marketr);
END
条件:openprofit;
if openprofit<-100*mindiff*abs(holding) and enterbars>0 then
begin
                p3:sellshort(1,holding,marketr);
        p4:sell(1,holding,marketr);
END

if hhv(openprofit,enterbars)-OPENPROFIT>100*mindiff*abs(holding) and enterbars>0 then
begin
                p5:sellshort(1,holding,marketr);
        p6:sell(1,holding,marketr);
END

if time>185500 then begin
                        sellshort(1,holding,marketr);
        sell(1,holding,marketr);
END



每个交易语句前面加上标记变量,然后通过图上去观察信号,如果遇到信号不匹配去输出条件去进行分析


程序化自己是必须要会看懂代码和进行调试的,如果自己一点都不能看和分析,那么是没办法使用的最后
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-6 19:43 , Processed in 0.122798 second(s), 22 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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