以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [原创]  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=99804)

--  作者:我不是新手
--  发布时间:2016/6/29 15:10:38
--  [原创]
开仓条件:当前价格高与前三根K线的最高价、开多,设置10个点的止损;最新价低于前三根K线的最低价、平仓(不管盈亏),反之开空。
--  作者:jinzhe
--  发布时间:2016/6/29 15:20:58
--  


if h>ref(hhv(h,3),1) then begin
 sellshort(1,0,market);
 buy(holding=0,1,market);
end

if l<ref(llv(l,3),1) then begin
 sell(1,0,market);
 buyshort(holding=0,1,market);
end

if holding>0 and c<enterprice-10 then sell(1,0,market);
if holding<0 and c>enterprice+10 then sellshort(1,0,market);


--  作者:我不是新手
--  发布时间:2016/7/1 14:22:49
--  
老师帮我看看这后台的系统为什么不执行止损呢?思路是这样的:以最新价破前五跟K线的最高价做多,设置4个点止盈、5个点止损,空单反之
图片点击可在新窗口打开查看此主题相关图片如下:9d7dcxge)$%eaced12vda.png
图片点击可在新窗口打开查看


ZH:=\'\';
PZ1:=\'RB10\';

KD:DYNAINFO2(7, PZ1)>ref(hhv(h,5),1);//开多
KK:DYNAINFO2(7, PZ1)<ref(llv(l,5),1);//开空


if  DYNAINFO2(7, PZ1)<=tenterprice-5*MINDIFF then begin//多损
tsell(1,1,MKT,0);
 end;
if  DYNAINFO2(7, PZ1)>=tenterprice+4*MINDIFF then begin//多盈
tsell(1,1,MKT,DYNAINFO2(7, PZ1),0);
end

if DYNAINFO2(7, PZ1)>=tenterprice+5*MINDIFF then begin//空损
tsellshort(1,1,MKT,DYNAINFO2(7, PZ1),0);
end
if DYNAINFO2(7, PZ1)<=tenterprice-4*MINDIFF then begin //空盈
tsellshort(1,1,MKT,DYNAINFO2(7, PZ1),0);
end


if KK and tbuyholdingex(ZH,pz1,0)=0 and tsellholdingex(\'\',pz1,0)=0 then begin//开空
tbuyshort(1,1,MKT,DYNAINFO2(7, PZ1),0);
end

if KD AND tbuyholdingex(\'\',pz1,0)=0 and tsellholdingex(\'\',pz1,0)=0 then begin //开多
tbuy(1,1,MKT,DYNAINFO2(7, PZ1),0);
end

--  作者:jinzhe
--  发布时间:2016/7/1 14:44:15
--  
tsell(1,1,MKT,DYNAINFO2(7, PZ1),0);
这样写要表达什么意思?

--  作者:我不是新手
--  发布时间:2016/7/1 14:52:16
--  
我想表达用最新价下单
--  作者:jinzhe
--  发布时间:2016/7/1 15:15:18
--  

把mkt改成lmt


--  作者:我不是新手
--  发布时间:2016/7/1 15:35:17
--  
把所有的mkt改成lmt  是吧?还是说只改平仓的?
--  作者:jinzhe
--  发布时间:2016/7/1 15:50:07
--  

把你想要最新价下单的,都改成lmt

后台下单,mkt后面是不带参数的

lmt后面才带参数

tbuy(1,1,mkt)或者tbuy(1,1,lmt,c,0)

不能是tbuy(1,1,mkt,close,0)


--  作者:我不是新手
--  发布时间:2016/7/1 16:12:50
--  
ZH:=\'\';
PZ1:=\'M09\';


KD:DYNAINFO2(7, PZ1)>ref(hhv(h,5),1);//?a?à
KK:DYNAINFO2(7, PZ1)<ref(llv(l,5),1);//?a??


if  DYNAINFO2(7, PZ1)<=tenterprice-5*MINDIFF then begin//?à?e
tsell(1,1,LMT,DYNAINFO2(7, PZ1),0);
 end;
if  DYNAINFO2(7, PZ1)>=tenterprice+4*MINDIFF then begin//?àóˉ
tsell(1,1,LMT,DYNAINFO2(7, PZ1),0);
end

if DYNAINFO2(7, PZ1)>=tenterprice+5*MINDIFF then begin//???e
tsellshort(1,1,LMT,DYNAINFO2(7, PZ1),0);
end
if DYNAINFO2(7, PZ1)<=tenterprice-4*MINDIFF then begin //??óˉ
tsellshort(1,1,LMT,DYNAINFO2(7, PZ1),0);
end


if KK and tbuyholdingex(ZH,pz1,0)=0 and tsellholdingex(\'\',pz1,0)=0 then begin//?a??
tbuyshort(1,1,LMT,DYNAINFO2(7, PZ1),0);
end

if KD AND tbuyholdingex(\'\',pz1,0)=0 and tsellholdingex(\'\',pz1,0)=0 then begin //?a?à
tbuy(1,1,LMT,DYNAINFO2(7, PZ1),0);
end


那我这样改可以吗?

--  作者:jinzhe
--  发布时间:2016/7/1 16:19:15
--  
可以