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
-
-
11/02/2016 at 11:12 AM #15856
Hi MichiM,
wie du vlt. gelesen hast, hatten wir alle mehr oder weniger das gleiche Problem. Ich habe mir den Code von V5B2 nochmal genau angeschaut und einen Fehler bei der Berechnung der Haltedauer für einen short trade gefunden (siehe oben). Ich werde in kürze eine neuen Version hierzu veröffentlichen. Ich handle nur den DAX und da waren die Real Mode Trades und die Backtest Trades bis auf eine slippage von ein paar Punkten bisher eigentlich immer identisch. Es muss da aber noch irgendwas mit der PRT Plattform passiert sein, ich hatte z.B auch ein völlig falschen Stopp – ich werde das beobachten.
MichiM had the same problems like many others here. As mentioned above I made a code review for V5B2 and found the described error. In my opinion there must be some additional PRT platform anomalies because I had a false stop limit. In my opinion Pathfinder code looks OK so far and I’ll release a fixed version soon.
best, Reiner
11/02/2016 at 11:26 AM #1585711/02/2016 at 1:52 PM #15860I have created a new version Pathfinder DAX H4 V5. Contains all beta funnctions and additional the following changes:
- fixed a bug in the calculation of the maximum holding period for short trades
- adaption of Pathfinder’s parameter to the maximum available data history with 24 quotes (from August 2010)
best, Reiner
11/03/2016 at 11:19 AM #15914Hey Reiner,
in deinem System ist der Handel von 8:00 bis 22:00 Uhr begrenzt. Bezieht sich das auch auf die anderen Indikatoren?
Also z.B. Tages/Wochen/Monatshoch und -tief? Oder die geglätteten Durchschnitte?
Denn ich hab mir Gedanken darüber gemacht wie man den Backtest aussagekräftiger machen kann und noch mehr historische Daten nutzen. Der eigentliche Handel an den Börsen findet ja zwischen 8 und 22 Uhr statt. Wie genau IG seine Kurse dazwischen stellt weiß ich leider auch nicht. Wäre es möglich dem System zu sagen, dass es für die Zeit von 22 bis 8 Uhr einfach den Endkurs des Tages (also den Kurs von 22Uhr) für die Berechnungen heranziehen soll? Also das es virtuell mit einer Kerze rechnet, die eigentlich gar nicht da ist?
Ich hoffe du verstehst was ich meine. Dein Screenshot von dem System, das auf die Kernhandelszeiten beschränkt ist war zwar wesentlich schlechter als das aktuelle System und hatte einen größeren Drawdown, aber das Ergebnis war trotzdem gut. Eventuell lässt es sich das Ergebnis verbessern, indem ein 24h handel simuliert wird durch diese virtuelle Kerze.
Das ganze ist wahrscheinlich nicht so einfach umzusetzen, aber ich würde mich trotzdem freuen wenn du mir deine Meinung dazu sagen könntest.
MfG, Flo
1 user thanked author for this post.
11/03/2016 at 12:25 PM #1591611/03/2016 at 12:44 PM #1592111/03/2016 at 3:26 PM #15929Hello Nicolas, yes I am sorry. I had to write it fast, so I did it in german.
I was asking if it is possible to implement a piece of code, that all the indicators and the whole systems is calculated with the last “official” price of the day for the time between 22:00 and 8:00.
Before August 2010 there was no pricing at night. Today there is, but I think it is made by IG because the futures are not traded during that time. But as we saw, the performance of the system is better, if there happens to be candles between 22 and 8. If it would be possible to have a “virtual candle” which is only one price, maybe the system could be backtested for the complete time of the historical data.
but i am not sure if this is possible or if this would require to code all used indicators new.
cheers, flo
11/03/2016 at 4:08 PM #15933are always the idea that if pathfinder provides closure candle 9.00 and ‘better to close the trade at 21.00 the day before (- 3 candles)
it prevents nocturnal surprises. The night often brings disappointments. I tried the reiner code but does not work.mig
11/04/2016 at 4:39 PM #15980Miguel,
regarding maximal holding check, the following code check at 21:00:00 the condition like next morning at 9:00:00
123456789numberCandles = (BarIndex - TradeIndex)IF Time = 210000 THENnumberCandles = numberCandles + 3ENDIFm1 = posProfit > 0 AND numberCandles >= maxCandlesLongWithProfitm2 = posProfit > 0 AND numberCandles >= maxCandlesShortWithProfitm3 = posProfit < 0 AND numberCandles >= maxCandlesLongWithoutProfitm4 = posProfit < 0 AND numberCandles >= maxCandlesShortWithoutProfit11/04/2016 at 5:11 PM #15982Hi Flo,
Thanks for your idea, I appreciate your contribution.
The signalline calculation consider 24 hours and sunday quotes. This behavior is an advantage and make the system much better. The quotes outside of the core trading time will predict the future trend and give probably better signals. Without additional external price information Pathfinder isn’t in the position to calculate comparable valueable quotes.
Pathfinder has already 250 lines of code and the complexity is high enough.
best, Reiner
11/07/2016 at 8:46 AM #16050I tried using pathfinder for eur / usd. The results are interesting but you have to remove the trade in balance and eliminate seasonality.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244// 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 Beta// Instrument: EUR/USD mini 4H, 3-23 CET, 0.6 points spread, account size 10.000 Euro// ProOrder code parameterDEFPARAM CUMULATEORDERS = true // cumulate orders if not turned offDEFPARAM PRELOADBARS = 10000// define intraday trading windowONCE startTime = 030000ONCE endTime = 230000// define instrument signalline with help of multiple smoothed averagesONCE periodFirstMA = 7ONCE periodSecondMA = 11ONCE periodThirdMA = 9// define filter parameterONCE periodLongMA = 50ONCE periodShortMA = 20// define position and money management parameterONCE positionSize = 1Capital = 1000Risk = 2 // in %equity = Capital + StrategyProfitmaxRisk = round(equity * Risk / 100)ONCE stopLossLong = 2 // in %ONCE stopLossShort = 2 // in %ONCE takeProfitLong = 4 // in %ONCE takeProfitShort = 3 // in %maxPositionSizeLong = MAX(15, abs(round(maxRisk / (close * stopLossLong / 100) / PointValue) * pipsize))maxPositionSizeShort = MAX(5, abs(round(maxRisk / (close * stopLossShort / 100) / PointValue) * pipsize))ONCE trailingStartLong = 1.6 // in %ONCE trailingStartShort = 0.6 // in %ONCE trailingStepLong = 0.6 // in %ONCE trailingStepShort = 0.2 // in %ONCE maxCandlesLongWithProfit = 17 // take long profit latest after 16 candlesONCE maxCandlesShortWithProfit = 19 // take short profit latest after 15 candlesONCE maxCandlesLongWithoutProfit = 39 // limit long loss latest after 30 candlesONCE maxCandlesShortWithoutProfit = 13 // limit short loss latest after 13 candles// define saisonal position multiplier >0 - long / <0 - short / 0 no tradeONCE January = 1ONCE February = 1ONCE March = 1ONCE April = 1ONCE May = 1ONCE June = 1ONCE July = 1ONCE August = 1ONCE September = 1ONCE October = 1ONCE November = 1ONCE December = 1// 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 <> 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 patternIF CurrentMonth = 1 THENsaisonalPatternMultiplier = JanuaryELSIF CurrentMonth = 2 THENsaisonalPatternMultiplier = FebruaryELSIF CurrentMonth = 3 THENsaisonalPatternMultiplier = MarchELSIF CurrentMonth = 4 THENsaisonalPatternMultiplier = AprilELSIF CurrentMonth = 5 THENsaisonalPatternMultiplier = MayELSIF CurrentMonth = 6 THENsaisonalPatternMultiplier = JuneELSIF CurrentMonth = 7 THENsaisonalPatternMultiplier = JulyELSIF CurrentMonth = 8 THENsaisonalPatternMultiplier = AugustELSIF CurrentMonth = 9 THENsaisonalPatternMultiplier = SeptemberELSIF CurrentMonth = 10 THENsaisonalPatternMultiplier = OctoberELSIF CurrentMonth = 11 THENsaisonalPatternMultiplier = NovemberELSIF CurrentMonth = 12 THENsaisonalPatternMultiplier = DecemberENDIF// 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 managementIF LONGONMARKET THENposProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsizeELSIF SHORTONMARKET THENposProfit = (((positionprice - close) * pointvalue) * countofposition) / pipsizeENDIFm1 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithProfitm2 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithProfitm3 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithoutProfitm4 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithoutProfit// take profit after max candlesIF LONGONMARKET AND (m1 OR m3) THENSELL AT MARKETENDIFIF SHORTONMARKET AND (m2 OR m4) THENEXITSHORT AT MARKETENDIF// trailing stop functiontrailingStartLongInPoints = 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 * pipsizeENDIF// 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 THENSELL AT newSL STOPEXITSHORT AT newSL STOPENDIF// superordinate stop and take profitSET STOP %LOSS stopLossSET TARGET %PROFIT takeProfitENDIF11/07/2016 at 5:01 PM #16098The IT support of IG says, that the change from summer- to wintertime caused the bug in the program.
1 user thanked author for this post.
11/07/2016 at 5:49 PM #16104Hello Ale and Reiner,
Congrats Reiner for the code quality.
I have a question for you Ale about the backtest realized before 2009, do you know how many points the strategy made in 2008 ?
Thank you
Kindest regards,
Roman
11/07/2016 at 7:45 PM #1610811/07/2016 at 7:53 PM #16109 -
AuthorPosts
Find exclusive trading pro-tools on