以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  策略编写求助区  (http://weistock.com/bbs/list.asp?boardid=11)
----  组合编辑了一个模型,还需整理成真实能用好的策略。  (http://weistock.com/bbs/dispbbs.asp?boardid=11&id=7297)

--  作者:boss
--  发布时间:2011/7/22 16:06:13
--  组合编辑了一个模型,还需整理成真实能用好的策略。

{均线战法}
INPUT:N1(8,0.01,100,0.05);

VARIABLE:MAXPROFIT=0,{有仓位时最大获利幅度}VMIN = 090000;{用于隔夜高开或低开时间差}                

ma1:ma(c,n1);

runmode:0;
YdZyD:=1,linethick0;   {移动止盈总开关,1为开,0为关}
variable:baramount=0;
variable:barvol=0;

if barpos<=1 then exit;

if date<>date[barpos-1] then begin
 baramount:=amount;
 barvol:=vol;
end else begin
 baramount:=baramount[barpos-1]+amount;
 barvol:=barvol[barpos-1]+vol;
end

averageprice:=baramount/barvol/multiplier;
均价线:round(averageprice/mindiff)*mindiff,linethick2,coloryellow;

a:=open+3*mindiff;
b:=open-3*mindiff;


//建立多头的进场条件
long:=cross(ma1,averageprice);
if long  then
begin
sellshort(holding<0,1,MKT),orderqueue;
buy(holding=0,1,limitr,a),orderqueue,;


end

//建立空头的进场条件
short:=cross(averageprice,ma1);
if short  then
begin
sell(holding>0,1,MKT),orderqueue;
buyshort(holding=0,1,limitr,b),orderqueue;

end

//多移动止盈
 If YdZyD=1 and Enterbars>=0 then begin
  //a.每周期判断是否创新低
if holding > 0 and enterbars > 0 then
begin
 win:=(c-enterprice)/enterprice*100; //记录最大盈利
 if win > maxprofit then
  maxprofit:=win;
  win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度
end
end

//b.当开仓后,盈利达到80到380点时,回撤80%,平仓
if c-enterprice>80*mindiff and c-enterprice<380*mindiff and holding>0 then
begin
SELL(win2 >= 20, 1,market);
end


//空移动止盈A
 If YdZyD=1 and Enterbars>=0 then begin
  //a.每周期判断是否创新低
if holding > 0 and enterbars > 0 then
begin
 win:=(c-enterprice)/enterprice*100; //记录最大盈利
 if win > maxprofit then
  maxprofit:=win;
  win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度
end
end

//b.当开仓后,盈利达到80到380点时,回撤80%,平仓
if c-enterprice>80*mindiff and c-enterprice<380*mindiff and holding>0 then
begin
SELL(win2 >= 20, 1,market);
end


盈亏:asset,noaxis,colorgray;     
收益:(asset-50000)/50000,linethick0;
次数:totaltrade,linethick0;
胜率:percentwin,linethick0;
连亏:maxseqloss,linethick0;
连赢:maxseqwin,linethick0;


--  作者:董小球
--  发布时间:2011/7/22 16:59:22
--  
说说你的想法,已经实现了什么,还有那些地方不足,要改成什么样子,实现什么具体功能?
--  作者:boss
--  发布时间:2011/7/25 0:03:32
--  

其实每次都有机会正收益,但实际运行不理想,保不住收益


--  作者:董小球
--  发布时间:2011/7/25 10:00:19
--  K线不走完就给信号。。。
。。。。。这个是需要实盘经验来给你修正指标,这个咱是做软件的估计帮助不了你!
--  作者:蔡宛宏
--  发布时间:2011/12/19 14:14:04
--  
模板很不错