Channel strategy based on ATR volatility indicator

ATR, also known as Average true range, was invented by J. Welles Wilder. The ATR indicator is mainly used to measure the intensity of market volatility, that is, the indicator to show the market change rate.

This indicator is mainly used to measure price fluctuations. 
 It is important to remember that ATR does not provide an indication of price direction, just volatility.

This indicator is typical for long periods of sustained marginal movement, which usually occurs at the top of the market or during price consolidation. The principle of prediction according to this indicator can be expressed as: the higher the value of the indicator, the higher the possibility of the trend change; the lower the value of the indicator, the weaker the mobility of the trend.

Idea: channel adaptive strategy, fixed stop loss + floating take profit

Applicable software: FMZ Quant / webstock

Data cycle: multiple cycles

Data contract: index contract

Trading Contract: Commodity Futures /Digital Currency

(*backtest
start: 2018-11-01 00:00:00
end: 2018-12-01 00:00:00
period: 1h
exchanges: [{"eid":"Futures_OKCoin","currency":"BTC_USD"}]
args: [["ContractType","this_week",126961]]
*)

SLOSS:=2;
N:=200;
M:=4;
X:UNIT;
TR1:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR:=MA(TR1,N);
MAC:=MA(C,N);
UBAND:=MAC+M*ATR;
DBAND:=MAC-M*ATR;
H>=HHV(H,N),BPK;
L<=LLV(L,N),SPK;
(H>=HHV(H,M*N) OR C<=UBAND) AND BKHIGH>=BKPRICE*(1+M*SLOSS*0.01),SP;
(L<=LLV(L,M*N) OR C>=DBAND) AND SKLOW<=SKPRICE*(1-M*SLOSS*0.01),BP;
//stop loss
C>=SKPRICE*(1+SLOSS*0.01),BP;
C<=BKPRICE*(1-SLOSS*0.01),SP;
AUTOFILTER;

---------------------------- 

Backtest  on FMZ Quant to know more

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

One Comment

Add a Comment

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