Channel strategy based on ATR volatility indicator

Author: Zero, Date: 2018-11-27 13:18:38
Tags: ATRMyLanguage

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_BitMEX","currency":"XBT_USD"}]
args: [["ContractType","XBTUSD",126961]]
*)

SLOSS:=2;
N:=200;
M:=4;
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;
NH^^HHV(H,N);
NL^^LLV(L,N);
H>=NH,BPK;
L<=NL,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;
//止损 StopLoss
C>=SKPRICE*(1+SLOSS*0.01),BP;
C<=BKPRICE*(1-SLOSS*0.01),SP;
AUTOFILTER;

Related

More

momoxWhat do these two words mean? // that's right? ((highest price breaking the highest price of the four major cycles or falling off the Brin line) and the profit since the warehouse was built is 8%???? (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; and