以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [求助]老师请问下这个问题在哪?  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=86132)

--  作者:xhqvv
--  发布时间:2015/10/13 14:34:31
--  [求助]老师请问下这个问题在哪?
MID :=  MA(ref(CLOSE,1),26);
UPPER:= MID + 2*STD(ref(CLOSE,1),26);
LOWER:= MID - 2*STD(ref(CLOSE,1),26);
lc:=ref(CLOSE,1);
high1:=ref(high,1);
low1:=ref(low,1);
   if holding=0 then BEGIN 
  
      if lc>UPPER then
 sell(holding>0,0,LIMITr,open); 
 BUYSHORT(holding=0,1,limitr,open);
 if lc<LOWER then
 sellshort(holding<0,0,LIMITR,open);
 buy(holding=0,1,LIMITR,open);
   end

 if (enterbars=1) then begin
highafterentry:=enterprice;
lowafterentry:=enterprice;
end  else if (enterbars>1) then begin
highafterentry:=max(highafterentry,high1);
lowafterentry:=min(lowafterentry,low1);
    end
    
    if (holding>0 and enterbars>0 ) Then Begin 
     stopline:=enterprice*0.98;
         if max(h,highafterentry)-enterprice>0.02*open  then
 stopline:=enterprice+0.02*open;     
 if h>stopline then
 sell(holding>0,0,LIMITr,stopline);      
end
if (holding<0 and enterbars>0 ) Then  Begin 
 stopline:=enterprice*1.02;
 if enterprice-min(l,lowafterentry)>0.02*open  then 
 stopline:=enterprice-0.02*open;  
 
 if l<stopline then
 sellshort(holding<0,0,LIMITR,stopline);  
end

老师请问下 这个代码 哪里有问题 就是价格高于 boll上轨做空  低于下轨最多 
   然后最大亏损2%  如果触发最大盈利2% 就主动止盈

--  作者:xhqvv
--  发布时间:2015/10/13 14:37:21
--  
老师请问下 这个代码 哪里有问题 就是价格高于 boll上轨做空  低于下轨做多 
   然后最大亏损2%  如果触发最大盈利2% 就主动止盈  
  麻烦老师指导下 要怎么写 改进

--  作者:jinzhe
--  发布时间:2015/10/13 14:47:38
--  
固定止盈止损的,可以参考软件自带的范例
图片点击可在新窗口打开查看此主题相关图片如下:1.png
图片点击可在新窗口打开查看

--  作者:xhqvv
--  发布时间:2015/10/13 16:46:54
--  
D为什么是 专用特色指标 ?
--  作者:jinzhe
--  发布时间:2015/10/13 16:49:21
--  
你那里没有吗?
--  作者:xhqvv
--  发布时间:2015/10/13 16:58:46
--  
嗯 没有这个模块!
--  作者:xhqvv
--  发布时间:2015/10/13 17:06:33
--  
找了一台电脑重装 但是 范例里面 用了 if   c-avgenterprice>50*mindiff  then begin
    sell(1,holding,market);
  但是这样的止盈 测试下来 用了次周期开盘价 实际我是需要 当K线触发止盈 这样的话需要怎么写 ?

--  作者:jinzhe
--  发布时间:2015/10/13 17:27:02
--  
这样写是对的,market只表示价格不表示下时间,你要即时触发,在图表交易里面设置为固定轮询模式,轮询间隔1秒