以文本方式查看主题

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

--  作者:tonybig
--  发布时间:2011/11/3 16:57:42
--  帮忙看下这个问题在哪里

帮忙看下这个问题在哪里 ,越改问题越多,图上好多小白开仓信号,

 

1:希望再帮忙修改每天正反只能个开一次

2:我写的止损条件好像图中显示的并不正确,本来是当开仓价格回碰当天开盘价止损。

万分感谢
runmode:0;

dayopen:=valuewhen(date<>ref(date,1),o);
 
enterlongcond:=high>=dayopen;
entershortcond:=low<=dayopen;

exittime:=time>=1458;

if holding=0 and time>1015 then begin
   if enterlongcond then
   buy(1,1,limitr,close+mindiff);
   if entershortcond then
   buyshort(1,1,limitr,close-mindiff);
end


if holding>0 and time>1015  then begin
   exitlongcond:=enterprice<=dayopen;
   if exitlongcond  then
   sell(1,holding,limitr,dayopen);
  
   if enterlongcond and enterbars>=1 then
   sell(1,holding,limitr,close-mindiff);
   buyshort(1,1,limitr,close-mindiff);

  
   if exittime then
   sell(1,holding,limitr,o);
   end
  
if holding<0 and time>1015 then begin
   exitshortcond:=enterprice>=dayopen;
   if exitshortcond then
    sellshort(1,holding,limitr,dayopen);
  
   if entershortcond and enterbars>=1  then
   sellshort(1,holding,limitr,closse+mindiff);
   buy(1,1,limitr,close+mindiff);
 
  
   if exittime then
   sellshort(1,holding,limitr,o);
   end
/
资产:asset-500000,noaxis,coloryellow,linethick2;
盈亏:(asset-500000)/500000,linethick0;
胜率:PERCENTWIN,linethick0;


--  作者:26327756l
--  发布时间:2011/11/3 17:20:54
--  
你在公式里 语法上使用混乱,我不能猜测你的意图,请自行检查或是将意图用文字表达出来发贴。让网友帮助写一个完整的指标。
--  作者:tonybig
--  发布时间:2011/11/3 17:39:33
--  

设计思路:

 

开仓条件:开盘至10点15之前的高低点作为上下轨,  10点15后如高价突破上轨做多,低价突破下轨做空。   (每天多空开仓只限一次)

止损:开仓价高于当天开盘价,空头止损,  开仓价低于当天开仓价,多头止损。

 

退出: 每天收盘前1分钟平仓。

 

谢谢


--  作者:jinzhe
--  发布时间:2011/11/4 9:41:14
--  
正在写,稍等
--  作者:jinzhe
--  发布时间:2011/11/4 10:22:29
--  

写完了。

 

variable :aa=0,bb=0;

nn:=barslast(date<>ref(date,1));

sg:valuewhen(time<=101500,hhv(h,nn+1));//上轨

xg:valuewhen(time<=101500,llv(l,nn+1));//下轨

jk:ref(o,nn);//今日开盘

aa1:aa,linethick0;
bb1:bb,linethick0;
//10点15后如高价突破上轨做多,低价突破下轨做空(每天多空开仓只限一次)

if time >101500 and h>sg and aa=0 then begin
 sellshort(holding<0,0,thisclose);
 buy(holding=0,1,thisclose);
 aa:=1;
end

if time >101500 and l<xg and bb=0 then begin
 sell(holding>0,0,thisclose);
 buyshort(holding=0,1,thisclose);
 bb:=1;
end

//止损:开仓价高于当天开盘价,空头止损,  开仓价低于当天开仓价,多头止损。


if enterprice>jk then sellshort(holding<0,0,thisclose);

if enterprice<jk then sell(holding>0,0,thisclose);


//退出: 每天收盘前1分钟平仓。

if time>=145900 and time<=150000 then begin

 sellshort(holding<0,0,thisclose);
 sell(holding>0,0,thisclose);
 
end

if time>=150000 then begin
    aa:=0;
    bb:=0;
end


--  作者:tonybig
--  发布时间:2011/11/4 10:36:54
--  

哈哈 万分感谢啊 ,不请客都不好意思了


--  作者:tonybig
--  发布时间:2011/11/4 10:39:15
--  

为啥啊最后  还要写这个?有啥意义?

 

 

if time>=150000 then begin
    aa:=0;
    bb:=0;
end


--  作者:tonybig
--  发布时间:2011/11/4 10:45:52
--  

 还有平仓手数 为啥不填写?

 

sellshort(holding<0,0,thisclose);
 sell(holding>0,0,thisclose);


--  作者:fly
--  发布时间:2011/11/4 11:26:15
--  

1.您是每天做交易的,收盘前把全局变量赋值为0.才不会影响第2天的开仓.

 

2.sell(holding>0,0,thisclose);//这里的第2个参数可以写成具体手数1,也可写成0,表示全局平仓.

如果还是不懂,去仔细看看函数说明.


--  作者:tonybig
--  发布时间:2011/11/4 11:39:49
--  
明白了,但是改好的公式无法使用在1分钟图上,请帮忙查看