Strategy Name: Double MA and Formation Strategy

Support: Commodity Futures, Digital Currency Spot, Digital Currency Futures

Data cycle: 15M

  • Main chart:
    MA index, formula: VAR3 ^^ MA (VAR2, PARAM1);
    EMA index, formula: VAR4 ^ ^ EMA (VAR3, PARAM2);
  • Secondary chart:
    none
(*backtest
start: 2018-05-02 00:00:00
end: 2018-06-21 00:00:00
period: 15m
exchanges: [{"eid":"Futures_BitMEX","currency":"XBT_USD"}]
args: [["TradeAmount",1000,126961],["SlideTick",10,126961],["ContractType","XBTUSD",126961]]
*)

DIRECTION:=0;        // Direction control

VAR2:=(HIGH+LOW+CLOSE)/3;
VAR3^^MA(VAR2,PARAM1);
VAR4^^EMA(VAR3,PARAM2);
BOOL1:=CLOSE>REF(C,1) AND HIGH>REF(HIGH,1) AND CLOSE>OPEN;
BOOL2:=CLOSE<REF(C,1) AND LOW<REF(LOW,1) AND CLOSE<OPEN;

BUYPK:=BARPOS>PARAM1 AND CLOSE>VAR3 AND BOOL1 AND VAR3>VAR4;
SELLPK:=BARPOS>PARAM1 AND CLOSE<VAR3 AND BOOL2 AND VAR3<VAR4;

BUYJ:=CLOSE>BKPRICE AND BUYPK;
SELLJ:=CLOSE<SKPRICE AND SELLPK;
SELLS:=CLOSE<BKPRICE*(1-PARAM3*0.01);
BUYS:=CLOSE>SKPRICE*(1+PARAM3*0.01);

BKVOL=0 AND BUYPK AND DIRECTION>=0,BPK;
SKVOL=0 AND SELLPK AND DIRECTION<=0,SPK;
BKVOL>0 AND BUYJ,BK;
SKVOL>0 AND SELLJ,SK;
SELLS,SP;
BUYS,BP;
AUTOFILTER;

Backtest on FMZ Quant to know more

Source Code: https://www.fmz.com/strategy/129079

Leave a Reply

Your email address will not be published. Required fields are marked *