金字塔决策交易系统

 找回密码
 

微信登录

微信扫一扫,快速登录

搜索
查看: 5305|回复: 15

两个条件同时满足买空,平仓的条件按照止损移动止盈来执行。

[复制链接]

4603

主题

4688

帖子

4713

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
发表于 2022-12-15 10:45 | 显示全部楼层 |阅读模式
请教:CCi指标向上突破100,且27日线向上,两个指标同时满足的话,买多,Cci指标向下突破-100同时27日线向下,两个条件同时满足买空,平仓的条件按照止损移动止盈来执行
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

21

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
FireScript
发表于 2022-12-15 11:14 | 显示全部楼层
cci:"cci.cci";

ma27:ma(c,27);
up:ma27>ref(ma27,1);
down:ma27<ref(ma27,1);

kd:cci>100 and up;
kk:cci<-100 and down;



variable:maxprofit=0;//有仓位时最大获利幅度
//开仓
if kd and holding=0 then
begin
buy(1,1,marketr);
maxprofit:=0;
end


if  kk and holding=0  then
begin
buyshort(kk and holding=0,1,marketR);
maxprofit:=0;
end


//移动止盈和固定止损部分
//判断当前持仓状态下的最大盈利
win:=0;
win2:=0;
if holding > 0 and enterbars > 0 then
begin
  win:=(c-enterprice)/enterprice*100; //记录最大盈利
  if win>maxprofit then
    maxprofit:=win;

  win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度
end
if holding < 0 and enterbars > 0 then
begin
  win:=(enterprice-c)/enterprice*100; //记录最大盈利
  if win > maxprofit then
    maxprofit:=win;

win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度
end
//出现浮动亏损比如2%平仓
多止损:sell(win < -2,0,limitr,c);

//出现最高盈利后,回落到盈利的60%平仓出场
多止赢:sell(win2 >= 60 and openprofit > 0, 0,limitr,c);


//出现浮动亏损比如2%平仓
空止损:sellshort(win < -2,0,limitr,c);
//出现最高盈利后,回落到盈利的60%平仓出场
空止赢:sellshort(win2 >= 60 and openprofit > 0, 0,limitr,c);
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

0

主题

11

帖子

21

积分

Rank: 2

等级: 标准版

注册:
2022-6-27
曾用名:
发表于 2022-12-15 12:08 来自手机 | 显示全部楼层
这个复制粘贴上去就可以用了吗?
回复

使用道具 举报

21

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

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

使用道具 举报

0

主题

11

帖子

21

积分

Rank: 2

等级: 标准版

注册:
2022-6-27
曾用名:
发表于 2022-12-15 14:47 来自手机 | 显示全部楼层
买多少手怎么没看到啊
回复

使用道具 举报

0

主题

11

帖子

21

积分

Rank: 2

等级: 标准版

注册:
2022-6-27
曾用名:
发表于 2022-12-15 14:59 来自手机 | 显示全部楼层
老师修改手数在哪啊?
回复

使用道具 举报

21

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
FireScript
发表于 2022-12-15 15:00 | 显示全部楼层
input:ss(1,1,100,1);
cci:"cci.cci";

ma27:ma(c,27);
up:ma27>ref(ma27,1);
down:ma27<ref(ma27,1);

kd:cci>100 and up;
kk:cci<-100 and down;



variable:maxprofit=0;//有仓位时最大获利幅度
//开仓
if kd and holding=0 then
begin
buy(1,ss,marketr);
maxprofit:=0;
end


if  kk and holding=0  then
begin
buyshort(kk and holding=0,ss,marketR);
maxprofit:=0;
end


//移动止盈和固定止损部分
//判断当前持仓状态下的最大盈利
win:=0;
win2:=0;
if holding > 0 and enterbars > 0 then
begin
  win:=(c-enterprice)/enterprice*100; //记录最大盈利
  if win>maxprofit then
    maxprofit:=win;

  win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度
end
if holding < 0 and enterbars > 0 then
begin
  win:=(enterprice-c)/enterprice*100; //记录最大盈利
  if win > maxprofit then
    maxprofit:=win;

win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度
end
//出现浮动亏损比如2%平仓
多止损:sell(win < -2,0,limitr,c);

//出现最高盈利后,回落到盈利的60%平仓出场
多止赢:sell(win2 >= 60 and openprofit > 0, 0,limitr,c);


//出现浮动亏损比如2%平仓
空止损:sellshort(win < -2,0,limitr,c);
//出现最高盈利后,回落到盈利的60%平仓出场
空止赢:sellshort(win2 >= 60 and openprofit > 0, 0,limitr,c);
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

0

主题

11

帖子

21

积分

Rank: 2

等级: 标准版

注册:
2022-6-27
曾用名:
发表于 2022-12-15 15:56 来自手机 | 显示全部楼层
谢啦
回复

使用道具 举报

0

主题

11

帖子

21

积分

Rank: 2

等级: 标准版

注册:
2022-6-27
曾用名:
发表于 2022-12-16 09:17 来自手机 | 显示全部楼层
老师早,浮动亏损2%是保证金的2%还是此商品价格的2%啊
回复

使用道具 举报

21

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-9 10:33 , Processed in 0.164182 second(s), 22 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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