Data cycle: multiple cycles

Backtest can choose OKEX futures

Contract: this_week contract

  • Main chart:
    none
  • Secondary chart:
    VJQ, calculation formula: VJQ: EMA (V* (C-REF (C, NC)), N)
(*backtest
start: 2018-04-01 00:00:00
end: 2018-05-28 00:00:00
period: 1h
exchanges: [{"eid":"Futures_OKCoin","currency":"BTC_USD"}]
args: [["N",100],["MINAMOUNT",10],["TradeAmount",10,126961],["ContractType","this_week",126961]]
*)

LOTS:=MAX(MINAMOUNT,INTPART(MONEYTOT/O * 0.8));
VJQ:EMA(V*(C-REF(C,NC)),N);
B:=VJQ>0;//Define long
S:=VJQ<0;//Define short
BUYPK:=BARPOS>N AND BKVOL=0 AND B AND H>=HHV(H,N);
SELLPK:=BARPOS>N AND SKVOL=0 AND S AND L<=LLV(L,N);
BUYP:=SKVOL>0 AND B;
SELLP:=BKVOL>0 AND S;

// Enter
SELLPK,SPK(LOTS);
BUYPK,BPK(LOTS);

// Leave
BUYP,BP(SKVOL);
SELLP,SP(BKVOL);

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

Backtest on FMZ Quant to know more

Source Codehttps://www.fmz.com/strategy/128125

Leave a Reply

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