金字塔决策交易系统

 找回密码
 

微信登录

微信扫一扫,快速登录

搜索
查看: 2118|回复: 1

麻烦老师帮写一下止盈止损

[复制链接]

16

主题

95

帖子

95

积分

Rank: 2

等级: 标准版

注册:
2022-11-14
曾用名:
发表于 2023-12-10 13:43 | 显示全部楼层 |阅读模式
多头止损条件:开仓价反向波动超过REF(0.5*ATR,1);
止盈条件:开仓价+REF(1*ATR,1);  平掉一半仓位,同时按此时的成本价设置保本清仓条件
剩下的一半仓位按  开仓价+REF(1.5*ATR,1)   平掉40%。 开仓价+REF(2*ATR,1)   再平掉30%。开仓价+REF(2.5*ATR,1)   再平掉20%。剩下的满足条件A   清仓



补充内容 (2023-12-11 08:40):
ATR取跨周期调用日线周期的ATR值
回复

使用道具 举报

21

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
FireScript
发表于 2023-12-11 09:25 | 显示全部楼层
atr:"atr.atr##day";//前一个日线的atr,可自行调整atr调用




if c>=tenterprice+atr  and   holding=tentervol then 止盈1:sell(1,50%,market);
if c>=tenterprice+atr*1.5 and holding=0.5*tentervol then 止盈2:sell(1,(tentervol/2)*0.4,market);
if c>=tenterprice+atr*2  and  holding<=0.3*tentervol then 止盈3:sell(1,(tentervol/2)*0.3,market);
if c>=tenterprice+atr*2.5 and holding<=0.1*tentervol then 止盈4:sell(1,(tentervol/2)*0.2,market);

if  a then sell(1,holding,market);//满足条件a直接全部清仓

if c<tenterprice and holding<tentervol then 止损:sell(1,holding,market);//止盈一次后才能触发这个止损,否则无法触发
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-8-2 22:31 , Processed in 0.096852 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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