Pathfinder Trading System
Forums › ProRealTime English forum › ProOrder support › Pathfinder Trading System
- This topic has 1,834 replies, 139 voices, and was last updated 1 year ago by CFD AutoTrading.
Tagged: Pathfinder
-
-
12/28/2016 at 10:38 AM #19213
Hey dajvop,
there is nothing you did wrong. It seems to be caused by the starting date of the backtest. if you change it to another date is shows a better restult. e.g. 01.09.2012 (the time change that you made should make no changes, because the times the system makes trades is at 9:00, 13:00, 17:00 and 21:00)
but I cannot say why there are these differences.
maybe the calculation of the high and low points depends on the starting date?
Hope I was able to help.
mfg
Flo
12/28/2016 at 10:45 AM #19214Changed starting date to 1 sept 2012 and got 136 trades (+118/-18) instead. Mighty strange if you ask me 🙂
How is one supposed to backtest properly if a date change of 2 days has that kind of impact?
Regards, David
12/28/2016 at 11:31 AM #19225We noticed such errors of the backtests previously (a few pages before), especially around the 29/12/2015-03/01/2016: the results are quite differents for all the following trades of the year, which is absurd. We have no explanations.
12/28/2016 at 12:25 PM #1923212/28/2016 at 3:12 PM #19245Hi Flo,
Thanks for your contribution. Your backtest is really good and I like that you follow my recommendation to focus on the drawdown. I recommend to increase takeProfitShort from 0.5 to 1.5 because the system could make more money on the short side with the same drawdown. Please keep in mind that the parameter settings should also cover different future scenarios. Your saisonal adjustments are good for the last 7 years and you did a perfect job. With the help of Pathfinder DOW daily we can now compile saisonal adjustments for the last 37 years and this information is very valuable. Based on your work I made some optimizations and I have tried to harmonize the settings with the longterm saisonal pattern. Overall this approach provides more robust parameter settings and especially show the potential risks (e.g. June and September).
12345678910111213141516171819202122232425// shortterm//longterm, ok - same or smaller value, chance - same direction but more aggressive, risk - be careful because of the pastONCE January1 = 1//0 risk(1)ONCE January2 = 3//2 chanceONCE February1 = 2//1 chanceONCE February2 = 2//0 risk(2)ONCE March1 = 2//0 risk(2)ONCE March2 = 3//2 chanceONCE April1 = 3//3 okONCE April2 = 3//3 okONCE May1 = 0//3 okONCE May2 = 0//0 okONCE June1 = 3//0 risk(3)ONCE June2 = 3//0 risk(3)ONCE July1 = 1//1 okONCE July2 = 1//1 okONCE August1 = 0// okONCE August2 = 0// okONCE September1 = 3//0 risk(3)ONCE September2 = 3//0 risk(3)ONCE October1 = 0//0 okONCE October2 = 3//3 okONCE November1 = 0//0 okONCE November2 = 3//3 okONCE December1 = 3//3 okONCE December2 = 3//2 chancePlease find attached Pathfinder DOW 4H V6 and Pathfinder DOW daily V2
Best, Reiner
4 users thanked author for this post.
12/28/2016 at 4:26 PM #19257Hi sylvess,
as long as not all Pathfinder pieces are together I prefer to have everything in one topic. This forum is so much more as this little breakout algo and I don’t want bother the other users with 20 Pathfinder topics. Maybe we split later in different subtopics but not yet.
Best, Reiner
12/28/2016 at 4:40 PM #19259Salve AleX,
I just reworking all Pathfinder daily versions and will publish all infos soon.
I described the optimization approach here http://www.prorealcode.com/topic/pathfinder-trading-system/page/33/#post-19123
Last step is to set all saisonal adjustments to 0 and start with January and optimize with two variables every month in the range of 0-3 focused on the drawdown value.
123456789101112131415161718192021222324ONCE January1 = xONCE January2 = yONCE February1 = 0ONCE February2 = 0ONCE March1 = 0ONCE March2 = 0ONCE April1 = 0ONCE April2 = 0ONCE May1 = 0ONCE May2 = 0ONCE June1 = 0ONCE June2 = 0ONCE July1 = 0ONCE July2 = 0ONCE August1 = 0ONCE August2 = 0ONCE September1 = 0ONCE September2 = 0ONCE October1 = 0ONCE October2 = 0ONCE November1 = 0ONCE November2 = 0ONCE December1 = 0ONCE December2 = 0move to next month and so on
123456789101112131415161718192021222324ONCE January1 = 0ONCE January2 = 2ONCE February1 = xONCE February2 = yONCE March1 = 0ONCE March2 = 0ONCE April1 = 0ONCE April2 = 0ONCE May1 = 0ONCE May2 = 0ONCE June1 = 0ONCE June2 = 0ONCE July1 = 0ONCE July2 = 0ONCE August1 = 0ONCE August2 = 0ONCE September1 = 0ONCE September2 = 0ONCE October1 = 0ONCE October2 = 0ONCE November1 = 0ONCE November2 = 0ONCE December1 = 0ONCE December2 = 0Saluti, Reiner
1 user thanked author for this post.
12/28/2016 at 4:41 PM #1926012/28/2016 at 5:45 PM #19265Hi
I tried to do the job for Natural Gas (NG), but I only have few months back..
Is it the same for everyone?
12/28/2016 at 6:33 PM #1926912/29/2016 at 12:31 AM #19315Salve Massimo,
all Pathfinder 4H systems require 24 hours quoting (6 candles per day). For the DOW these feature is available since April 2010. Backtests before this date doesn’t work with the default parameter setup.
Saluti, Reiner
12/29/2016 at 12:37 AM #19316Hi traderfred,
Here you will find the Pathfinder NG daily version V2 with data history start from 1990.
http://www.prorealcode.com/topic/pathfinder-trading-system/page/34/#post-19171
Best, Reiner
12/29/2016 at 8:47 AM #19317Hi Reiner,
Thanks a lot.
I will use it..The question was also in order to see if I’m able to make the optimization 🙂
Other question: I’m running DAX 4H V6 on backtest. (next week live!) Positions are currently open (from 21st and 23th of december) Is it correct?
Best regards,
Fred
12/29/2016 at 8:57 AM #1931812/29/2016 at 10:02 AM #19324Hi Reiner. I’m still trying to make a more conservative version of DAX 4H v6. I wrote about the risk before, also someone asked about a ver. for a small account. I saw you suggested a max 3 positionsize ver. I tested many variation of v6 code but since the positionsize is not linear I can’t find a solution that would go all the way including a money management code. I discovered that simplify the original code to only maxpositionsize=3 it also cut more on the gain side. So perhaps a new optimisation was needed? I multiplied the DD with 2 and added 1K for margin if the 3 positions. So this should be for a 4k account. Downside is that the DD is still more or less same as the V6 but the gain is only half. On the good side, it only risk a third of the orginal V6.- it has max 2 consecutive loss and 22 wins since July 2009
I tried to do the optimisation, and this was what I came up with. I’d like you comments if you think it’s optimized correct or not since this is my first optimisation try for you code 🙂
I have added a comparison screenshoot of the orginal V6 with max 3 positionsize and the new optimized V6b5
cheers Kasper
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348// Pathfinder Trading System based on ProRealTime 10.2// Breakout system triggered by previous daily, weekly and monthly high/low crossings with smart position management// Version 6.5 MM Elsborgtrading Live ver// Instrument: DAX mini 4H, 9-21 CET, 2 points spread, account size 10.000 Euro, from August 2010// ProOrder code parameterDEFPARAM CUMULATEORDERS = true // cumulate orders if not turned offDEFPARAM PRELOADBARS = 10000// define intraday trading windowONCE startTime = 90000ONCE endTime = 210000// define instrument signalline with help of multiple smoothed averagesONCE periodFirstMA = 5ONCE periodSecondMA = 10ONCE periodThirdMA = 3// define filter parameterONCE periodLongMA = 300ONCE periodShortMA = 50// define position and money management parameterONCE positionSize = 1Capital = 4000Risk = 5 // in %equity = Capital + StrategyProfitmaxRisk = round(equity * Risk / 100)ONCE stopLossLong = 5.5 // in %ONCE stopLossShort = 3.25 // in %ONCE takeProfitLong = 3.25//x1//3.25 // in %ONCE takeProfitShort = 3.5//x2//3.25 // in %reinvest =1if reinvest thenpositionSize=max(round((equity+Capital)/(capital*10)),1)maxPositionSizeLong = MAX(positionSize+2, abs(round(maxRisk / (close * stopLossLong / 100) / PointValue) * pipsize))maxPositionSizeShort = MAX(positionSize+2, abs(round(maxRisk / (close * stopLossShort / 100) / PointValue) * pipsize))elsepositionSize=1maxPositionSizeLong = MAX(15, abs(round(maxRisk / (close * stopLossLong / 100) / PointValue) * pipsize))maxPositionSizeShort = MAX(15, abs(round(maxRisk / (close * stopLossShort / 100) / PointValue) * pipsize))EndifONCE trailingStartLong = 2 // in %ONCE trailingStartShort = 0.75 // in %ONCE trailingStepLong = 0.2 // in %ONCE trailingStepShort = 0.4 // in %ONCE maxCandlesLongWithProfit = 17//x1//16 // take long profit latest after 16 candlesONCE maxCandlesShortWithProfit = 13//x2//15 // take short profit latest after 15 candlesONCE maxCandlesLongWithoutProfit = 26//x1//30 // limit long loss latest after 30 candlesONCE maxCandlesShortWithoutProfit = 25//x2//12 // limit short loss latest after 12 candles// define saisonal position multiplier for each month 1-15 / 16-31 (>0 - long / <0 - short / 0 no trade)ONCE January1 = 3//x1//3ONCE January2 = 0//x2//0ONCE February1 = 1//x1//3ONCE February2 = 2//x2//3ONCE March1 = 3//x1//3ONCE March2 = 3//x2//2ONCE April1 = 0//x1//1ONCE April2 = 3//x2//3ONCE May1 = 1//x1//1ONCE May2 = 3//x2//1ONCE June1 = 0//x1//2ONCE June2 = 2//x2//2ONCE July1 = 1//x1//3ONCE July2 = 3//x2//1ONCE August1 = 2//x1//1ONCE August2 = 1//x2//1ONCE September1 = 3//x1//3ONCE September2 = 0//x2//0ONCE October1 = 3//x1//3ONCE October2 = 3//x2//2ONCE November1 = 2//x1//1ONCE November2 = 3//x2//3ONCE December1 = 3//x1//3ONCE December2 = 2//x2//2// calculate daily high/low (include sunday values if available)dailyHigh = DHigh(1)dailyLow = DLow(1)// calculate weekly high/lowIf DayOfWeek < DayOfWeek[1] thenweeklyHigh = Highest[BarIndex - lastWeekBarIndex](dailyHigh)lastWeekBarIndex = BarIndexENDIF// calculate monthly high/lowIf Month[1] <> Month[2] then//If Month <> Month[1] thenmonthlyHigh = Highest[BarIndex - lastMonthBarIndex](dailyHigh)monthlyLow = Lowest[BarIndex - lastMonthBarIndex](dailyLow)lastMonthBarIndex = BarIndexENDIF// calculate instrument signalline with multiple smoothed averagesfirstMA = WilderAverage[periodFirstMA](close)secondMA = TimeSeriesAverage[periodSecondMA](firstMA)signalline = TimeSeriesAverage[periodThirdMA](secondMA)// save position before trading window is openIf Time < startTime thenstartPositionLong = COUNTOFLONGSHARESstartPositionShort = COUNTOFSHORTSHARESEndIF// trade only in defined trading windowIF Time >= startTime AND Time <= endTime THEN// set saisonal multipliercurrentDayOfTheMonth = Date - ((CurrentYear * 10000) + CurrentMonth * 100)midOfMonth = 15IF CurrentMonth = 1 THENIF currentDayOfTheMonth <= midOfMonth THENsaisonalPatternMultiplier = January1ELSEsaisonalPatternMultiplier = January2ENDIFELSIF CurrentMonth = 2 THENIF currentDayOfTheMonth <= midOfMonth THENsaisonalPatternMultiplier = February1ELSEsaisonalPatternMultiplier = February2ENDIFELSIF CurrentMonth = 3 THENIF currentDayOfTheMonth <= midOfMonth THENsaisonalPatternMultiplier = March1ELSEsaisonalPatternMultiplier = March2ENDIFELSIF CurrentMonth = 4 THENIF currentDayOfTheMonth <= midOfMonth THENsaisonalPatternMultiplier = April1ELSEsaisonalPatternMultiplier = April2ENDIFELSIF CurrentMonth = 5 THENIF currentDayOfTheMonth <= midOfMonth THENsaisonalPatternMultiplier = May1ELSEsaisonalPatternMultiplier = May2ENDIFELSIF CurrentMonth = 6 THENIF currentDayOfTheMonth <= midOfMonth THENsaisonalPatternMultiplier = June1ELSEsaisonalPatternMultiplier = June2ENDIFELSIF CurrentMonth = 7 THENIF currentDayOfTheMonth <= midOfMonth THENsaisonalPatternMultiplier = July1ELSEsaisonalPatternMultiplier = July2ENDIFELSIF CurrentMonth = 8 THENIF currentDayOfTheMonth <= midOfMonth THENsaisonalPatternMultiplier = August1ELSEsaisonalPatternMultiplier = August2ENDIFELSIF CurrentMonth = 9 THENIF currentDayOfTheMonth <= midOfMonth THENsaisonalPatternMultiplier = September1ELSEsaisonalPatternMultiplier = September2ENDIFELSIF CurrentMonth = 10 THENIF currentDayOfTheMonth <= midOfMonth THENsaisonalPatternMultiplier = October1ELSEsaisonalPatternMultiplier = October2ENDIFELSIF CurrentMonth = 11 THENIF currentDayOfTheMonth <= midOfMonth THENsaisonalPatternMultiplier = November1ELSEsaisonalPatternMultiplier = November2ENDIFELSIF CurrentMonth = 12 THENIF currentDayOfTheMonth <= midOfMonth THENsaisonalPatternMultiplier = December1ELSEsaisonalPatternMultiplier = December2ENDIFENDIF// define trading filters// 1. use fast and slow averages as filter because not every breakout is profitablef1 = close > Average[periodLongMA](close)f2 = close < Average[periodLongMA](close)f3 = close > Average[periodShortMA](close)// 2. check if position already reduced in trading window as additonal filter criteriaalreadyReducedLongPosition = COUNTOFLONGSHARES < startPositionLongalreadyReducedShortPosition = COUNTOFSHORTSHARES < startPositionShort// long position conditionsl1 = signalline CROSSES OVER monthlyHighl2 = signalline CROSSES OVER weeklyHighl3 = signalline CROSSES OVER dailyHighl4 = signalline CROSSES OVER monthlyLow// short position conditionss1 = signalline CROSSES UNDER monthlyHighs2 = signalline CROSSES UNDER dailyLow// long entry with order cumulationIF ( (l1 OR l4 OR l2 OR (l3 AND f2)) AND NOT alreadyReducedLongPosition) THEN// check saisonal booster setup and max position sizeIF saisonalPatternMultiplier > 0 THENIF (COUNTOFPOSITION + (positionSize * saisonalPatternMultiplier)) <= maxPositionSizeLong THENBUY positionSize * saisonalPatternMultiplier CONTRACT AT MARKETENDIFELSIF saisonalPatternMultiplier <> 0 THENIF (COUNTOFPOSITION + positionSize) <= maxPositionSizeLong THENBUY positionSize CONTRACT AT MARKETENDIFENDIFstopLoss = stopLossLongtakeProfit = takeProfitLongENDIF// short entry without order cumulationIF NOT SHORTONMARKET AND ( (s1 AND f3) OR (s2 AND f1) ) AND NOT alreadyReducedShortPosition THEN// check saisonal booster setup and max position sizeIF saisonalPatternMultiplier < 0 THENIF (COUNTOFPOSITION + (positionSize * ABS(saisonalPatternMultiplier))) <= maxPositionSizeShort THENSELLSHORT positionSize * ABS(saisonalPatternMultiplier) CONTRACT AT MARKETENDIFELSIF saisonalPatternMultiplier <> 0 THENIF (COUNTOFPOSITION + positionSize) <= maxPositionSizeLong THENSELLSHORT positionSize CONTRACT AT MARKETENDIFENDIFstopLoss = stopLossShorttakeProfit = takeProfitShortENDIF// stop and profit managementposProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsizenumberCandles = (BarIndex - TradeIndex)m1 = posProfit > 0 AND numberCandles >= maxCandlesLongWithProfitm2 = posProfit > 0 AND numberCandles >= maxCandlesShortWithProfitm3 = posProfit < 0 AND numberCandles >= maxCandlesLongWithoutProfitm4 = posProfit < 0 AND numberCandles >= maxCandlesShortWithoutProfit// take profit after max candlesIF LONGONMARKET AND (m1 OR m3) THENSELL AT MARKETENDIFIF SHORTONMARKET AND (m2 OR m4) THENEXITSHORT AT MARKETENDIF// trailing stop function (convert % to pips)trailingStartLongInPoints = tradeprice(1) * trailingStartLong / 100trailingStartShortInPoints = tradeprice(1) * trailingStartShort / 100trailingStepLongInPoints = tradeprice(1) * trailingStepLong / 100trailingStepShortInPoints = tradeprice(1) * trailingStepShort / 100//ONCE Breakeven=0// reset the stoploss valueIF NOT ONMARKET THENnewSL = 0//breakeven=0ENDIF// manage long positionsIF LONGONMARKET THEN// first move (breakeven)IF newSL = 0 AND close - tradeprice(1) >= trailingStartLongInPoints * pipsize THENnewSL = tradeprice(1) + trailingStepLongInPoints * pipsizestopLoss = stopLossLong * 0.1takeProfit = takeProfitLong * 2//breakeven=1ENDIF// next movesIF newSL > 0 AND close - newSL >= trailingStepLongInPoints * pipsize THENnewSL = newSL + trailingStepLongInPoints * pipsize//breakeven=1ENDIFENDIF// manage short positionsIF SHORTONMARKET THEN// first move (breakeven)IF newSL = 0 AND tradeprice(1) - close >= trailingStartShortInPoints * pipsize THENnewSL = tradeprice(1) - trailingStepShortInPoints * pipsize//breakeven=1ENDIF// next movesIF newSL > 0 AND newSL - close >= trailingStepShortInPoints * pipsize THENnewSL = newSL - trailingStepShortInPoints * pipsize//breakeven=1ENDIFENDIF// stop order to exit the positionsIF newSL > 0 THENIF LONGONMARKET THENSELL AT newSL STOPENDIFIF SHORTONMARKET THENEXITSHORT AT newSL STOPENDIFENDIF// superordinate stop and take profitSET STOP %LOSS stopLossSET TARGET %PROFIT takeProfitENDIF//dif=(newsl1-tradeprice)//graph ((dif*COUNTOFPOSITION*pipsize*pointvalue)/(equity))*100 COLOURED(0,0,255) AS "MAXRISKNEWSL"//blue//graph (((tradeprice-(tradeprice-(tradeprice*(stoploss/100))))*positionsize*pipsize*pointvalue)/(equity))*100 COLOURED(0,0,0) AS "MAXRISK"//blue//graph (((close-positionprice)*pointvalue)*countofposition)/pipsize/(equity)*100 COLOURED(0,0,255) AS "MAXRISK3"//blue//graph (((positionprice-(positionprice-(positionprice*(stoploss/100))))*COUNTOFPOSITION*pipsize*pointvalue)/(equity))*100 COLOURED(0,0,255) AS "MAXRISK2"//blueif ((tradeprice-(tradeprice-((tradeprice*(stoploss/100)*COUNTOFPOSITION)))*pipsize*pointvalue)/equity)*100 <0 thengraph -1*((tradeprice-(tradeprice-((tradeprice*(stoploss/100)*COUNTOFPOSITION)))*pipsize*pointvalue)/equity)*100 COLOURED(0,0,255) AS "MAXRISK"//Aquaelsegraph ((tradeprice-(tradeprice-((tradeprice*(stoploss/100)*COUNTOFPOSITION)))*pipsize*pointvalue)/equity)*100 COLOURED(0,0,255) AS "MAXRISK"//Aquaendif//graph ((tradeprice-(tradeprice-((tradeprice*(stoploss/100)*COUNTOFPOSITION)))*pipsize*pointvalue)/equity)*100 COLOURED(0,0,255) AS "MAXRISK"//Aqua//graph ((tradeprice-(tradeprice-((tradeprice*(newsl/100)*COUNTOFPOSITION)))*pipsize*pointvalue)/equity)*100 COLOURED(0,0,255) AS "MAXRISK-NewSL"//Aqua//graph breakeven COLOURED(255,0,0) AS "breakeven"//Aqua//graph ((newsl-tradeprice)/equity)*100 COLOURED(0,0,255) AS "newsl"//graph positionsize COLOURED(0,125,255) AS "position"//graph countofposition COLOURED(0,125,255) AS "countofposition"//graph tradeprice-(tradeprice-(tradeprice-newsl)) COLOURED(0,0,255) AS "stoplossin%"//graph (tradeprice-(tradeprice-((tradeprice*(stoploss/100)))))COLOURED(0,0,0) AS "pointstoSL"//Aqua//graph (((tradeprice-(tradeprice-((tradeprice*stoploss)/100)))*positionsize*pointvalue*100)/(equity+capital))*100 COLOURED(0,0,0) AS "MAXRISK"//Aqua1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on