Hello everybody,
i think can be beautiful to create an automatization of ADX/ADM trading from the system by xinian. His system is very polular on italian finance forum. And he have a blog xinian.altervista.org.
His system can be applied on a lot of index and commodities and have a very good return for example DAX 26% annually and a max DD of 6%. Look the attachment.
I post his indication for his strategy:
The TS ADX / ADM
The ADX or Average Directional Index is an excellent medium-term indicator, however, It indicates only the strength of the trend and not its direction.
The ADX value can be between 0 and 100. Typically, a trend characterized by a ADX below 20 is considered weak, while above 25 is considered strong.
Much more useful indicators + DI (Positive Directional Indicator) and -DI (Negative Directional Indicator), considering their average to 14 days: + DI14 -DI14 in green and red.
Their intersections determinate the direction of the trend.
+ DI14> -DI14 FlatZone + = LONG
+ DI14 <-DI14-Flatzone = SHORT
FLAT in -Flatzone + Flatzone crossover band
the Flatzone was -10% + 10% in older versions, now it is also calculated on the basis of periodic backtest
ADM or Average Daily Movement is an indicator based on the Intraday volatility
They are given daily 2 entry (Long or Short) and 3 Take Profit (Long and Short)
Operationally:
you enter long / short if the hourly closing (at 10, at 11, etc.) the index value is above / below the Entry long / short daily then
if it does not arrive within the TP xx closure:
-if we are in trend (see ADX) you go over and the next day closes if it enters the reverse signal
-if we controtrend (ADX contrary) closes in foreclosure
for example…
the signal I enter long with 3 positions (3 contracts, etc …)
the 1st pos goes to take profit on the TP1 (at bat)
the 2nd on TP2 (at bat) once made the TP1 (hourly candle) gets up the stop loss sull’entry
the 3rd on TP3 (at bat) once made the TP2 (hourly candle) gets up the stop loss on TP1
– If ADX is FLAT or LONG, if he has not reached a target moves into the position over … ..
the day after reaching the TP1 will sell all positions and expect the new signals, but if it does not reach the former tp1 but enters the entry contrary closes everything and it’s reversal.
– If ADX is better to close it SHORT day
Calculation of intraday levels
ADM is the average of N-days of daily volatility (Max-Min), average days in N …
I now calculating periodically according to the backtest and you find it in the upper left in the graph, in early versions of the TS I used the value of 30 days, which is good enough
, Others use other values ..
the input levels are calculated in this way
The entry levels are calculated this way:
the standard theory says to use a break-out level = 0.382 (Price Break), lately I’m calculating each day based on volatility
(Closed on previous + Price Break * ADM Ndays) gives us the Entry Long
(Closing the previous day – Price Break * ADM Ndays) gives us the Entry Short
DayC = previous closing day
C = current price
Long Entry C => ((DayC) + ((Price Break) * (ADM Ndays)));
Entry Short = C <((DayC) – ((* Price Break (ADM Ndays)));
I noticed, however, when volatility increases the price break place to 0.382 generate several false signals
Therefore, since version 3.0 I’m experiencing this formula …
Price Break = (0.382 + 0.382 * ((10 days ADM-ADM Ndays) / ADM Ndays))
The targets are determined as … instead.
Target 1 = Long (12:45 * ADM) + Entry Long;
Target 2 Long = (0.95 * ADM) + Entry Long;
Target 3 Long = (1.95 * ADM) + Entry Long;
Target 1 = Entry Short Short- (12:45 * ADM);
Target = Entry 2 Short Short- (0.95 * ADM);
Target = 3 Short Entry Short- (1.95 * ADM);
This is the ADM code for the indicator 1h timeframe:
AAA=(DHigh(1)-DLow(1))
admn=(AAA[26]+(AAA)[25]+(AAA)[24]+(AAA)[23]+(AAA)[22]+(AAA)[21]+(AAA)[20]+(AAA)[19]+(AAA)[18]+(AAA)[17]+(AAA)[16]+(AAA)[15]+(AAA)[14]+(AAA)[13]+(AAA)[12]+(AAA)[11]+(AAA)[10]+(AAA)[9]+(AAA)[8]+(AAA)[7]+(AAA)[6]+(AAA)[5]+(AAA)[4]+(AAA)[3]+(AAA)[2]+(AAA)[1])/26
AAB=(DCLOSE(1))
El=(AAB+(0.266*admn))
es=(AAB-(0.266*admn))
el1=((0.45*admn)+el)
el2=((0.95*admn)+el)
el3=((1.95*admn)+el)
es1=(es-(0.45*admn))
es2=(es-(0.95*admn))
es3=(es-(1.95*admn))
RETURN el,es,el1,el2,el3,es1,es2,es3
There is also someone that tried without success to code the strategy here:
Qui sotto il codice PRT per l’ADM daily:
***********************************
//Settaggio ADM
X = 30
admX=0
FOR i=1 TO X DO
admX=admX+(Dhigh(i)- Dlow(i))
NEXT
admX = admX / X
//Settaggio ADM per calcolo PriceBreak
Y = 10
admY=0
FOR i=1 TO Y DO
admY=admY+(Dhigh(i)- Dlow(i))
NEXT
admY = admY / Y
//PriceBreak = 0.324
PriceBreak = (0.382+0.382*((admY-admX)/admX))
EntryLong=(Dclose(1)+(PriceBreak*admX))
EntryShort=(Dclose(1)-(PriceBreak*admX))
tp1L=((0.45*admX)+EntryLong)
tp2L=((0.95*admX)+EntryLong)
tp3L=((1.95*admX)+entryLong)
tp1S=(EntryShort-(0.45*admX))
tp2S=(EntryShort-(0.95*admX))
tp3S=(EntryShort-(1.95*admX))
RETURN EntryLong COLOURED(0, 255, 0),EntryShort COLOURED(255, 0, 0), tp1L COLOURED(0, 0, 255),tp2L,tp3L,tp1S COLOURED(0, 0, 255),tp2S,tp3S
**********************
QUI SOTTO INVECE IL CODICE DEL SISTEMA DI TRADING:
*********************
// Definizione dei parametri del codice
DEFPARAM CumulateOrders = false // Posizioni cumulate disattivate
//DEFPARAM FlatAfter = 170000
//DEFPARAM FlatBefore = 090000
//PARAMETRI
EntryLong, EntryShort, tp1L, tp2L, tp3L, tp1s, tp2s, tp3s= CALL "Xinian ADM Daily X"
numerocontratti = 1
OraInizio = 2.1
OraFine = 23.00
ora=currenthour
condizioneday= ora > OraInizio and ora < OraFine
// Condizioni per entrare su posizioni long
IF NOT LongOnMarket AND Close >= EntryLong AND high[0] < tp1l and condizioneday THEN
BUY 3*numerocontratti CONTRACTS AT MARKET
ENDIF
// Condizioni per uscire da posizioni long
If LongOnMarket AND COUNTOFPOSITION = 3*numerocontratti then
sell 1*numerocontratti contracts at tp1L[ barindex - tradeindex(1) +1 ] limit
sell 3*numerocontratti contracts at EntryShort stop
ENDIF
If longonmarket and countofposition = 2*numerocontratti then
sell 1*numerocontratti contracts at tp2L[ barindex - tradeindex(2) +1 ] limit
sell 2*numerocontratti contracts at tradeprice(2) stop
endif
If longonmarket and countofposition = 1*numerocontratti then
sell 1*numerocontratti contracts at tp3L[ barindex - tradeindex(3) +1 ] limit
sell 1*numerocontratti contracts at tp1L[ barindex - tradeindex(3) +1 ]stop
endif
// Condizioni per entrare su posizioni short
IF NOT ShortOnMarket AND Close <= EntryShort and low[0]>tp1s and condizioneday THEN
SELLSHORT 3*numerocontratti CONTRACTS AT MARKET
ENDIF
// Condizioni per uscire da posizioni short
If ShortOnMarket AND COUNTOFPOSITION = -3*numerocontratti then
EXITSHORT 1*numerocontratti contracts at tp1S[ barindex - tradeindex(1) +1 ] limit
EXITSHORT 3*numerocontratti contracts at EntryLong stop
ENDIF
If ShortOnMarket and countofposition = -2*numerocontratti then
EXITSHORT 1*numerocontratti contracts at tp2S[ barindex - tradeindex(1) +1 ] limit
EXITSHORT 2*numerocontratti contracts at tradeprice(2) stop
endif
If ShortOnMarket and countofposition = -1*numerocontratti then
EXITSHORT 1*numerocontratti contracts at tp3S[ barindex - tradeindex(1) +1 ] limit
EXITSHORT 1*numerocontratti contracts at tp1S[ barindex - tradeindex(3) +1 ]stop
endif
// Stop e target
//SET STOP %LOSS 2
//SET TARGET %PROFIT 1
*********************
I’m not a good programmer but maybe someone can find this information interesting and can process a better system. And with the automatic trading system active it will be great to optimize it with a good money management or a seasonal optimization.