Trading Strategy ADX/ADM
Forums › ProRealTime English forum › ProOrder support › Trading Strategy ADX/ADM
- This topic has 7 replies, 4 voices, and was last updated 7 years ago by gabri.
-
-
02/20/2017 at 12:18 PM #25732
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 foreclosurefor 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 dayCalculation 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:
1234567891011121314AAA=(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])/26AAB=(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,es3There is also someone that tried without success to code the strategy here:
Qui sotto il codice PRT per l’ADM daily:
***********************************
1234567891011121314151617181920212223242526272829//Settaggio ADMX = 30admX=0FOR i=1 TO X DOadmX=admX+(Dhigh(i)- Dlow(i))NEXTadmX = admX / X//Settaggio ADM per calcolo PriceBreakY = 10admY=0FOR i=1 TO Y DOadmY=admY+(Dhigh(i)- Dlow(i))NEXTadmY = admY / Y//PriceBreak = 0.324PriceBreak = (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:
*********************
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162// Definizione dei parametri del codiceDEFPARAM CumulateOrders = false // Posizioni cumulate disattivate//DEFPARAM FlatAfter = 170000//DEFPARAM FlatBefore = 090000//PARAMETRIEntryLong, EntryShort, tp1L, tp2L, tp3L, tp1s, tp2s, tp3s= CALL "Xinian ADM Daily X"numerocontratti = 1OraInizio = 2.1OraFine = 23.00ora=currenthourcondizioneday= ora > OraInizio and ora < OraFine// Condizioni per entrare su posizioni longIF NOT LongOnMarket AND Close >= EntryLong AND high[0] < tp1l and condizioneday THENBUY 3*numerocontratti CONTRACTS AT MARKETENDIF// Condizioni per uscire da posizioni longIf LongOnMarket AND COUNTOFPOSITION = 3*numerocontratti thensell 1*numerocontratti contracts at tp1L[ barindex - tradeindex(1) +1 ] limitsell 3*numerocontratti contracts at EntryShort stopENDIFIf longonmarket and countofposition = 2*numerocontratti thensell 1*numerocontratti contracts at tp2L[ barindex - tradeindex(2) +1 ] limitsell 2*numerocontratti contracts at tradeprice(2) stopendifIf longonmarket and countofposition = 1*numerocontratti thensell 1*numerocontratti contracts at tp3L[ barindex - tradeindex(3) +1 ] limitsell 1*numerocontratti contracts at tp1L[ barindex - tradeindex(3) +1 ]stopendif// Condizioni per entrare su posizioni shortIF NOT ShortOnMarket AND Close <= EntryShort and low[0]>tp1s and condizioneday THENSELLSHORT 3*numerocontratti CONTRACTS AT MARKETENDIF// Condizioni per uscire da posizioni shortIf ShortOnMarket AND COUNTOFPOSITION = -3*numerocontratti thenEXITSHORT 1*numerocontratti contracts at tp1S[ barindex - tradeindex(1) +1 ] limitEXITSHORT 3*numerocontratti contracts at EntryLong stopENDIFIf ShortOnMarket and countofposition = -2*numerocontratti thenEXITSHORT 1*numerocontratti contracts at tp2S[ barindex - tradeindex(1) +1 ] limitEXITSHORT 2*numerocontratti contracts at tradeprice(2) stopendifIf ShortOnMarket and countofposition = -1*numerocontratti thenEXITSHORT 1*numerocontratti contracts at tp3S[ barindex - tradeindex(1) +1 ] limitEXITSHORT 1*numerocontratti contracts at tp1S[ barindex - tradeindex(3) +1 ]stopendif// 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.
02/20/2017 at 12:45 PM #25741Hi Alex, just out of interest (for me) and to try and keep Nicolas in good health … could you not see the ‘Insert PRT Code’ button by any chance at all? Often I can’t see it either.
I use Firefox and I have found by going Tools, Options, Privacy, Clear Recent History then I need only to tick ‘Site Preferences’ then Clear Now and refresh the PRC Site screen and I see the Insert PRC Code again. Takes me a few seconds but saves Nicolas and the Moderators several minutes and lots of frustration.
Just a few thoughts anyway, but I often wonder if fellow members can’t see the Insert PRt Code button also??
Cheers
GraHal1 user thanked author for this post.
02/20/2017 at 1:05 PM #2574502/20/2017 at 6:34 PM #25798Thanks Nicolas (and sorry for the extra-work),
I found the problem to replicate the original system with this code, the person who made the system code didn’t put the Flatzone condition into the system and didn’t use ADX for stay or exit position as Xinian recommended. And no optimization of various part of the code.
I will try to create the basics code for this system in the next days as the initial indications.
02/20/2017 at 8:03 PM #2580702/21/2017 at 11:21 AM #25859Here, the code of the original xin idea. With the incorporated ADM indicator.
- Condition entry with 3 position= cross over entry ADMLong
- Exit 1 position at TargetPprofitLong1, 1 Position TPL2, 1 position TPL3
- Stop loss at start ShortProfit1, after TP1 moved to EntryLong, after TP2 moved to TP1
- Filter: DI+ DI- distance min 66%,
- Entry level calc: Pricebreak formula
- Multiday filter if at the end of the day we are on market, with ADX condition: if ADX>25 stay on market else exit
The original Xin strategy have on dax the double profit and the half DD but is optimized time by time, i don’t know with which frequency.
Maybe can be useful for someone have this code.
Comment or suggestion?
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128//Version beta 0.1// Definizione dei parametri del codiceDEFPARAM CumulateOrders = false // Posizioni cumulate disattivate//DEFPARAM FlatAfter = 170000//DEFPARAM FlatBefore = 080000//INDICATORE ADMn=85admX=0FOR i=1 TO n DOadmX=admX+(Dhigh(i)- Dlow(i))NEXTadmX = admX / n//setting ADM for PriceBreaky=10admY=0FOR i=1 TO Y DOadmY=admY+(Dhigh(i)- Dlow(i))NEXTadmY = admY / Y//PRICEBREAKPB=0.326PriceBreak = (PB+PB*((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))//FLATZONEflatzone=0.66//CALC FLATZONE LONGflatlong=0if DIplus[14](close) > DIminus[14](close)+(DIminus[14](close)*flatzone) thenflatlong=1elseflatlong=0endif//CALCOLO FLATZONE SHORTflatSHORT=0if DIplus[14](close) < Diminus[14](close)-(DIminus[14](close)*flatzone) thenflatshort=1elseflatshort=0endif//CONDIZIONE ADX for multiday open positionif ADX[14]>ADXR[14] and ADX[14]>25 thenADXcond=1elseADXcond=0endifnumerocontratti = 1OraInizio = 09.00OraFine = 21.00ora=currenthourcondizioneday= ora > OraInizio and ora < OraFine// LongIF NOT LongOnMarket AND Open <= EntryLong and Close >= EntryLong AND high[0] < tp1l and condizioneday and flatlong=1 THENBUY 3*numerocontratti CONTRACTS AT MARKETENDIF// EXIT longIf LongOnMarket AND COUNTOFPOSITION = 3*numerocontratti thensell 1*numerocontratti contracts at tp1L[ barindex - tradeindex(1) +1 ] limitsell 3*numerocontratti contracts at EntryShort stopENDIFIf longonmarket and countofposition = 2*numerocontratti thensell 1*numerocontratti contracts at tp2L[ barindex - tradeindex(2) +1 ] limitsell 2*numerocontratti contracts at tradeprice(2) stopendifIf longonmarket and countofposition = 1*numerocontratti thensell 1*numerocontratti contracts at tp3L[ barindex - tradeindex(3) +1 ] limitsell 1*numerocontratti contracts at tp1L[ barindex - tradeindex(3) +1 ]stopendif//Multiday decisionif currenthour=OraFine and longonmarket thenif ADXcond=0 thenSELL AT MARKETendifendif// Condizioni per entrare su posizioni shortIF NOT ShortOnMarket AND Open >= EntryShort and Close <= EntryShort and low[0]>tp1s and condizioneday and flatshort=1 THENSELLSHORT 3*numerocontratti CONTRACTS AT MARKETENDIF// Condizioni per uscire da posizioni shortIf ShortOnMarket AND COUNTOFPOSITION = -3*numerocontratti thenEXITSHORT 1*numerocontratti contracts at tp1S[ barindex - tradeindex(1) +1 ] limitEXITSHORT 3*numerocontratti contracts at EntryLong stopENDIFIf ShortOnMarket and countofposition = -2*numerocontratti thenEXITSHORT 1*numerocontratti contracts at tp2S[ barindex - tradeindex(1) +1 ] limitEXITSHORT 2*numerocontratti contracts at tradeprice(2) stopendifIf ShortOnMarket and countofposition = -1*numerocontratti thenEXITSHORT 1*numerocontratti contracts at tp3S[ barindex - tradeindex(1) +1 ] limitEXITSHORT 1*numerocontratti contracts at tp1S[ barindex - tradeindex(3) +1 ]stopendifif currenthour=OraFine and ShortOnMarket thenif ADXcond=0 thenEXITSHORT AT MARKETendifendif02/27/2017 at 10:17 AM #2649304/13/2017 at 7:29 PM #31983 -
AuthorPosts
Find exclusive trading pro-tools on