DAX Aroon 30 min system
Forums › ProRealTime English forum › ProOrder support › DAX Aroon 30 min system
- This topic has 19 replies, 6 voices, and was last updated 7 years ago by Eric.
-
-
03/08/2017 at 1:46 PM #27745
This system is not mine (maybe someone here recognize it) i found it years ago think it was on prorealtime site
anyway this is the original code not optimized, the short side need improvements
maybe with changes and money management it can be something for the library?
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697DEFPARAM CumulateOrders=FalseREM Acquistoindicator1 = ExponentialAverage[20](close)indicator2 = ExponentialAverage[50](close)c1 = (indicator1 > indicator2[1])indicator3 = AroonUp[14]indicator4 = Aroondown[14]c2 = (indicator3 CROSSES OVER indicator4)indicator41 = Stochastic[14,3](close)c41 = (indicator41 < 75)indicator100 = closeindicator101 = Supertrend[2,10]c100 = indicator100 > indicator101IF c1 AND c2 AND c41 AND c100 THENBUY 1 contracts AT MARKETENDIFREM Venditaindicator5 = closeindicator6 = ExponentialAverage[20](close)c4 = (indicator5 < indicator6[1])indicator7 = AroonUp[14]indicator8 = AroonDown[14]c5 = (indicator7 < indicator8[1])IF c4 AND c5 THENSELL AT MARKETENDIFREM Vendita allo scopertoindicator9 = ExponentialAverage[20](close)indicator10 = ExponentialAverage[50](close)c6 = (indicator9 < indicator10[1])indicator11 = AroonUp[14]indicator12 = Aroondown[14]c7 = (indicator12 CROSSES OVER indicator11)indicator43 = Stochastic[14,3](close)c43 = (indicator43 > 25)indicator110 = closeindicator111 = Supertrend[2,10]c110 = indicator111 > indicator110IF c6 AND c7 AND c43 AND c110 THENSELLSHORT 1 contracts AT MARKETENDIFREM Riacquistoindicator13 = closeindicator14 = ExponentialAverage[20](close)c9 = (indicator13 > indicator14[1])indicator15 = AroonUp[14]indicator16 = AroonDown[14]c10 = (indicator15 > indicator16[1])IF c9 AND c10 THENEXITSHORT AT MARKETENDIF03/08/2017 at 1:54 PM #27747I have used a version live long only and removed stochastic and used a stoploss
maybe with some kind of trailing stop it would perform better?
2015 was pretty good but 2016 some draw down pre trump
its not rocket science and get rich quick but its profitable
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849DEFPARAM CumulateOrders=FalseREM Acquistoindicator1 = ExponentialAverage[20](close)indicator2 = ExponentialAverage[50](close)c1 = (indicator1 > indicator2[1])indicator3 = AroonUp[14]indicator4 = Aroondown[14]c2 = (indicator3 CROSSES OVER indicator4)indicator100 = closeindicator101 = Supertrend[2,10]c100 = indicator100 > indicator101IF c1 AND c2 AND c100 THENBUY 1 CONTRACTs AT MARKETENDIFREM Venditaindicator5 = closeindicator6 = ExponentialAverage[20](close)c4 = (indicator5 < indicator6[1])indicator7 = AroonUp[14]indicator8 = AroonDown[14]c5 = (indicator7 < indicator8[1])IF c4 AND c5 THENSELL AT MARKETENDIFSET STOP PLOSS 10003/08/2017 at 2:56 PM #2775503/08/2017 at 3:27 PM #2775903/08/2017 at 3:48 PM #2776404/03/2017 at 11:19 AM #30807It performs better with a trailing stop as you mentioned. Starting October 2015 it has a positiv result on FTSE100 too (30 min). The trailing stop function is from Nicolas blogpost.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152DEFPARAM CumulateOrders=FalseREM Acquistoindicator1 = ExponentialAverage[50](close)indicator2 = ExponentialAverage[90](close)c1 = (indicator1 > indicator2[1])indicator3 = AroonUp[14]indicator4 = Aroondown[14]c2 = (indicator3 CROSSES OVER indicator4)indicator100 = closeindicator101 = Supertrend[2,10]c100 = indicator100 > indicator101IF c1 AND c2 AND c100 THENBUY 1 CONTRACTs AT MARKETENDIFSET STOP PLOSS 150//trailing stoptrailingstop = 40//resetting variables when no trades are on marketif not onmarket thenMAXPRICE = 0MINPRICE = closepriceexit = 0endif//case SHORT orderif shortonmarket thenMINPRICE = MIN(MINPRICE,close) //saving the MFE of the current tradeif tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop thenpriceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price levelendifendif//case LONG orderif longonmarket thenMAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current tradeif MAXPRICE-tradeprice(1)>=trailingstop*pointsize then //if the MFE is higher than the trailingstop thenpriceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE - trailing stop price levelendifendif//exit on trailing stop price levelsif onmarket and priceexit>0 thenEXITSHORT AT priceexit STOPSELL AT priceexit STOPendif04/25/2017 at 11:59 AM #33315If anyone is interested, here’s the system with a Donchian stop loss.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263DEFPARAM CumulateOrders=Falseindicator1 = ExponentialAverage[50](close)indicator2 = ExponentialAverage[90](close)c1 = (indicator1 > indicator2[1])indicator3 = AroonUp[14]indicator4 = Aroondown[14]c2 = (indicator3 CROSSES OVER indicator4)indicator100 = closeindicator101 = Supertrend[2,10]c100 = indicator100 > indicator101IF c1 AND c2 AND c100 THENBUY 1 CONTRACTs AT MARKETENDIF// DONCHIAN STOPDC=70e= Highest[DC](high)f=Lowest[DC](low)if longonmarket thenlaststop = f[1]endifif shortonmarket thenlaststop = e[1]endifif onmarket thensell at laststop stopexitshort at laststop stopendif//trailing stoptrailingstop = 50if not onmarket thenMAXPRICE = 0MINPRICE = closepriceexit = 0endif//case SHORT orderif shortonmarket thenMINPRICE = MIN(MINPRICE,close) //saving the MFE of the current tradeif tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop thenpriceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price levelendifendif//case LONG orderif longonmarket thenMAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current tradeif MAXPRICE-tradeprice(1)>=trailingstop*pointsize then //if the MFE is higher than the trailingstop thenpriceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE - trailing stop price levelendifendif//exit on trailing stop price levelsif onmarket and priceexit>0 thenEXITSHORT AT priceexit STOPSELL AT priceexit STOPendif04/26/2017 at 7:36 PM #33568Hi guys,
@Eric, thank you for sharing this idea, which I quite like; @victormork thank you for your contribution with the stop logic.
I have optimized some of the logic statements and added few more “bells and whistles” (modules) to the system which can be easily switched on and off. Most of the modules are in the interest of increasing hit rate and reducing equity curve volatility.
As it stands, I have optimized a bit on DAX M30 and experimented a little on DAX H1. I think it may almost be ready to submit this to the library (Nicolas?) but hoping you guys will test it out and play around on different markets etc. Add or remove modules as you wish until it makes sense. I suggest to disengage all the modules when trying a new asset or asset class, optimize the basic variables and then add the modules one by one. Please post your results here.
The modules I have added are:
- Variable-set selection framework
You can optimize differently for whatever asset and timeframe and save the set inside a1elsif optimization = (x) then -
Soft time stop
The soft time stop simply counts the total number of bars of in loss endured during the trade (not consecutive but total bars of loss) and once a threshold is reached, triggers a break even signal so that the trade will at least break even if/when given the chance. The variable to adjust is softTimeStopBars (0 for off else positive number for number of bars in loss to trigger) -
Second chance Stop
The second chance stop, if engaged, monitors for a trade going into profit, followed by losing x% of the maximum gain (typically 70-90% retracement towards original entry). If this occurs a trigger is set to exit the trade when the gain reaches or exceeds the highest high of that trade’s equity curve (a second chance). The variable scRetraceTrigger is used to set the percentage retrace before we grab a second chance exit. 0.5 = 50% retracement. 1 = 100% retracement. It can also be set to negative value for monitoring if it went into loss after first being profitable). scMinBarsInTrade suspends monitoring until the trade has been on for at least a given number of bars. -
ATR based target (limit)
Often times you want limit orders to be a proportion of the current market volatility (so that you don’t set them too far or too near). Set useATRTarget to 1 to engage the system. atrTargetMultiple determines the limit order target by multiple of atr[40] -
ATR filter
When ATR filter is engaged, no trades will be taken unless atr[40] is above the given threshold. This reduces the likelihood of weak setups.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201// -- // -- // -- // -- // -- |// // -- // -- // -- // -- // |// == Aroon System DAX M30 == |// -- // -- // -- // -- // -- |// // -- // -- // -- // -- // |// Aroon System// Version 1.01// Contributors:// Eric @ prorealcode.com// Victormork @ prorealcode.com// Maz @ prorealcode.com// --------------// Modules:// Variable set selection framework// Optional donchian stop (useDonchianStop)// Optional trailing stop (useTrailingStop)// Optional soft time stop (softTimeStopBars > 0)// Optional second chance Stop (useSecondChanceStop) [version 0.11 alpha]// Optional ATR based target (useATRTarget)// Optional ATR filter (useATRFilter)// --------------// Originally developed for DAX M30DEFPARAM CumulateOrders = false// -- Variable Selection --once positionSize = 1once optimization = 1if optimization = 1 then // DAX M30 (June 2016 - Apr 2017)useDonchianStop = 1 // Engage Donchian Stop? 0:no | 1: yesuseTrailingStop = 1 // Engage trailing stop? 0:no | 1: yestrailingStop = 51 //50 // trailing stop distanceonce tsLongDistance = trailingStoponce tsShortDistance= trailingStopuseATRTarget = 1 // Engage ATR Limit 0:no | 1: yesatrTargetMultiple = 21 // Limit is x times current ATR[40]useATRFilter = 1 // Engage ATR filter 0: no | 1: yesatrThreshold = 15 // 11 // only trade if ATR is above xuseSecondChanceStop = 0 // Engage 2nd chance stop. 0: off | 1: onscRetraceTrigger = 0.5 // 0.4 // % of max profit reduction to triggerscMinBarsInTrade = 14 // 2 // min # bars before triggersoftTimeStopBars = 37 // 35 // 0: off | lower = higher hit ratemaShortPeriod = 50 // short term MA periodmaLongPeriod = 90 // long term MA periodarroonPeriod = 14once arroonUpPeriod = arroonPeriodonce arroonDnPeriod = arroonPeriodstMultiplier = 2 // Super trend multiplierstPeriods = 7 // 10 // Super trend perioddonchianChPeriod = 61 //70tradingTime = 1//(time >= 080000 and time < 163000)elsif optimization = 2 then // DAX H1 (experimental)useATRTarget = 0atrTargetMultiple = 21softTimeStopBars = 0useATRFilter = 0atrThreshold = 15useSecondChanceStop = 0//scRetraceTrigger = 0.5 // 0.4//scMinBarsInTrade = 14 // 2useDonchianStop = 1useTrailingStop = 1trailingStop = 45 // 48 //43once tsLongDistance = trailingStoponce tsShortDistance = trailingStoparroonPeriod = 14 // 15once arroonUpPeriod = arroonPeriodonce arroonDnPeriod = arroonPeriodstMultiplier = 3.5 // 3.75stPeriods = 14 // 13donchianChPeriod = 50 // 55 //70maShortPeriod = 53maLongPeriod = 90tradingTime = 1 //(time >= 080000 and time < 163000)endif// -- Indicators -----maShrt = exponentialAverage[maShortPeriod](close)maLong = exponentialAverage[maLongPeriod](close)arUp = aroonUp[arroonUpPeriod]arDn = aroonDown[arroonDnPeriod]sTrend = supertrend[stMultiplier, stPeriods]atr = averageTrueRange[40]inProfit = onMarket and positionPerf > 0 // ignore for now// -- Entry conditions -----// - Long entry -bc1 = not longOnMarket and tradingTimebc1 = bc1 and (arUp CROSSES OVER arDn)bc1 = bc1 and (maShrt > maLong[1]) and (close > sTrend)bc1 = (bc1 and useATRFilter and atr > atrThreshold) or (bc1 and (not useATRFilter))// -- Short entry conditions (AKA long exit) ----sc1 = not ShortOnMarketsc1 = sc1 and (arUp crosses under arDn)sc1 = sc1 and (maShrt < maLong[1]) and (close < sTrend)//sc1 = sc1 and (maLong < maLong[2])// -- Donchian Stop Logic -----if useDonchianStop and onMarket thenif longOnMarket thendcLo = lowest[donchianChPeriod](low)dcLastStop = dcLo[1]sell at dcLastStop stopelsif shortOnMarket thendcHi = highest[donchianChPeriod](high)dcLastStop = dcHi[1]exitshort at dcLastStop stopendifendif// -- Trailing Stop Logic -----if useTrailingStop thenonce tsLong = tsLongDistance * pointsizeonce tsShort = tsShortDistance * pointsizeif (not onMarket) thentsMaxPrice = 0tsMinPrice = closetsExitLevel = 0elsif (onMarket and tsExitLevel > 0) thenexitShort at tsExitLevel stopsell at tsExitLevel stopelsif longOnMarket thentsMaxPrice = max(tsMaxPrice,close)if tsMaxPrice-tradeprice(1) >= tsLong thentsExitLevel = tsMaxPrice - tsLongendifelsif shortOnMarket thentsMinPrice = MIN(tsMinPrice,close)if tradePrice(1)-tsMinPrice >= tsShort thentsExitLevel = tsMinPrice + tsShortendifendifendif// -- ATR based target --if onMarket and useATRTarget thenset target pProfit (atr * atrTargetMultiple) * pointSizeendif// -- Soft Time Stop --if onMarket and softTimeStopBars > 0 thenif not inProfit thencountLosingBars = countLosingBars + 1endifif countLosingBars >= softTimeStopBars and inProfit thensc1 = 1 /// can exitendifelsif not onMarket and countLosingBars > 0 thencountLosingBars = 0endif// -- Second chance profit lock -----if onMarket and useSecondChanceStop thenonce scTriggered = 0once maxPerf = 0if scTriggered and positionPerf >= maxPerf thensc1 = 1elsemaxPerf = max(maxPerf, positionPerf)scTriggered = (barIndex - tradeIndex >= scMinBarsInTrade)scTriggered = scTriggered and positionPerf <= (maxPerf * scRetraceTrigger)endifelsif useSecondChanceStop and (not onMarket) and maxPerf > 0 then// Reset when off marketmaxPerf = 0scTriggered = 0endif// -- execution logic -----if bc1 thenbuy positionSize contracts at marketelsif sc1 then // and (not inProfit) thenif onmarket thensell at market // exit long position if short setup triggerdendif//sellshort positionSize contracts at marketendif7 users thanked author for this post.
04/28/2017 at 9:13 AM #33801As always, beautiful work Maz! Is there anyone who can test this on 200 000 bars?
04/28/2017 at 9:42 AM #33804Hi Guys,
here below test results 200.000
as soon a possible I’ll test variables optim. by Walk farward
Regards
Ale3 users thanked author for this post.
04/28/2017 at 10:18 AM #33821@ALE I see your backtest begins in 2008. I have a couple of points about these kind of backtests:
- It’s nice to see that even with the current variable set, the system stays roughly stable on historic OOS data. That’s a good sign
- In 2008 we had completely different market dynamics – it was another decade which is ancient in terms of optimizing modern algos. Price action dynamics didn’t shift as fast then as they do now. So whether it makes sense to go that far back on a 30 minute system?
- It will be very interesting to see walk forward results for that whole period. I’d imagine you’d need to keep the ranges quite wide to accommodate the difference in volume and volatility. In 2008 we are going through a crash / bear market; then low volatility period (towards 2013) and then high volatility period (now).
- Spreads were VERY VERY different in 2008!
- I don’t expect most of my production algos that we run today to work in 2 years from now, let alone in 10 years – but if they do, that’s a great sign!
Thanks for the contribution. Looking forward to the results.
04/28/2017 at 10:32 AM #33822@Maz,
Very interesting your opininion, I’m agree with you.
your post opens a very interesting discussion. We want to talk about it in a specific topic. I would like to ask some questions, I have always been in the midst of two schools of thought.
Thanks
PS: I’l came back soon with the results!1 user thanked author for this post.
05/30/2017 at 8:52 PM #3706705/30/2017 at 9:15 PM #3706809/25/2017 at 8:43 PM #47305i try this one on bitcoin (demo) just for fun, the spread will make it hard to make some profit
p.s i have sometimes problem with the “usedonchianstop” so i dont use it (changed it to zero) i think its something with price distance to the stoporder?
- Variable-set selection framework
-
AuthorPosts
Find exclusive trading pro-tools on