欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件策略编写求助区 → [求助]求教老师指正止损止盈策略及开仓错误处

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有3974人关注过本帖平板打印复制链接

主题:[求助]求教老师指正止损止盈策略及开仓错误处

帅哥哟,离线,有人找我吗?
利期
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:57 积分:10 威望:0 精华:0 注册:2012/7/5 22:43:11
[求助]求教老师指正止损止盈策略及开仓错误处  发帖心情 Post By:2014/3/13 10:35:23 [只看该作者]

图表交易

参照论坛示例,写了一套止损、止盈策略, 老师们请批改以下策略语法是否正确。
附合多条件开多,但开仓策略错误,导致止盈后符合多条件又开多仓,再止再开,重复轮回,请求正确写法。

variable:maxprofit=0,qc=0;
exittime:=time>=145000;

ND:```````````; 
XD:```````````;

平空开多条件:=ND>XD;
平多开空条件:=ND<XD;

错误策略语句,求助修正。
[
buycond:=count(平空开多条件,0);
if holding=0 and buycond then
 begin 
 buy(1,1,MARKET);
 maxprofit:=0;
 end      
]

//限时清仓
if exittime then begin  
 sell(1,0,MARKET);
 sellshort(1,0,MARKET);
 qc:=0;
end

//多仓止损 
if holding>0 and low<enterprice-3 then sell(1,0,market);

//预设性条件止盈
win:=0;
ht:=0;
if holding > 0 and enterbars > 0 then
begin
 win:=(high-enterprice); //记录多仓浮动盈利
 if win > maxprofit then
  maxprofit:=win;   //最大获利 
 ht:=maxprofit-win; //最大盈利后的回调幅度
end

if maxprofit<3 and holding>0 then
  平多:SELL(平多开空条件,0,market);// 盈利小于3点,采用指标平仓。

if maxprofit>=3 and maxprofit<10 and holding>0 then
  止赢1:SELL(ht<1+0.1*(maxprofit-2),0,market); // 3至10点盈利保护1点几利润盈平

if maxprofit>=10 and maxprofit<20 and holding>0 then
  止赢2:SELL(ht<0.5*maxprofit,0,market);  // 10至20点盈利保50%浮盈利润

if maxprofit>=20 and maxprofit<40 and holding>0 then
  止赢3:SELL(ht<maxprofit-10,0,market); // 20点至40点盈利,浮盈回撤10点

if maxprofit>40 and holding>0 then
  止赢4:SELL(ht<maxprofit-5 or 平多开空条件,0,market);
   // 大于40点盈利,浮盈回撤5点或指标平仓,哪个先达到执行哪个

关于SELL()里面的maxprofit,这里三种用法
{1+0.1*(maxprofit-2)}
{0.5*maxprofit}
{maxprofit-10}
是否正确?为什么要在前面加上“ht<”呢?

另外止盈止损后满足某条件之后重新恢复持仓策略怎么写?
例:即持多仓时,如果止盈(止损)后,趋势没有向空条件发展,在仍然保持多条件情况下,价格重新回调到大于止盈价(止损价)时,重新恢复持多仓。
不可行,即放弃。

请老师帮修改一个上述完整策略。

开平空仓盈损,是否是将上述策略中的low,high和开平空改一下即可?还有什么要改变的吗?

 回到顶部