Data cycle: about 30 minutes
Support: Digital Currency Spot, Digital currency Futures
Support: Commodity futures
Digital Currency backtest:
- Main chart:
upper line, formula: UPPERBAND^^AVGVALUE + SHIFTVALUE;
lower line, formula: LOWERBAND^^AVGVALUE - SHIFTVALUE; - Secondary chart:
standard deviation, formula: STDS: STD (C, 10);
standard deviation, formula: STDL: STD (C, 60);
(*backtest
start: 2018-05-01 00:00:00
end: 2018-06-30 00:00:00
period: 1h
exchanges: [{"eid":"Futures_OKCoin","currency":"BTC_USD"}]
args: [["ContractType","this_week",126961]]
*)
TPRICE:=(HIGH+LOW+OPEN+CLOSE)/4;
AVGVALUE:=MA(TPRICE,N);
// Find the maximum of these three values:
highest price minus lowest price,
the absolute value of (closing price a cycle ago minus the highest price),
the absolute value of (closing price a cycle ago minus the lowest price)
TR:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
SHIFTVALUE:=MA(TR,N);// Find the simple moving average of TR in N cycles
UPPERBAND^^AVGVALUE + SHIFTVALUE;
LOWERBAND^^AVGVALUE - SHIFTVALUE;
STDS:STD(C,10);
STDL:STD(C,60);
BKVOL=0 AND HIGH >= UPPERBAND AND STDS>=STDL,BPK;
SKVOL=0 AND LOW <= LOWERBAND AND STDS>=STDL,SPK;
BKVOL>0 AND BKHIGH-BKPRICE>=0.2*CLOSE AND C<LOWERBAND,SP;
SKVOL>0 AND SKPRICE-SKLOW>=0.2*CLOSE AND C>UPPERBAND,BP;
//Stop loss
C>=SKPRICE*(1+STOPRANGE*0.01),BP;
C<=BKPRICE*(1-STOPRANGE*0.01),SP;
AUTOFILTER;
Backtest on FMZ Quant to know more
Source Code: https://www.fmz.com/strategy/128121