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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 求助 运用全局变量 实现 大盈利或连续亏损两次后停止交易一段时间

   

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


  共有6894人关注过本帖树形打印复制链接

主题:求助 运用全局变量 实现 大盈利或连续亏损两次后停止交易一段时间

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


加好友 发短信
等级:论坛游侠 帖子:107 积分:0 威望:0 精华:0 注册:2014/11/10 9:11:27
求助 运用全局变量 实现 大盈利或连续亏损两次后停止交易一段时间  发帖心情 Post By:2015/4/27 11:09:05    Post IP:58.247.225.238[显示全部帖子]

求助  运用全局变量 实现  大盈利或连续亏损两次后停止交易一段时间  

搜索过论坛里各位高手的代码 ,但是关于 “大盈利或连续亏损两次后停止交易一段时间”  一直没有一个类似于阿火秘籍系统整理过的功能模块代码,
恳请在论坛的各位版主高手 给个 通用版本 帮助新手 克服这个障碍,十分感谢。

 回到顶部
帅哥哟,离线,有人找我吗?
厚德载物生
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:107 积分:0 威望:0 精华:0 注册:2014/11/10 9:11:27
  发帖心情 Post By:2015/4/27 11:26:56    Post IP:58.247.225.238[显示全部帖子]

我自己 顶一个 ,


//交易控制变量
variable:DYL=0;
variable:大盈利=0;



if 大盈利:=abs(enterprice-EXITPRICE)>=40 and  DYL=0 THEN  BEGIN
   DYL:=1;
   盈利休止:=DYL=1 AND EXITBARS<=40;
   end
   

   
if 大盈利:=abs(enterprice-EXITPRICE)<40 and  DYL=1 THEN  BEGIN
   DYL:=0;
   end

另外 这是我自己按照对函数的理解 写出的一个盈利停盘 条件

在开仓条件 and not(盈利休止)//在大盈利后 平仓历时40个周期内不交易

但是 这个代码 有问题

 回到顶部
帅哥哟,离线,有人找我吗?
厚德载物生
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:107 积分:0 威望:0 精华:0 注册:2014/11/10 9:11:27
  发帖心情 Post By:2015/4/27 11:45:24    Post IP:58.247.225.238[显示全部帖子]

连续 亏损两次 以上 停盘一段时间 应该如何写功能模块 嵌入到 策略当中 ,真心求助啊 这个也是大部分金字塔新手 守住盈利 控制亏损的 迫切需求啊  请版主与各位高手重视 

 回到顶部
帅哥哟,离线,有人找我吗?
厚德载物生
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:107 积分:0 威望:0 精华:0 注册:2014/11/10 9:11:27
  发帖心情 Post By:2015/4/27 13:36:18    Post IP:58.247.225.238[显示全部帖子]

JINZHE大版主功力深厚 好牛 十分感谢  立刻回答了我的问题 ,刚才 我试一下代码,单独用连续2次亏损的代码模块没问题 ,可是大盈利停盘这块加进去不行,是不是 我的大盈利的写法问题   
写法1 // 大盈利:=abs(enterprice-EXITPRICE)>=40 ;
     if 大盈利  then begin

         n:=1;

         m:=0;

写法2// 大盈利:=abs(enterprice-EXITPRICE);
          if 大盈利>=40  then begin

         n:=1;

         m:=0;

写法3// 
           if numprofit(1)>12000 then n:=0;
望版主赐教

 回到顶部
帅哥哟,离线,有人找我吗?
厚德载物生
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:107 积分:0 威望:0 精华:0 注册:2014/11/10 9:11:27
  发帖心情 Post By:2015/4/27 13:56:42    Post IP:58.247.225.238[显示全部帖子]

已经根据版主的意思修改了代码 但是 不管n=1还是n=0 我都试过了
 if numprofit(1)>12000 then begin
         m:=0;
         n:=1;
     end
这段一加进来 代码就不管用,连 连续亏损停盘也不起作用了; 



if a4 and tpcc=1  then BEGIN
  平多4:SELL(1,lots,MARKETR),orderqueue;
  tpcc:=0;
  debugfile('D:\590191352.txt', '平多4 %.0f',holding );
     if numprofit(1)>12000 then begin
         m:=0;
         n:=1;
     end
     if numprofit(1)>0 then m:=0;
     if numprofit(1)<0 then m:=m+1;
   
end


if a5 and tpcc=1  then BEGIN
  平多5:SELL(1,lots,MARKETR),orderqueue;
  tpcc:=0;
  debugfile('D:\590191352.txt', '平多5 %.0f',holding );
     if numprofit(1)>12000 then begin
         m:=0;
         n:=1;
     end
     if numprofit(1)>0 then m:=0;
     if numprofit(1)<0 then m:=m+1;
end

if a6 and tpcc=1  then BEGIN
  平多6:SELL(1,lots,MARKETR),orderqueue;
  tpcc:=0;
  debugfile('D:\590191352.txt', '平多6 %.0f',holding );
  if numprofit(1)>12000 then begin
         m:=0;
         n:=1;
     end
     if numprofit(1)>0 then m:=0;
     if numprofit(1)<0 then m:=m+1;
end

if a3  and tpcc=1    then BEGIN
   止损平多3:SELL(1,lots,MARKETR),orderqueue;
  tpcc:=0;
  debugfile('D:\590191352.txt', '止损平多3 %.0f',holding );
     if numprofit(1)>12000 then begin
         m:=0;
         n:=1;
     end
     if numprofit(1)>0 then m:=0;
     if numprofit(1)<0 then m:=m+1;
end


if b4 and tpcc=2  then BEGIN
  平空4:SELLSHORT(1,lots,MARKETR),orderqueue;
  tpcc:=0;
  debugfile('D:\590191352.txt', '平空4 %.0f',holding );
     if numprofit(1)>12000 then begin
         m:=0;
         n:=1;
     end
     if numprofit(1)>0 then m:=0;
     if numprofit(1)<0 then m:=m+1;
end

if b5 and tpcc=2  then BEGIN
  平空5:SELLSHORT(1,lots,MARKETR),orderqueue;
  tpcc:=0;
  debugfile('D:\590191352.txt', '平空5 %.0f',holding );
     if numprofit(1)>12000 then begin
         m:=0;
         n:=1;
     end
     if numprofit(1)>0 then m:=0;
     if numprofit(1)<0 then m:=m+1;
end

if b6 and tpcc=2  then BEGIN
  平空6:SELLSHORT(1,lots,MARKETR),orderqueue;
  tpcc:=0;
  debugfile('D:\590191352.txt', '平空6 %.0f',holding );
     if numprofit(1)>12000 then begin
         m:=0;
         n:=1;
     end
     if numprofit(1)>0 then m:=0;
     if numprofit(1)<0 then m:=m+1;
end

if b3 and tpcc=2  then BEGIN
  止损平空3:SELLSHORT(1,lots,MARKETR),orderqueue;
  tpcc:=0;
  debugfile('D:\590191352.txt', '平空3 %.0f',holding );
     if numprofit(1)>12000 then begin
         m:=0;
         n:=1;
     end
     if numprofit(1)>0 then m:=0;
     if numprofit(1)<0 then m:=m+1;
end


 回到顶部
帅哥哟,离线,有人找我吗?
厚德载物生
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:107 积分:0 威望:0 精华:0 注册:2014/11/10 9:11:27
  发帖心情 Post By:2015/4/27 14:14:28    Post IP:58.247.225.238[显示全部帖子]

回jinzhe版主 其实我的A3 B3 A4 B4 A5 B5平仓条件已经加了 持仓判断,我刚才在执行代码里又加了一次,编译正常   图形显示 又回到 没有修改的状态了

应该 还是    if numprofit(1)>12000 then begin
         m:=0;
         n:=1;
     end
     if numprofit(1)>0 then m:=0;
     if numprofit(1)<0 then m:=m+1;
   这句有冲突 请版主 再帮着看看

if a4 and tpcc=1 and holding>0 then BEGIN
  平多4:SELL(1,lots,MARKETR),orderqueue;
  tpcc:=0;
  debugfile('D:\590191352.txt', '平多4 %.0f',holding );
     if numprofit(1)>12000 then begin
         m:=0;
         n:=1;
     end
     if numprofit(1)>0 then m:=0;
     if numprofit(1)<0 then m:=m+1;
   
end


if a5 and tpcc=1  and holding>0  then BEGIN
  平多5:SELL(1,lots,MARKETR),orderqueue;
  tpcc:=0;
  debugfile('D:\590191352.txt', '平多5 %.0f',holding );
     if numprofit(1)>12000 then begin
     
         n:=1;
     end
     if numprofit(1)>0 then m:=0;
     if numprofit(1)<0 then m:=m+1;
end

if a6 and tpcc=1  and holding>0 then BEGIN
  平多6:SELL(1,lots,MARKETR),orderqueue;
  tpcc:=0;
  debugfile('D:\590191352.txt', '平多6 %.0f',holding );
  if numprofit(1)>12000 then begin
         m:=0;
         n:=1;
     end
     if numprofit(1)>0 then m:=0;
     if numprofit(1)<0 then m:=m+1;
end

if a3  and tpcc=1  and holding>0   then BEGIN
   止损平多3:SELL(1,lots,MARKETR),orderqueue;
  tpcc:=0;
  debugfile('D:\590191352.txt', '止损平多3 %.0f',holding );
     if numprofit(1)>12000 then begin
         m:=0;
         n:=1;
     end
     if numprofit(1)>0 then m:=0;
     if numprofit(1)<0 then m:=m+1;
end


if b4 and tpcc=2  and holding<0 then BEGIN
  平空4:SELLSHORT(1,lots,MARKETR),orderqueue;
  tpcc:=0;
  debugfile('D:\590191352.txt', '平空4 %.0f',holding );
     if numprofit(1)>12000 then begin
         m:=0;
         n:=1;
     end
     if numprofit(1)>0 then m:=0;
     if numprofit(1)<0 then m:=m+1;
end

if b5 and tpcc=2  and  holding<0 then BEGIN
  平空5:SELLSHORT(1,lots,MARKETR),orderqueue;
  tpcc:=0;
  debugfile('D:\590191352.txt', '平空5 %.0f',holding );
     if numprofit(1)>12000 then begin
         m:=0;
         n:=1;
     end
     if numprofit(1)>0 then m:=0;
     if numprofit(1)<0 then m:=m+1;
end

if b6 and tpcc=2  and  holding<0 then BEGIN
  平空6:SELLSHORT(1,lots,MARKETR),orderqueue;
  tpcc:=0;
  debugfile('D:\590191352.txt', '平空6 %.0f',holding );
     if numprofit(1)>12000 then begin
         m:=0;
         n:=1;
     end
     if numprofit(1)>0 then m:=0;
     if numprofit(1)<0 then m:=m+1;
end

if b3 and tpcc=2 and holding<0 then BEGIN
  止损平空3:SELLSHORT(1,lots,MARKETR),orderqueue;
  tpcc:=0;
  debugfile('D:\590191352.txt', '平空3 %.0f',holding );
     if numprofit(1)>12000 then begin
         m:=0;
         n:=1;
     end
     if numprofit(1)>0 then m:=0;
     if numprofit(1)<0 then m:=m+1;
end

 回到顶部
帅哥哟,离线,有人找我吗?
厚德载物生
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:107 积分:0 威望:0 精华:0 注册:2014/11/10 9:11:27
  发帖心情 Post By:2015/4/27 14:31:18    Post IP:58.247.225.238[显示全部帖子]

开仓图片点击可在新窗口打开查看限定条件 都加好了 
现在的问题 是 如果 把大盈利停盘这段代码加上,图形能正常显示,但之前连续止损的功能也无效了,
 if numprofit(1)>12000 then begin
         m:=0;
         n:=1;
     end
这段只要嵌套在平仓执行里,这段全局变量的代码就不起作用了,但是把它删掉,单独保留连续亏损两次的代码就没问题,奇怪中 



if b5 and tpcc=2  and  holding<0 then BEGIN
  平空5:SELLSHORT(1,lots,MARKETR),orderqueue;
  tpcc:=0;
  debugfile('D:\590191352.txt', '平空5 %.0f',holding );
     if numprofit(1)>12000 then begin
         m:=0;
         n:=1;
     end
     if numprofit(1)>0 then m:=0;
     if numprofit(1)<0 then m:=m+1;
end




ASD:=barslast(n=1 and ref(n=0,1))>160 or barslast(m=2 and ref(m=1,1))>60;


c0:=开空条件0  AND ASD;
c1:=开空条件1  AND ASD;
c3:=pbuycond   and (ABB ) AND ASD AND holding=0 ;//  
c5:=pbuycond1  and (ABB )  AND ASD AND holding=0; //
c6:=pbuycond2  and (ABB ) AND ASD AND holding=0;//

d0:=开多条件0 ;//  
d1:=开多条件1  ;
d3:=psellcond  and (ABB )  AND ASD  AND  holding=0 ;// 
d5:=psellcond1 and (ABB )  AND ASD AND  holding=0 ;// 
d6:=psellcond2  and (ABB ) AND ASD AND  holding=0;//

 回到顶部
帅哥哟,离线,有人找我吗?
厚德载物生
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:107 积分:0 威望:0 精华:0 注册:2014/11/10 9:11:27
  发帖心情 Post By:2015/4/27 14:57:05    Post IP:58.247.225.238[显示全部帖子]

图片点击可在新窗口打开查看

 回到顶部
帅哥哟,离线,有人找我吗?
厚德载物生
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:107 积分:0 威望:0 精华:0 注册:2014/11/10 9:11:27
  发帖心情 Post By:2015/4/27 14:58:28    Post IP:58.247.225.238[显示全部帖子]

就是 这样  相当于不起作用,左侧的开多单笔肯定大于12000,但是设定 160个周期的不交易 就是不起作用

 回到顶部
帅哥哟,离线,有人找我吗?
厚德载物生
  10楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:107 积分:0 威望:0 精华:0 注册:2014/11/10 9:11:27
  发帖心情 Post By:2015/4/27 15:18:45    Post IP:58.247.225.238[显示全部帖子]

完全按照版主的指示添加代码,就没交易信号了

 回到顶部
总数 32 1 2 3 4 下一页