 
等级: 超级版主
- 注册:
- 2021-5-18
- 曾用名:
|
// 名称: 价格基准网格策略
//------------------------------------------------------------------------
input:手数(30000,100,999000,100); //开仓手数参数
// 定义变量
variable:baseprice=c; // 基准价初始化为当前收盘价
// 买多条件
开多条件 := c <= baseprice * (1 - 0.005); // 当前价格下跌0.5%
// 平多条件
平多条件 := c >= baseprice * (1 + 0.006); // 当前价格上涨0.6%
// 执行交易
if 开多条件 and holding<1 then begin
buy(1, 手数, limitr, c); // 以当前价格限价开多
lasttradeprice := c; // 记录成交价
baseprice := lasttradeprice; // 更新基准价
end
if 平多条件 and holding>0 then begin
sell(1, 手数, limitr, c); // 以当前价格限价平多
lasttradeprice := c; // 记录成交价
baseprice := lasttradeprice; // 更新基准价
end |
|