- 精华
- 20
- 在线时间
- 2981 小时
- UID
- 4
- 积分
- 22709
- 帖子
- 4802
- 阅读权限
- 255
- 注册时间
- 2007-7-20
- 最后登录
- 2024-1-15
- 精华
- 20
- UID
- 4
- 积分
- 22709
- 帖子
- 4802
- 主题
- 64
- 阅读权限
- 255
- 注册时间
- 2007-7-20
- 最后登录
- 2024-1-15
|
看看下面的代码,我测试过,这样可以的
- Vars
- Numeric curBuy(0);
- Numeric TotalProfitTarget(100);
- Begin
- If(BarStatus == 0)
- {
- SetGlobalVar(0,0);
- }else If(BarStatus == 2)
- {
- curBuy = GetGlobalVar(0);
-
- If(A_BuyPosition == 0)
- curBuy = 0;
- else if(curBuy == 0 && A_BuyPosition > 0 )
- curBuy = 1;
- else if(curBuy == 1 && A_BuyProfitLoss >= TotalProfitTarget)
- curBuy = 2;
- SetGlobalVar(0,curBuy);
- FileAppend("d:\\Log.txt","CurrentBar="+Text(CurrentBar)+"BarCount is : "+Text(BarCount));
- FileAppend("d:\\Log.txt","CurBuy is : "+Text(CurBuy)+",A_BuyPosition is : "+Text(A_BuyPosition));
- }
- End
复制代码 |
|