리소스 로딩... 로딩...

트레이드04 - 쌍평선 + ATR 통로 + 높고 낮다

저자:작가: 트레이드맨, 날짜: 2023-09-04 22:30:48
태그:

FMZ 플랫폼과 커뮤니티를 통해 전략, 코드, 아이디어, 템플릿을 공유합니다.

자막: 가격 요인 조합

연락처 (교류 토론, 공동 학습 진전) WECHAT: haiyanyydss TEL:https://t.me/JadeRabbitcm완전 자동 CTA 및 HFT 거래 시스템 @2018 - 2023


(*backtest
start: 2018-01-01 00:00:00
end: 2021-06-30 23:59:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_OKCoin","currency":"BTC_USD","stocks":10}]
args: [["percent",5],["ContractType","quarter",126961]]
*)


//商品版本
LENGTH2:=10*LENGTH1;//长周期参数
X:=3;//区间系数

//交易量 
//LOTS:=MAX(1,INTPART(percent/100*MONEY/(C*MARGIN*UNIT)));//金本
LOTS:=MAX(1,INTPART(percent/100*MONEY*C/(MARGIN*UNIT)));//币本
	
TR:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR:=MA(TR,LENGTH1);
OO:=BARSLAST(DATE<>REF(DATE,1))+1;
OPD:=VALUEWHEN(OO=1,O);
					     	
L1:=MIN(LENGTH1,LENGTH2);
L2:=MAX(LENGTH1,LENGTH2);
MA1:=EMA(REF(C,1),L1);     
MA2:=EMA(REF(C,1),L2);
					     	
UPPERBAND^^OPD+X*ATR;
LOWERBAND^^OPD-X*ATR;
EXITLONG:=REF(L,L2);
EXITSHORT:=REF(H,L2);
	
//多头入场 
BKVOL<=0 AND REF(C,1) >= REF(UPPERBAND,1) AND VOL > 0 AND MA1>MA2 AND REF(C,1) >=REF(H,L1) ,BPK(LOTS);
//空头入场	
SKVOL<=0 AND REF(C,1) <= REF(LOWERBAND,1) AND VOL > 0 AND MA1<MA2 AND REF(C,1) <=REF(L,L1) ,SPK(LOTS);
//多头出场
REF(C,1)>= BKPRICE  AND REF(C,1)<=EXITLONG AND BKVOL>0 AND BARPOS>0,SP(BKVOL); 
 //空头入场
REF(C,1)<= SKPRICE  AND REF(C,1)>=EXITSHORT AND SKVOL>0 AND BARPOS>0,BP(SKVOL);

더 많은