资源加载中... loading...

高胜率ORB交易策略

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

  • 策略名称:高胜率ORB交易策略

  • 数据周期:日K

  • 支持:商品期货

  • 官方网站:www.quantinfo.com

    img

  • 主图: 均线, 公式:MAC^^MA(CLOSE,LENGTH); 最高价均线,公式:MA_HH^^MA(HHV(HIGH,LENGTH),LENGTH); 最低价均线,公式:MA_LL^^MA(LLV(LOW,LENGTH),LENGTH);

    上轨,公式:UPBAND^^O_TODAY+BAND; 下轨,公式:DOWNBAND^^O_TODAY-BAND;

  • 副图: 无


(*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);

template: strategy.tpl:40:21: executing "strategy.tpl" at <.api.GetStrategyListByName>: wrong number of args for GetStrategyListByName: want 7 got 6