AL_SellPosition(tCode); (文华财经WH8赢智V8.2)

投资者咨询:AL_SellPosition(tCode); (文华财经WH8赢智V8.2)
来源:文华财经  日期:2018-5-24 23:42
1. AL_SellPosition(tCode);
这个是盘口函数中的取得算法交易的多头,那么是否有取得账户持仓里的多头函数呢


2.盘口平仓中加入:取得该品种的涨跌停价格,如果涨停就不平多!跌停就不平空!






VOID DoBP()
{
   IF(tModel.F_Sig() == BP) //
   {
      IF(T_IsSHCode(tCode) == 1) // 
      {
         IF(T_SHSellRemainPosition(tCode, 0) > 0)
         {
            MessageOut(tCode + "市价平空");
            BPID = T_Deal(tCode, 0, 2, T_SHSellRemainPosition(tCode, 0), T_GetRiseLimit(tCode));
         }
      }
      ELSE
      {
         IF(T_SellRemainPosition(tCode) > 0)
         {
            MessageOut(tCode + "市价平空");
            BPID = T_Deal(tCode, 0, 1, T_SellRemainPosition(tCode), T_GetRiseLimit(tCode));
         }
      }
   }
}



VOID DoSP()
{
   IF(tModel.F_Sig() == SP)
   {
      IF(T_IsSHCode(tCode) == 1) // 
      {
         IF(T_SHBuyRemainPosition(tCode, 0) > 0)
         {
            MessageOut(tCode + "市价平多");
            BPID = T_Deal(tCode, 1, 2, T_SHBuyRemainPosition(tCode, 0), T_GetFallLimit(tCode));
         }
      }
      ELSE
      {
         IF(T_BuyRemainPosition(tCode) > 0)
         {
            MessageOut(tCode + "市价平多");
            SPID = T_Deal(tCode, 1, 1, T_BuyRemainPosition(tCode), T_GetFallLimit(tCode));
         }
      }
   }
}
     
技术人员回复
日期:2018-5-25 8:23

取账户总的持仓参考T_BuyPosition(Code)函数,可以在函数列表》下单接口函数中了解更多

 

 

参考:

 

VOID DoBP()
{
   Price1=Price(tCode,"New");
   IF(tModel.F_Sig() == BP &&  Price1>T_GetFallLimit(tCode)) //
   {
      IF(T_IsSHCode(tCode) == 1) //
      {
         IF(T_SHSellRemainPosition(tCode, 0) > 0)
         {
            MessageOut(tCode + "市价平空");
            BPID = T_Deal(tCode, 0, 2, T_SHSellRemainPosition(tCode, 0), T_GetRiseLimit(tCode));
         }
      }
      ELSE
      {
         IF(T_SellRemainPosition(tCode) > 0)
         {
            MessageOut(tCode + "市价平空");
            BPID = T_Deal(tCode, 0, 1, T_SellRemainPosition(tCode), T_GetRiseLimit(tCode));
         }
      }
   }
}

 

 


VOID DoSP()
{
   IF(tModel.F_Sig() == SP && Price1<T_GetRiseLimit(tCode))
   {
      IF(T_IsSHCode(tCode) == 1) //
      {
         IF(T_SHBuyRemainPosition(tCode, 0) > 0)
         {
            MessageOut(tCode + "市价平多");
            BPID = T_Deal(tCode, 1, 2, T_SHBuyRemainPosition(tCode, 0), T_GetFallLimit(tCode));
         }
      }
      ELSE
      {
         IF(T_BuyRemainPosition(tCode) > 0)
         {
            MessageOut(tCode + "市价平多");
            SPID = T_Deal(tCode, 1, 1, T_BuyRemainPosition(tCode), T_GetFallLimit(tCode));
         }
      }
   }
}

 
投资者咨询:AL_SellPosition(tCode); (文华财经WH8赢智V8.2)
来源:文华财经  日期:2018-5-24 23:42
以下是引用冬夜在2018/5/25 8:23:00的发言:

取账户总的持仓参考T_BuyPosition(Code)函数,可以在函数列表》下单接口函数中了解更多

 AL_SellPosition(tCode);这个是取得盘口信号记录的合约多头,那么换成T_BuyPosition(Code)是取账户的持仓合约多头对吧!

 

参考:

 

VOID DoBP()
{
   Price1=Price(tCode,"New");
   IF(tModel.F_Sig() == BP &&  Price1<=T_GetFallLimit(tCode)) //并且最新价格小于等于跌停价格呢?我要的是不等于跌停价格才平的,跌停了就不平啊,不应写:
Price1<>T_GetFallLimit(tCode
   {
      IF(T_IsSHCode(tCode) == 1) //
      {
         IF(T_SHSellRemainPosition(tCode, 0) > 0)
         {
            MessageOut(tCode + "市价平空");
            BPID = T_Deal(tCode, 0, 2, T_SHSellRemainPosition(tCode, 0), T_GetRiseLimit(tCode));
         }
      }
      ELSE
      {
         IF(T_SellRemainPosition(tCode) > 0)
         {
            MessageOut(tCode + "市价平空");
            BPID = T_Deal(tCode, 0, 1, T_SellRemainPosition(tCode), T_GetRiseLimit(tCode));
         }
      }
   }
}

 

 


VOID DoSP()
{
   IF(tModel.F_Sig() == SP && Price1>=T_GetRiseLimit(tCode))
为什么是满足了SP并且最新价格大于等于涨停价格呢?我要的是不等于涨停价格才平的,涨停了就不平啊,不应该写不等于吗?
   {
      IF(T_IsSHCode(tCode) == 1) //
      {
         IF(T_SHBuyRemainPosition(tCode, 0) > 0)
         {
            MessageOut(tCode + "市价平多");
            BPID = T_Deal(tCode, 1, 2, T_SHBuyRemainPosition(tCode, 0), T_GetFallLimit(tCode));
         }
      }
      ELSE
      {
         IF(T_BuyRemainPosition(tCode) > 0)
         {
            MessageOut(tCode + "市价平多");
            SPID = T_Deal(tCode, 1, 1, T_BuyRemainPosition(tCode), T_GetFallLimit(tCode));
         }
      }
   }
}

       
技术人员回复
日期:2018-5-25 11:21

 是的换成T_BuyPosition(Code)就可以

 

楼上判断符号部分错误,给您换成大于跌停价以及小于涨停价就可以

投资者咨询:AL_SellPosition(tCode); (文华财经WH8赢智V8.2)
来源:文华财经  日期:2018-5-24 23:42
以下是引用冬夜在2018/5/25 11:21:00的发言:

 是的换成T_BuyPosition(Code)就可以

 

楼上判断符号部分错误,给您换成大于跌停价以及小于涨停价就可以


怎么会说最新价格大于跌停价格为条件呢?(他怎么可能大于跌停价格了,他最大就是跌停而已)


不应该是:最新价格不等于跌停价格吗???Price1<>T_GetFallLimit(tCode)

       
技术人员回复
日期:2018-5-25 11:28
 是一样的,因为价格不等于包含大于和小于,而不存在小于跌停的情况
投资者咨询:AL_SellPosition(tCode); (文华财经WH8赢智V8.2)
来源:文华财经  日期:2018-5-24 23:42
以下是引用冬夜在2018/5/25 11:28:00的发言:
 是一样的,因为价格不等于包含大于和小于,而不存在小于跌停的情况

1. 那写成 Price1<>T_GetFallLimit(tCode)也是可以实现的对吧! 


2.第148行 "Price1附近" 使用了未定义的变量?
写个:VAR  Price1;即可对比!
技术人员回复
日期:2018-5-25 11:34
 是的,是一样的
投资者咨询:AL_SellPosition(tCode); (文华财经WH8赢智V8.2)
来源:文华财经  日期:2018-5-24 23:42
 2.第148行 "Price1附近" 使用了未定义的变量?
写个:VAR  Price1;即可对吧!不需要全局变量GLOBAL_VAR





  
   Price1=Price(tCode,"New");只放在BP中,不需要放在SP中吗?

VOID DoBP()
{
   Price1=Price(tCode,"New");
   IF(tModel.F_Sig() == BP &&  Price1<=T_GetFallLimit(tCode)) //

   {
      IF(T_IsSHCode(tCode) == 1) // 
      {
         IF(T_SHSellRemainPosition(tCode, 0) > 0)
         {
            MessageOut(tCode + "市价平空");
            BPID = T_Deal(tCode, 0, 2, T_SHSellRemainPosition(tCode, 0), T_GetRiseLimit(tCode));
         }
      }
      ELSE
      {
         IF(T_SellRemainPosition(tCode) > 0)
         {
            MessageOut(tCode + "市价平空");
            BPID = T_Deal(tCode, 0, 1, T_SellRemainPosition(tCode), T_GetRiseLimit(tCode));
         }
      }
   }
}

 

 


VOID DoSP()
{
   IF(tModel.F_Sig() == SP && Price1>=T_GetRiseLimit(tCode))

   {
      IF(T_IsSHCode(tCode) == 1) // 
      {
         IF(T_SHBuyRemainPosition(tCode, 0) > 0)
         {
            MessageOut(tCode + "市价平多");
            BPID = T_Deal(tCode, 1, 2, T_SHBuyRemainPosition(tCode, 0), T_GetFallLimit(tCode));
         }
      }
      ELSE
      {
         IF(T_BuyRemainPosition(tCode) > 0)
         {
            MessageOut(tCode + "市价平多");
            SPID = T_Deal(tCode, 1, 1, T_BuyRemainPosition(tCode), T_GetFallLimit(tCode));
         }
      }
   }
}


技术人员回复
日期:2018-5-25 11:38
 是的,需要定义一下变量,不需要使用全局变量