- 精华
- 0
- 在线时间
- 26 小时
- UID
- 242461
- 积分
- 32
- 帖子
- 23
- 阅读权限
- 10
- 注册时间
- 2016-10-31
- 最后登录
- 2020-10-12
- 精华
- 0
- UID
- 242461
- 积分
- 32
- 帖子
- 23
- 主题
- 9
- 阅读权限
- 10
- 注册时间
- 2016-10-31
- 最后登录
- 2020-10-12
|
if(A_BuyPosition()==0 and A_SellPosition()==0) SetGlobalVar(2,0);
If(GetGlobalVar(2)==InvalidNumeric)
{
SetGlobalVar(2,0);
}
cond1=(GetGlobalVar(2));
BUYSS=A_BuyPosition;
PlotString("GetGlobalVar(2)",text(GetGlobalVar(2)),0,red);
ApriceDD=Text(A_BuyAvgPrice);
ApriceD=Value(ApriceDD);
MyOffset = MinMove*PriceScale;
//开仓;
If(TimesToday<TimesMaxToday And CurrentBar>90 AND CMM>NN )
{
If(A_BuyPosition()==0 and cond1==0)
{
If(开多条件 )
{
A_SendOrder(Enum_Buy,Enum_Entry,1,Q_AskPrice +
MyOffset);
SetGlobalVar(2,1);
ddd=1;
PlotString("d",Text(ddd),0,Yellow);
TimesToday = TimesToday+1;
Return;
}
}
If(A_SellPosition()==0 or MarketPosition==0 and cond1==0)
{
If( 开空条件)
{
A_SendOrder(Enum_Sell,Enum_Entry,1,Q_BidPrice -
MyOffset);
SetGlobalVar(2,3);
ddd=3;
PlotString("d",Text(ddd),0,Blue);
TimesToday = TimesToday+1;
Return;
}
}
}
//止损;
if(A_SellPosition>0 and cond1==3)
{
if(AA>BB)
{
A_SendOrder(Enum_Buy,Enum_Exit,A_SellPosition(),Q_AskPrice +
MyOffset);
SetGlobalVar(2,0);
ddd=8;
PlotString("d",Text(ddd),0,Blue);
}
}
if(A_BuyPosition>0 and cond1==1)
{
if(AA<=BB)
{
A_SendOrder(Enum_Sell,Enum_Exit,A_BuyPosition(),Q_BidPrice -
MyOffset);
SetGlobalVar(2,0);
ddd=8;
PlotString("d",Text(ddd),0,Blue);
}
}
}
是不是我全局变量设置的有问题? |
|