Policy Name: High Winning Rate - ORB Trading Strategy

Data Cycle: Daily

Support: Commodity Futures

  • Main chart:
    MA, formula: MAC ^^ MA (CLOSE, LENGTH);
    MA of highest price, formula: MA_HH^^ MA (HHHV (HIGH, LENGTH), LENGTH;
    MA of lowest price, formula: MA_LL^^ MA (LLV (LOW, LENGTH), LENGTH;
    Upper track, formula: UPBAND ^^ O_TODAY + BAND;
    Lower track, formula: DOWNBAND ^^ O_TODAY-BAND;
  • Secondary chart:
    none
(*backtest
start: 2018-03-01 00:00:00
end: 2018-09-30 00:00:00
period: 1d
exchanges: [{"eid":"Futures_CTP","currency":"FUTURES"}]
args: [["ContractType","rb888",126961]]
*)

NN:=BARSLAST(DATE<>REF(DATE,1))+1;
LENGTH_DAY:=HHV(NN,NN+62);
O_TODAY:=VALUEWHEN(NN=1,OPEN);
H_TODAY:=HHV(HIGH,NN);
L_TODAY:=LLV(LOW,NN);
H_YESTERDAY:=REF(H_TODAY,NN);
L_YESTERDAY:=REF(L_TODAY,NN);
C_YESTERDAY:=REF(C,NN);
LENGTH:=N_DAY*LENGTH_DAY;
DISTANCE:=MA(H_YESTERDAY-L_YESTERDAY,LENGTH);
ORB:=MIN(ABS(H_YESTERDAY-C_YESTERDAY),ABS(L_YESTERDAY-C_YESTERDAY));
BAND:=MAX(ORB,DISTANCE*0.1);
UPBAND^^O_TODAY+BAND;
DOWNBAND^^O_TODAY-BAND;
MAC^^MA(CLOSE,LENGTH);
MA_HH^^MA(HHV(HIGH,LENGTH),LENGTH);
MA_LL^^MA(LLV(LOW,LENGTH),LENGTH);

BUYPK:=CLOSE>UPBAND AND CLOSE>MAC AND CLOSE>MA_HH;
SELLPK:=CLOSE<DOWNBAND AND CLOSE<MAC AND CLOSE<MA_LL;
SELLY:=CLOSE<MAC AND CLOSE>BKPRICE;
BUYY:=CLOSE>MAC AND CLOSE<SKPRICE;

IF BARPOS>LENGTH THEN
BEGIN 
	BKVOL=0 AND BUYPK,BPK;
	SKVOL=0 AND SELLPK,SPK;
END
SELLY,SP(BKVOL);
BUYY,BP(SKVOL);

Backtest on FMZ Quant to know more

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

Leave a Reply

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