设为首页收藏本站

 找回密码
 注册
查看: 5067|回复: 1
打印 上一主题 下一主题

如何编写加仓命令! [复制链接]

Rank: 4

精华
0
UID
188
积分
597
帖子
91
主题
27
阅读权限
50
注册时间
2007-8-24
最后登录
2019-4-5
跳转到指定楼层
1#
发表于 2007-9-14 01:24:43 |显示全部楼层 |倒序浏览
如果 condtion 条件继续成立 怎么编写加仓命令呢 ?

Numeric extryLots; // 加仓数量
、、、、、、、
//加仓
if (BarStatus == 2 and MarketPosition == -1 )       
   {extryLots=A_FreeMargin /(Q_AskPrice*ContractUnit*MarginRatio);
   extryLots  = IntPart(extryLots );
   if(condtion and Time<0.144500 )                       
     SellShort( extryLots  ,Close,True);
   }
Else If(BarStatus <> 2 and MarketPosition == -1 )       
  {extryLots=CurrentCapital/(Close*ContractUnit*MarginRatio);
    extryLots  = IntPart(extryLots ); // 取整
        if(condtion and Time<0.144500 )                       
      SellShort( extryLots  ,Close,True);
   
    }
在 condtion  第一次成立后 ,开仓,  在部分仓位止赢后, 还剩下部分仓位 !这个时候 condtion  条件又成立了!
在这样的情况如何加仓!
我写的是加空的 代码 好象不行!

[ 本帖最后由 dengwenle 于 2007-9-14 01:26 编辑 ]

Rank: 4

精华
0
UID
188
积分
597
帖子
91
主题
27
阅读权限
50
注册时间
2007-8-24
最后登录
2019-4-5
2#
发表于 2007-9-14 11:40:07 |显示全部楼层
测试的结果 如下
Formula文件的内容::

Time=0.09,extryLots=215
Time=0.11,extryLots=217
Time=0.14,extryLots=217
Time=0.14,extryLots=218
Time=0.14,extryLots=222
Time=0.13,extryLots=222

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

bottom

静态版|手机版|联系我们|交易开拓者 ( 粤ICP备07044698   

GMT+8, 2024-5-22 03:53

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部