- 精华
- 0
- 在线时间
- 675 小时
- UID
- 110114
- 积分
- 380
- 帖子
- 314
- 阅读权限
- 50
- 注册时间
- 2012-4-20
- 最后登录
- 2021-12-29
- 精华
- 0
- UID
- 110114
- 积分
- 380
- 帖子
- 314
- 主题
- 16
- 阅读权限
- 50
- 注册时间
- 2012-4-20
- 最后登录
- 2021-12-29
|
发表于 2020-8-20 10:07:30
|显示全部楼层
- Params
- Numeric BarAmount(20);
- Numeric Lots(3);
- Vars
- NumericSeries IdxCloseBar;
- Numeric i;
- Begin
- If(BarStatus == 0)
- {
- IdxCloseBar = 1;
- SetGlobalVar(0, 0); // 开仓标识
- Return;
- }
-
- If(Close > Close[IdxCloseBar[1]])
- IdxCloseBar = IdxCloseBar[1] + 1;
- Else
- IdxCloseBar = 1;
-
- // 开多仓
- If(IdxCloseBar[1] == BarAmount + 1 and GetGlobalVar(0) == 0)
- {
- Buy(Lots, 0);
- SetGlobalVar(0, 1); // 标识开多仓
- }
-
- // 平多仓(1)(不在开仓K线平仓)
- If(MarketPosition == 1 and Close >= EntryPrice + 100)
- Sell(2, 0);
-
- // 多仓全平
- 逻辑同理....
- 平仓后要加语句SetGlobalVar(0, 0);
-
- End
复制代码 |
|