helloworld22 发表于 2016-10-27 22:57:28

使用Enum_Exit 平昨仓位不足

用的是A_SendOrder(Enum_Buy,Enum_Exit,tempPos,MyEntryPrice);
不是说用Enum_Exit会自动识别今仓昨仓吗?
怎么会这样呢?
合约是rb1701,好烦啊。

helloworld22 发表于 2016-10-27 23:34:19

代码是这样的//检查是否有空单 ,有则先平仓
                tempPos = A_SellPosition();               
                MinPoint = offSet*MinMove*PriceScale;
                If(tempPos > 0) // 平空单
                {
                        MyEntryPrice = Q_AskPrice+MinPoint;
                        A_SendOrder(Enum_Buy,Enum_Exit,tempPos,MyEntryPrice);
                        FileAppend("c:\\a1_log.txt","时间 = " + DateTimeToString(Date + time) +"\t 平空 价格 = "+Text(MyEntryPrice));
                }
               

helloworld22 发表于 2016-10-28 09:30:18

管理员能解答一下吗?

superwin 发表于 2016-10-28 09:47:52

是自动识别的啊,我实盘一直都是这样用的,V4、V5都是自动识别的,实盘好几年了。

superwin 发表于 2016-10-28 09:57:37

TB早就在软件后台自动处理平今平昨问题了,参考2009年和2010年管理员的回答

http://bbs.tb18.net/forum.php?mod=viewthread&tid=5800&page=1#pid36846

http://bbs.tb18.net/forum.php?mod=viewthread&tid=9298&page=1#pid53743

helloworld22 发表于 2016-10-28 10:05:59

superwin 发表于 2016-10-28 09:57 static/image/common/back.gif
TB早就在软件后台自动处理平今平昨问题了,参考2009年和2010年管理员的回答

http://bbs.tb18.net/forum.ph ...

我也是看到管理员的回答以为是这样,但真不是,就是会出错。
刚进群问了,上期所的东西分平今和平昨。
改一下程序吧

小米 发表于 2016-10-28 10:09:14

用了哪个软件版本?

helloworld22 发表于 2016-10-28 10:09:42

小米 发表于 2016-10-28 10:09 static/image/common/back.gif
用了哪个软件版本?

tbplus 最新版

小米 发表于 2016-10-28 10:11:07

helloworld22 发表于 2016-10-28 10:09 static/image/common/back.gif
tbplus 最新版

请加群425047026 ,或是拨打电话 025-52803089 ,将问题反馈给工作人员。
工作人员将会为您解

helloworld22 发表于 2016-10-28 10:12:02

本帖最后由 helloworld22 于 2016-11-1 12:43 编辑

我把平仓代码改这成样了。不知道还会不会出错。
tempPos = A_SellPosition();               
MinPoint = offSet*MinMove*PriceScale;
If(tempPos > 0) // 平空单
{
        MyEntryPrice = Q_AskPrice+MinPoint;
        IF(A_TodaySellPosition==0)
                A_SendOrder(Enum_Buy,Enum_Exit,tempPos,MyEntryPrice);
        Else
                A_SendOrder(Enum_Buy,Enum_ExitToday,tempPos,MyEntryPrice);
        FileAppend(logName,"时间 = " + DateTimeToString(SystemDateTime()) +"\t  平空 价格 = "+Text(MyEntryPrice));               
}------------此代码实盘已证实可用,不会再出错误了 2016.11.1
页: [1] 2
查看完整版本: 使用Enum_Exit 平昨仓位不足