金字塔决策交易系统

 找回密码
 

微信登录

微信扫一扫,快速登录

搜索
查看: 5277|回复: 5

限制交易次数的问题

[复制链接]

232

主题

298

帖子

298

积分

等级: 免费版

注册:
2021-6-3
曾用名:
发表于 2022-6-15 14:56 | 显示全部楼层 |阅读模式
老师 你好
标准版中,希望在某个时间段内限制开仓的次数。如9:00-9:30  最多只能开仓一次。不限制的话,可能会反复开平。

买:buy(time>=130000 and  time<=133000  and   holding=0  and  ?   ,1,LIMITR,CLOSE);

平:sell(c>enterprice+5*mindiff,holding,marketr);

回复

使用道具 举报

21

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
FireScript
发表于 2022-6-15 15:05 | 显示全部楼层
你交易周期是什么周期?
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

232

主题

298

帖子

298

积分

等级: 免费版

注册:
2021-6-3
曾用名:
 楼主| 发表于 2022-6-15 15:48 | 显示全部楼层
你好,是1分钟周期的
回复

使用道具 举报

21

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
FireScript
发表于 2022-6-15 15:57 | 显示全部楼层
这种一般我习惯用全局变量记录:
VARIABLE:ct:=0;
if time=130100 then ct:=0;
if 开仓条件 and time>=130000 and  time<=133000  and   holding=0  and  ct=0 then
begin  
买:buy( ,1,LIMITR,CLOSE);
ct:=1;
end
平:sell(c>enterprice+5*mindiff,holding,marketr);

if time =133000 then ct:=0;

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

使用道具 举报

227

主题

881

帖子

881

积分

等级: 免费版

注册:
2022-4-2
曾用名:
发表于 2023-12-1 08:28 | 显示全部楼层
技术009 发表于 2022-6-15 15:57
这种一般我习惯用全局变量记录:
VARIABLE:ct:=0;
if time=130100 then ct:=0;

请问老师这样写可以吗
VARIABLE:opensnum:=0,addsum:=0;
if date<>ref(date,1) then  opensnum:=0;   
if date<>ref(date,1) then  addsum:=0;  
//开平仓
if 开多条件 and opensnum<1 then begin
   sellshort(holding<0,holding,market);
   buy(holding=0,lots,market);
   opensnum:=1;
   end
//   
if 开空条件 and opensnum<1 then begin
   sell(holding>0,holding,market);
   buyshort(holding=0,lots,market);
   opensnum:=1;
   end


if 加多条件 and addsum<1 then begin
   sellshort(holding<0,holding,market);
   buy(holding>=0,lots,market);
   addsum:=1;
   end
//   
if 加空条件 and addsum<1 then begin
   sell(holding>0,holding,market);
   buyshort(holding<=0,lots,market);
   addsum:=1;
   end
回复

使用道具 举报

21

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
FireScript
发表于 2023-12-1 08:59 | 显示全部楼层
可以。
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-8-2 11:11 , Processed in 0.083705 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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