金字塔决策交易系统

 找回密码
 

微信登录

微信扫一扫,快速登录

搜索
查看: 3632|回复: 4

两次交易不干扰

[复制链接]

69

主题

238

帖子

248

积分

Rank: 2

等级: 标准版

注册:
2022-6-27
曾用名:
发表于 2022-8-11 18:43 | 显示全部楼层 |阅读模式
请问老师想要实现,网格交易开平仓在有趋势单的情况下不交易。趋势交易优先。如何实现
//开平仓
if 突破开多平空条件 then begin
   sellshort(holding<0,holding,thisclose);
趋势多:buy(holding=0,手数,thisclose);
   end

if 突破开空平多条件 then begin
   sell(holding>0,holding,thisclose);
趋势空:buyshort(holding=0,手数,thisclose);
   end


//***********************************************
//网格交易
//开平仓
if 网格开多条件 and not(趋势空) then begin
   sellshort(holding<0,holding,thisclose);
网格多:buy(holding=0,手数,thisclose);
   end

if 网格开空条件 and not(趋势多) then begin
   sell(holding>0,holding,thisclose);
网格空:buyshort(holding=0,手数,thisclose);
   end

回复

使用道具 举报

0

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
gxx978
发表于 2022-8-12 08:36 | 显示全部楼层
1、你这是加载在两个窗口的策略?每个窗口都是单独计算的,如果你要判断的另一个策略的计算情况的话,那可以使用stkindiex获取趋势策略的holding来作为网格策略的开平仓条件,主要趋势策略加载的K线数量和引用的数据量一致的。
2、如果在一个策略里面,那比较好控制,直接加上条件判断下就可以了。
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

69

主题

238

帖子

248

积分

Rank: 2

等级: 标准版

注册:
2022-6-27
曾用名:
 楼主| 发表于 2022-8-12 11:34 | 显示全部楼层
技术010 发表于 2022-8-12 08:36
1、你这是加载在两个窗口的策略?每个窗口都是单独计算的,如果你要判断的另一个策略的计算情况的话,那可 ...

加载在一个窗口的一个策略
回复

使用道具 举报

69

主题

238

帖子

248

积分

Rank: 2

等级: 标准版

注册:
2022-6-27
曾用名:
 楼主| 发表于 2022-8-12 11:35 | 显示全部楼层
技术010 发表于 2022-8-12 08:36
1、你这是加载在两个窗口的策略?每个窗口都是单独计算的,如果你要判断的另一个策略的计算情况的话,那可 ...

这样可以吗

//***********************************************

//开平仓
if 突破开多平空条件 then begin
   sellshort(holding<0,holding,thisclose);
   buy(holding=0,手数/2,thisclose);
   end
  
if 突破开空平多条件 then begin
   sell(holding>0,holding,thisclose);
   buyshort(holding=0,手数/2,thisclose);
   end
趋势多:=any(突破开多平空条件,ENTERBARS) and HOLDING>0;
趋势空:=any(突破开空平多条件,ENTERBARS) and HOLDING<0;

//***********************************************

//网格交易条件:
网格开多条件:=filcondwg and cross(c,bkprice)  and t1;
网格开空条件:=filcondwg and cross(skprice,c) and t1;

网格平多条件:=cross(c,midprice) and not(趋势多) and holding>0;
网格平空条件:=cross(midprice,c) and not(趋势空) and holding<0;

//***********************************************
//网格交易
//开平仓
if 网格开多条件 and not(趋势空) then begin
   sellshort(holding<0,holding,thisclose);
网格多:=buy(holding=0,手数,thisclose);
   end
  
if 网格开空条件 and not(趋势多) then begin
   sell(holding>0,holding,thisclose);
网格空:=buyshort(holding=0,手数,thisclose);
   end
回复

使用道具 举报

44

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-21 09:39 , Processed in 0.116899 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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