大佬帮我,思路是设置一条均线,触及均线开仓,n个点即止盈或止损,采用固定轮询模式,下面的如何优化?如何最大限度减少滑点?
input:n(10,1,100,1);//盈利止损点数
input:m(2,2,60,1);//均线周期
ma5:ma(close,m);
if cross(c,ma5) and time>091500 and time<151300 and holding=0 then buy(1,1,limitr,ma5),IGNORECHECKPRICE;
if cross(ma5,c) and time>091500 and time<151300 and holding=0 then buyshort(1,1,limitr,ma5),IGNORECHECKPRICE;
if holding<0 and enterprice-l>=mindiff*n then sellshort(1,1,limitr,enterprice-mindiff*n),IGNORECHECKPRICE;
if holding>0 and enterprice-h<=mindiff*n then sell(1,1,limitr,enterprice+mindiff*n),IGNORECHECKPRICE ;
//止损模块
多头损失点数:=c-enterprice;
空头损失点数:=enterprice-c;
if 空头损失点数<0 and abs(空头损失点数)>2*mindiff*n and holding<0 and enterbars>1 then 空头止损:sellshort(1,0,marketr),IGNORECHECKPRICE;
if 多头损失点数<0 and abs(多头损失点数)>2*mindiff*n and holding>0 and enterbars>1 then 多头止损:sell(1,0,marketr),IGNORECHECKPRICE;
止损点数:abs(多头损失点数);
//收盘前清仓
if time>=151400 then
begin
sellshort(holding<0,0,thisclose);
sell(holding>0,0,thisclose);
end
持仓:holding,linethick0;
资产:asset,noaxis,linethick2,coloryellow;
可用现金:cash(0),linethick0;
这样是否可以?
input:n(7,1,100,1);//盈利止损点数
input:m(2,2,60,1);//均线周期
ma5:ma(close,m);
variable:n1=0;
variable:n2=0;
if cross(c,ma5) and time>091500 and time<151300 and holding=0 then begin
buy(n1=0,1,limitr,ma5),IGNORECHECKPRICE;
n1=1;
end
if cross(ma5,c) and time>091500 and time<151300 and holding=0 then begin
buyshort(n2=0,1,limitr,ma5),IGNORECHECKPRICE;
n2=1;
end
if holding<0 and enterprice-l>=mindiff*n then sellshort(1,1,limitr,enterprice-mindiff*n),IGNORECHECKPRICE;
if holding>0 and enterprice-h<=mindiff*n then sell(1,1,limitr,enterprice+mindiff*n),IGNORECHECKPRICE ;
if minute<>ref(minute,1) then begin
n1:=0;
n2:=0;
end
//止损模块
多头损失点数:=c-enterprice;
空头损失点数:=enterprice-c;
if 空头损失点数<0 and abs(空头损失点数)>mindiff*n and holding<0 and enterbars>1 then 空头止损:sellshort(1,0,marketr),IGNORECHECKPRICE;
if 多头损失点数<0 and abs(多头损失点数)>mindiff*n and holding>0 and enterbars>1 then 多头止损:sell(1,0,marketr),IGNORECHECKPRICE;
止损点数:abs(多头损失点数);
//收盘前清仓
if time>=151400 then
begin
sellshort(holding<0,0,thisclose);
sell(holding>0,0,thisclose);
end
持仓:holding,linethick0;
资产:asset,noaxis,linethick2,coloryellow;
可用现金:cash(0),linethick0;
不是优化参数,是优化程序,能不能帮我看看?
有信号,下单了吗?是没下单还是下单了没成交?
此主题相关图片如下:qq图片20150723105010.png
此主题相关图片如下:qq图片20150723105116.png
10点47分发出平多信号,在2704点,但是实际成交确是2701点,这个是什么问题?
看下单日志,看看日志里面的报单价格是多少,成交价格又是多少。
你报单的价格,交易所要撮合,并不是一定会按照你报单的价格成交