- 精华
- 0
- 在线时间
- 194 小时
- UID
- 38084
- 积分
- 323
- 帖子
- 71
- 阅读权限
- 50
- 注册时间
- 2011-5-6
- 最后登录
- 2022-1-26
- 精华
- 0
- UID
- 38084
- 积分
- 323
- 帖子
- 71
- 主题
- 26
- 阅读权限
- 50
- 注册时间
- 2011-5-6
- 最后登录
- 2022-1-26
|
在其他策略公式模型有仓位的情况下,能否通过这个公式达到盈利点位平仓吗,
Params
Numeric offSet(1); // 委托价格偏移,为了保证成交
Numeric Length5(200);
Vars
Numeric DeleteOrderTickCounter;
Numeric HasSendOrder(0);
Numeric MinPoint;
Begin
MinPoint= MinMove*PriceScale;
If(BarStatus==2 && Time==0.091500 && CurrentTime <= 0.091500) return;
If(BarStatus == 0)
{
DeleteOrderTickCounter = 9999;
HasSendOrder = 0;
SetGlobalVar(0,DeleteOrderTickCounter);
SetGlobalVar(1,HasSendOrder);
}Else
{
DeleteOrderTickCounter = GetGlobalVar(0);
HasSendOrder = GetGlobalVar(1);
}
If(BarStatus == 2 && HasSendOrder == 0&&A_GetOpenOrderCount()==0)
{
If(A_BuyPosition >0&&High>A_BuyAvgPrice+Length5*MinPoint) // 平多单
{
A_SendOrder(Enum_Sell,Enum_Exit,offSet,A_BuyAvgPrice+Length5*MinPoint);
}
If(A_SellPosition > 0&&High>A_SellAvgPrice+Length5*MinPoint) //平空单
{
A_SendOrder(Enum_Buy,Enum_Exit,offSet,A_SellAvgPrice+Length5*MinPoint);
}
HasSendOrder = 1;
SetGlobalVar(1,HasSendOrder);
}
End |
|