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/08/2016 at 12:09 AM #1797912/08/2016 at 12:12 AM #17980
Hi Mark,
the DAX daily version trade only the strongest signal based on daily cross over/under (less signals but higher quality). The DAX 1D consider all 6 breakout signals and has higher profits but also a higher drawdown. I developed the versions based on daily data to have something for a quick check whether the instrument is suitable for the Pathfinder breakout algorithm or not. The test is done in minutes and if profitable I will look deeper and invest more time to create a H4 or H1 version.
best, Reiner
12/08/2016 at 12:18 AM #17981Adam, as requested here is the code of the last H4 version V6 from today
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311// 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// 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 = 10000Risk = 5 // in %equity = Capital + StrategyProfitmaxRisk = round(equity * Risk / 100)ONCE stopLossLong = 5.5 // in %ONCE stopLossShort = 3.25 // in %ONCE takeProfitLong = 3.25 // in %ONCE takeProfitShort = 3.25 // in %maxPositionSizeLong = MAX(15, abs(round(maxRisk / (close * stopLossLong / 100) / PointValue) * pipsize))maxPositionSizeShort = MAX(15, abs(round(maxRisk / (close * stopLossShort / 100) / PointValue) * pipsize))ONCE trailingStartLong = 2 // in %ONCE trailingStartShort = 0.75 // in %ONCE trailingStepLong = 0.2 // in %ONCE trailingStepShort = 0.4 // in %ONCE maxCandlesLongWithProfit = 16 // take long profit latest after 16 candlesONCE maxCandlesShortWithProfit = 15 // take short profit latest after 15 candlesONCE maxCandlesLongWithoutProfit = 30 // limit long loss latest after 30 candlesONCE maxCandlesShortWithoutProfit = 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 = 3ONCE January2 = 0ONCE February1 = 3ONCE February2 = 3ONCE March1 = 3ONCE March2 = 2ONCE April1 = 3ONCE April2 = 3ONCE May1 = 1ONCE May2 = 1ONCE June1 = 2ONCE June2 = 2ONCE July1 = 3ONCE July2 = 1ONCE August1 = 1ONCE August2 = 1ONCE September1 = 3ONCE September2 = 0ONCE October1 = 3ONCE October2 = 2ONCE November1 = 2ONCE November2 = 3ONCE December1 = 3ONCE December2 = 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// reset the stoploss valueIF NOT ONMARKET THENnewSL = 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 * 2ENDIF// next movesIF newSL > 0 AND close - newSL >= trailingStepLongInPoints * pipsize THENnewSL = newSL + trailingStepLongInPoints * pipsizeENDIFENDIF// manage short positionsIF SHORTONMARKET THEN// first move (breakeven)IF newSL = 0 AND tradeprice(1) - close >= trailingStartShortInPoints * pipsize THENnewSL = tradeprice(1) - trailingStepShortInPoints * pipsizeENDIF// next movesIF newSL > 0 AND newSL - close >= trailingStepShortInPoints * pipsize THENnewSL = newSL - trailingStepShortInPoints * pipsizeENDIFENDIF// 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 takeProfitENDIF12/08/2016 at 8:44 AM #17983Hello Reiner,
First I will thank you for this great system. If I run a backtest with the latest version (v6) from 9 aug 2012 – 8 dec 2016 and looked at the losing trades, I came to the conclusion that if you separate the month in four, you probably get better results.
Im not a programmer, so I don’t know to do that.
The results of losing trades if you split the month in 4
1 – 7 5 losing trades 5,95%
8 – 15 8 losing trades 6,54%
16 – 23 13 losing trades 11,32%
24 – 31 5 losing trades 1,6%So, if I look back in 4,5 years history, it’s probably better to adapt the seasonal booster for those weeks, or do not trade in week 3.
Alco
12/08/2016 at 11:23 AM #18047Hi Simon,
the current Pathfinder DAX version is V6. http://www.prorealcode.com/topic/pathfinder-trading-system/page/25/#post-17954
Please find attached a comparision of the results from V3 to V6. Pathfinder was created for the DAX and I have no clue if it works with DFB.
@UK guys: please advise to answer Simons question if Pathfinder works with a DAX DFB – Thanks
best, Reiner
12/08/2016 at 12:19 PM #1805612/08/2016 at 5:55 PM #18084Hello everyone!
Thank you Reiner for this great system. It works very well for me so far.
I have been programing my own trading systems for about 7 months so i´m still learning a lot.But there is one thing i don´t understand with your system.
It says in the code that it is active between 09:00 – 21:00 but when i have done the same thing in my own trading systems that i have programmed it has ended open positions after the time has ended.
But your system can keep positions open for days, even after 21:00
So my question is what does the timeframe do more exactly in your code?Viktor
12/08/2016 at 7:19 PM #18087Hi Reiner,
Do we set the timezone in platform options to CET (UTC +01:00)?
Thank You.
12/08/2016 at 7:22 PM #18088Hi Viktor. It sounds like you have incorporated a timecondition correct. However it does not close position. A simple example I often use my self is this. Trades will only be open between 09:00 and 17:00, and all trades will be closed after 22:00
12345678910111213141516171819defparam flatafter=220000//===========Trade hours =============IF (Time >= 09000 AND Time <= 170000) thenTradetime=1elseTradetime=0endif// enter Long PositionIF <longcondition> and Tradetime THENBUY 1 CONTRACT AT MARKETENDIF// enter short PositionIF <shortCondition> and Tradetime THENSELLSHORT 1 CONTRACT AT MARKETENDIF12/08/2016 at 7:31 PM #1808912/08/2016 at 8:33 PM #18095If you have general questions about coding, please open a specific topic for each of them, in order to keep this topic clear and dedicated to Reiner’s strategy.
@Choo Jen-Sin
Please update your country into your profile. Thank you.
12/08/2016 at 9:27 PM #1809912/08/2016 at 9:32 PM #18100Hi Reiner. I a couple of question for you brilliant work. In advance my apologies if the subject already has been mentioned but 385 reply in this thread I might have overlooked a few things 🙂
First DAX V6 is the one I looked deeper into, but you published V6b2 before the V6? With all the versions it could be hard to track changes, so why a ver 6b2 before a clean V6? It just the order in me that what this to be at least a V6.5 or am I missing something? Anyway a suggestion would be to make a matrix with the changes up through the version on various instrument as well and post it as perhaps a sticky non reply-able post(Nicolas is this possible for the only mortals?), and yes I know it would probably be very time consuming, but very informative. It sure would be nice to have
About the order cumulation- it only for Long position and not for Short. But looking at the DAX Seasonality chart it could be profitable in to implement cumulation of short in the saisonal position multiplier.
- January2
- February2
- March1
- August1
- August2
- September2
- September1
- October1
It just a quick look at the DAX Seasonality chart and I know it will overlap of some of the high multiplier for Long, for eksample in September1
Could this be an idea, or is it already tried?
Cheers Kasper
12/08/2016 at 9:40 PM #18101Hi Choo Jen-Sin,
Welcome – could you please set your location code in your profile to check where do come from. Usually it’s sufficient when you adjust the two variables:
12ONCE startTime = 90000ONCE endTime = 210000best, Reiner
12/08/2016 at 10:36 PM #18103 -
AuthorPosts
Find exclusive trading pro-tools on