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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 加入止损公式一直未能成功,郁闷

   

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


  共有3597人关注过本帖树形打印复制链接

主题:加入止损公式一直未能成功,郁闷

美女呀,离线,留言给我吧!
pyd
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:8439 积分:0 威望:0 精华:0 注册:2014/7/14 13:43:36
  发帖心情 Post By:2015/1/14 13:09:15    Post IP:58.246.57.26[显示全部帖子]


if enterbars=1 and enterprice-l>=5 then sell(holding>0,holding,market);
if enterbars=1 and h-enterprice>=5 then sellshort(holding<0,holding,market);
if enterbars=2 and enterprice-l>=2 then sell(holding>0,holding,market);
if enterbars=2 and h-enterprice>=2 then sellshort(holding<0,holding,market);
if enterbars=3 and enterprice-l>=0 then sell(holding>0,holding,market);
if enterbars=3 and h-enterprice>=0 then sellshort(holding<0,holding,market);

if enterbars=4 and h-enterprice>=0.1*enterprice then sell(holding>0,holding,market);
if enterbars=4 and enterprice-l>=0.1*enterprice then sellshort(holding<0,holding,market);

[此贴子已经被作者于2015/1/14 13:09:27编辑过]

 回到顶部
美女呀,离线,留言给我吧!
pyd
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:8439 积分:0 威望:0 精华:0 注册:2014/7/14 13:43:36
  发帖心情 Post By:2015/1/14 16:29:13    Post IP:58.246.57.26[显示全部帖子]

意思和上周期收盘价先比而不是和开仓价相比止损?

盈利返回10%是指盈利开仓价的10%?


 回到顶部
美女呀,离线,留言给我吧!
pyd
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:8439 积分:0 威望:0 精华:0 注册:2014/7/14 13:43:36
  发帖心情 Post By:2015/1/15 9:29:55    Post IP:58.246.57.26[显示全部帖子]

VARIABLE:n=0,m=0;
buycond:=count(c>o,2)=2;
sellcond:=count(c<o,2)=2;
c1:VALUEWHEN(enterbars=1,c);//开仓后下根k的收盘价
c2:VALUEWHEN(enterbars=2,c);//开仓后第二根k的收盘价

if holding>0 and sellcond then sell(1,1,thisclose);
if holding<0 and buycond then sellshort(1,1,thisclose);
if holding=0 and n=0 and buycond then  buy(1,1,thisclose);
if holding=0 and m=0 and sellcond then  buyshort(1,1,thisclose);

 

if enterbars=1 and enterprice-l>=5 then begin
 sell(holding>0,holding,market);
 n:=1;
 end
if enterbars=1 and h-enterprice>=5 then begin
sellshort(holding<0,holding,market);
m:=1;
end

if enterbars=2 and c1-l>=2 then begin
 sell(holding>0,holding,market);
 n:=1;
 end
if enterbars=2 and h-c1>=2 then begin
 sellshort(holding<0,holding,market);
 m:=1;
 end
if enterbars=3 and c2-l>=0 then begin
 sell(holding>0,holding,market);
 n:=1;
 end
if enterbars=3 and h-c2>=0 then begin
sellshort(holding<0,holding,market);
m:=1;
end

if enterbars=4 and h-enterprice>=0.1*enterprice then begin
sell(holding>0,holding,market);
n:=1;
end
if enterbars=4 and enterprice-l>=0.1*enterprice then begin
 sellshort(holding<0,holding,market);
m:=1;
end
if time=CLOSETIME(0) then begin//止损后不开仓第二天再开仓
 n:=0;
 m:=0;
end

[此贴子已经被作者于2015/1/15 9:45:01编辑过]

 回到顶部