欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 请老师给改下一下程序!谢谢

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有3222人关注过本帖平板打印复制链接

主题:请老师给改下一下程序!谢谢

帅哥哟,离线,有人找我吗?
FJ6008
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游民 帖子:209 积分:0 威望:0 精华:0 注册:2014/9/15 21:05:19
  发帖心情 Post By:2014/11/5 16:41:29    Post IP:182.32.74.27[只看该作者]

这样还是没有信号的;

 

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;


 回到顶部
总数 18 1 2 下一页