- 精华
- 0
- 在线时间
- 192 小时
- UID
- 15246
- 积分
- 704
- 帖子
- 167
- 阅读权限
- 60
- 注册时间
- 2010-8-17
- 最后登录
- 2021-9-5
- 精华
- 0
- UID
- 15246
- 积分
- 704
- 帖子
- 167
- 主题
- 74
- 阅读权限
- 60
- 注册时间
- 2010-8-17
- 最后登录
- 2021-9-5
|
If(condition&&GetGlobalVar(0)==0)
{
NewPrice=Q_AskPrice+ShiftUnit*MinMove*PriceScale;
A_SendOrder(Enum_Buy,Enum_Entry,Lots,NewPrice);
SetGlobalVar(0,1);
SetGlobalVar(5,open);
}
//--------------------------------------------------------------
if(A_TotalPosition!=0)
{
if (GetGlobalVar(5)==open)
{
SetTBProfileString(bdpKey,bdpKeylongcost,Text(A_BuyAvgPrice()));
mycost=Value(GetTBProfileString(bdpKey,bdpKeylongcost));
}
Else
{
mycost=mycost[1];
}
FileAppend("C:\\Formula.log","mycost = "+Text(mycost));
}
以这样的方式,在开仓bar能记录A_BuyAvgPrice()持仓价,但是新bar出现后,读数就变成无效值了。如何把开仓bar的持仓价写入数据库并在新bar出现后仍然能传递下去? |
|