金字塔决策交易系统

 找回密码
 

微信登录

微信扫一扫,快速登录

搜索
查看: 963|回复: 1

想编一个反手开仓的代码

[复制链接]

10

主题

38

帖子

38

积分

Rank: 1

等级: 新手上路

注册:
2024-8-11
曾用名:
发表于 2024-8-14 12:02 | 显示全部楼层 |阅读模式
尊敬的技术:
请问下如何编一个无论盈利和亏损都止盈和止损后反向开仓的代码:
然后开新仓后不断循环止盈和止损条件。以下参考:
pd1:=c>enterprice*(1+0.01*Profit) ;
pk1:=c<enterprice*(1-0.01*Profit) ;
pd2:=c<enterprice*(1-0.01*x) ;
pk2:=c>enterprice*(1+0.01*x) ;
kd2:=ref(??);
kk2:=ref(??);
pd3:=c>enterprice*(1+0.01*Profit) or c<enterprice*(1-0.01*x) ;
pk3:=c<enterprice*(1-0.01*Profit) or c>enterprice*(1+0.01*x) ;

或者帮我检查下哪里不对吗?
感谢技术支持!
回复

使用道具 举报

44

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
发表于 2024-8-14 12:59 | 显示全部楼层
if close>enterprice and holding>=0 then
begin
        sell(1,holding,marketr);
        buyshort(1,1,marketr);
end

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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-22 23:59 , Processed in 0.207394 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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