金字塔决策交易系统

 找回密码
 

微信登录

微信扫一扫,快速登录

搜索
查看: 1118|回复: 2

请教老师

[复制链接]

34

主题

173

帖子

173

积分

Rank: 2

等级: 标准版

注册:
2023-10-17
曾用名:
发表于 2024-7-31 16:50 | 显示全部楼层 |阅读模式
老师您好,能否把下列代码到15跳回撤30%平仓,改为每到X跳回撤Y%+X%平仓,举例每间隔10跳回撤百分比上降10%(初始回撤值为70%),也就是10跳时回撤到7跳就平仓,20跳时回撤到16跳平仓,30跳时回撤27跳平仓,40跳时直接平仓,不达到阈值按前一个参数来判断。
[PEL] 复制代码
h1:=hhv(h,enterbars+1);//开仓后最高价
l1:=llv(l,enterbars+1);
 
maxprofit:=if(holding>0,h1-avgenterprice,avgenterprice-l1);//开仓后最大盈利(价差)
currentprofit:=if(holding>0,c-avgenterprice,avgenterprice-c);//当前浮动盈亏(价差)
 
if maxprofit>=15*mindiff and  currentprofit<maxprofit*0.7 and enterbars>=0 then
begin
zyd:sell(1,holding,market);
zyk:sellshort(1,holding,market);        
end

回复

使用道具 举报

44

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
发表于 2024-7-31 16:54 | 显示全部楼层
if maxprofit>=10*mindiff and  currentprofit<maxprofit*0.7 and enterbars>=0 then
begin
sell(1,holding,market);
sellshort(1,holding,market);      
end

if maxprofit>=20*mindiff and  currentprofit<maxprofit*0.8 and enterbars>=0 then
begin
sell(1,holding,market);
sellshort(1,holding,market);      
end

if maxprofit>=30*mindiff and  currentprofit<maxprofit*0.9 and enterbars>=0 then
begin
sell(1,holding,market);
sellshort(1,holding,market);      
end

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

使用道具 举报

34

主题

173

帖子

173

积分

Rank: 2

等级: 标准版

注册:
2023-10-17
曾用名:
 楼主| 发表于 2024-7-31 17:46 | 显示全部楼层
谢谢老师
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-23 16:02 , Processed in 0.076743 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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