-- 作者:FJ6008
-- 发布时间:2014/11/5 15:50:40
-- 请老师给改下一下程序!谢谢
MA1:=MA(CLOSE,5); MA2:=( stopprice); variable:maxprofit=0;//有仓位时最大获利幅度 //开多 IF CROSS(MA1,MA2) THEN BEGIN BUY( HOLDING=0,10%,market);//开多操作 maxprofit:=0; END//平仓 SELL(CROSS(MA2,MA1),0);//平多 //判断当前持仓状态下的最大盈利
。。。。。。
这是:单开,单平;我想在改为:
平多同时开空;平空同时开多
MA1:=MA(CLOSE,5); MA2:=( stopprice); variable:maxprofit=0;//有仓位时最大获利幅度 //开多 IF CROSS(MA1,MA2) THEN BEGIN BUY( HOLDING=0,10%,market);//开多操作 SELLSHORT(HOLDING=0,10%,market );//开空 maxprofit:=0; END//平仓 SELL(CROSS(MA2,MA1),0);//平多 BUYSHORT(HOLDING=0,10%,market );//开空 //判断当前持仓状态下的最大盈利
。。。。。。
这样就没有信号了;
请老师给改下一下!谢谢
此主题相关图片如下:qq图片20141030122949.png
![dvubb 图片点击可在新窗口打开查看](UploadFile/2014-11/201411515503979688.png)
|
-- 作者:FJ6008
-- 发布时间:2014/11/5 16:05:37
--
VARIABLE: aspect=0; //初始化假定做多头 VARIABLE: stopprice=0;//止损价格变量 VARIABLE: stopnum = 10; //止损价差 RUNMODE:0; //工作于逐周期模式
MA1:=MA(CLOSE,5); MA2:=( stopprice); variable:maxprofit=0;//有仓位时最大获利幅度 //开多 IF CROSS(MA1,MA2) THEN BEGIN BUY( HOLDING=0,10%,market);//开多操作 SELLSHORT(HOLDING=0,10%,market );//开空 maxprofit:=0; END//平仓 SELL(CROSS(MA2,MA1),0);//平多 BUYSHORT(HOLDING=0,10%,market );//开空 //判断当前持仓状态下的最大盈利 win:=0; win2:=0; 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 if holding < 0 and enterbars > 0 then begin win:=(enterprice-c)/enterprice*100; //记录最大盈利 if win > maxprofit then maxprofit:=win; win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度 end //出现浮动亏损比如2%平仓 止损:SELL(win < -2,0); //出现最高盈利后,回落到盈利的60%平仓出场
持仓: holding,NODRAW; 盈亏:asset*ML,noaxis,COLORFFFF00,NODRAW; 收益:ROUND((asset-50000)*ML/50000),COLORFFFF00,NODRAW; 次数:=totaltrade,COLORFFFFFF,NODRAW; 胜率:percentwin,COLORFFFFFF,NODRAW; 连赢:=maxseqwin,COLORFFFFFF,NODRAW; 连亏:=maxseqloss,COLORFFFFFF,NODRAW;
|
-- 作者:FJ6008
-- 发布时间:2014/11/5 16:41:29
--
这样还是没有信号的;
VARIABLE: aspect=0; //初始化假定做多头 VARIABLE: stopprice=0;//止损价格变量 VARIABLE: stopnum = 10; //止损价差 RUNMODE:0; //工作于逐周期模式 if barpos = 0 then stopprice := l - stopnum; if aspect = 0 then begin //多头处理 if l <= stopprice then begin //多反空 aspect:= 1; stopprice := h+stopnum; end //处理移动的底部 if l - stopnum > stopprice then stopprice := l-stopnum; end if aspect = 1 then begin //空头处理 if h >= stopprice then begin //空反多 aspect:= 0; stopprice := l-stopnum; end //处理移动的底部 if h + stopnum < stopprice then stopprice := h+stopnum; end //画线 PARTLINE(aspect = 0, stopprice , colorrgb(255,0,0)),LINETHICK2; PARTLINE(aspect = 1, stopprice , colorrgb(0,255,0)),LINETHICK2;
MA1:=MA(CLOSE,1); MA2:=( stopprice); variable:maxprofit=0;//有仓位时最大获利幅度 //开多 IF CROSS(MA1,MA2) THEN BEGIN
SELLSHORT( HOLDING=0,10%,market );//平空 BUY( HOLDING=0,10%,market);//开多操作
maxprofit:=0; END//平仓
SELL(CROSS(MA2,MA1),0);//平多 BUYSHORT(HOLDING=0,10%,market );
//判断当前持仓状态下的最大盈利 win:=0; win2:=0; 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 if holding < 0 and enterbars > 0 then begin win:=(enterprice-c)/enterprice*100; //记录最大盈利 if win > maxprofit then maxprofit:=win; win2:=(maxprofit-win)/maxprofit*100; //最大盈利后的回调幅度 end //出现浮动亏损比如2%平仓 止损:SELL(win < -2,0); //出现最高盈利后,回落到盈利的60%平仓出场
持仓: holding,NODRAW; 盈亏:asset*ML,noaxis,COLORFFFF00,NODRAW; 收益:ROUND((asset-50000)*ML/50000),COLORFFFF00,NODRAW; 次数:=totaltrade,COLORFFFFFF,NODRAW; 胜率:percentwin,COLORFFFFFF,NODRAW; 连赢:=maxseqwin,COLORFFFFFF,NODRAW; 连亏:=maxseqloss,COLORFFFFFF,NODRAW;
|