金字塔决策交易系统

 找回密码
 

微信登录

微信扫一扫,快速登录

搜索
查看: 2533|回复: 2

空头止盈没有发挥作用是哪里写错了吗

[复制链接]

16

主题

95

帖子

95

积分

Rank: 2

等级: 标准版

注册:
2022-11-14
曾用名:
发表于 2023-2-3 11:00 | 显示全部楼层 |阅读模式
空头止盈没有发挥作用是哪里写错了吗
{交易系统}
variable:maxprofit=0;//有仓位时最大获利幅度
平空:SELLSHORT(平空条件  ,手数,MARKET);                  //平空信号
if  开多条件  and holding=0 then
begin
开多:BUY(开多条件 AND HOLDING=0,手数,MARKET);          //开多信号
maxprofit:=0;
end  

平多:SELL(平多条件  ,手数,MARKET);                       //平多信号
if  开空条件  and holding=0 then
begin
开空:BUYSHORT(开空条件 AND HOLDING=0,手数,MARKET);     //开空信号
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 < -1,0,limit,c);

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


回复

使用道具 举报

21

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
FireScript
发表于 2023-2-3 11:03 | 显示全部楼层
你这里是只有平多的。平空的语句没有。
范例里好像是漏掉了2句。你补充上就行了。

//出现浮动亏损比如2%平仓
多止损:SELL(win < -1,0,limit,c);
//出现最高盈利后,回落到盈利的60%平仓出场
多止赢:SELL(win2 >= 35 and openprofit > 0, 0,limit,c);


空止损:SELLSHORT(win < -1,0,limit,c);
空止赢:SELLSHORT(win2 >= 35 and openprofit > 0, 0,limit,c);
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

16

主题

95

帖子

95

积分

Rank: 2

等级: 标准版

注册:
2022-11-14
曾用名:
 楼主| 发表于 2023-2-3 12:03 | 显示全部楼层
技术009 发表于 2023-2-3 11:03
你这里是只有平多的。平空的语句没有。
范例里好像是漏掉了2句。你补充上就行了。

补上就对了,谢谢
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-9 22:12 , Processed in 0.203239 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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