Loading ...

三均线顺势价格突破策略

Author: 扫地僧, Date: 2021-11-04 14:56:23
Tags: 商品期货 趋势 My语言

  • 公式名称:三均线顺势价格突破策略
  • 数据周期:多周期
  • 数据合约:指数合约
  • 交易合约:主力合约
  • 适合品种:商品期货
  • 官方网站:www.quantinfo.com

img


(*backtest
start: 2018-01-01 00:00:00
end: 2018-02-28 00:00:00
period: 1h
exchanges: [{"eid":"Futures_CTP","currency":"FUTURES","balance":20000}]
*)

LOTS:=MAX(1,INTPART(MONEYTOT/(O*UNIT*0.1)));

MA1^^MA(C,N1);
MA2^^MA(C,N2);
MA3^^MA(C,N3);

BUYK:=BARPOS>N3 AND BKVOL=0 AND MA1>MA2 AND MA2>MA3 AND C>MA1;
SELLK:=BARPOS>N3 AND SKVOL=0 AND MA1<MA2 AND MA2<MA3 AND C<MA1;
BUYP:=SKVOL>0 AND CROSS(C,MA2) AND C>MA1 AND C<=SKPRICE*(1-2*SLOSS*0.01);
SELLP:=BKVOL>0 AND CROSS(MA2,C) AND MA1>C AND C>=BKPRICE*(1+2*SLOSS*0.01);

BUYK,BK(LOTS);
SELLK,SK(LOTS);

// 止盈
// take profit
BUYP,BP(SKVOL);
SELLP,SP(BKVOL);

// 止损
// stop loss
C>=SKPRICE*(1+SLOSS*0.01),BP(SKVOL);
C<=BKPRICE*(1-SLOSS*0.01),SP(BKVOL);

相关内容

更多内容