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
-
-
10/18/2016 at 12:34 PM #1511010/18/2016 at 12:49 PM #1511410/18/2016 at 1:29 PM #15118
Brage, I’m confused. I imported the itf file from above and with OMX mini 20 SEK the backtest shows the attached result.
Here is the used code:
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 5 Beta 2// Instrument: OMX mini 4H, 8-22 CET, 1.5 points spread, account size 100.000 SEK// ProOrder code parameterDEFPARAM CUMULATEORDERS = true // cumulate orders if not turned offDEFPARAM PRELOADBARS = 10000// define intraday trading windowONCE startTime = 80000ONCE endTime = 220000// define instrument signalline with help of multiple smoothed averagesONCE periodFirstMA = 5ONCE periodSecondMA = 10ONCE periodThirdMA = 3// define filter parameterONCE periodLongMA = 210ONCE periodShortMA = 10// define position and money management parameterONCE positionSize = 1Capital = 10000Risk = 2 // in %equity = Capital + StrategyProfitmaxRisk = round(equity * Risk / 100)ONCE stopLossLong = 5 // in %ONCE stopLossShort = 3.25 // in %ONCE takeProfitLong = 3.25 // in %ONCE takeProfitShort = 2 // 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.75 // in %ONCE trailingStartShort = 0.75 // in %ONCE trailingStepLong = 0.2 // in %ONCE trailingStepShort = 0.4 // in %ONCE maxCandlesLongWithProfit = 21 // take long profit latest after 21 candlesONCE maxCandlesShortWithProfit = 12 // take short profit latest after 12 candlesONCE maxCandlesLongWithoutProfit = 30 // limit long loss latest after 30 candlesONCE maxCandlesShortWithoutProfit = 3 // limit short loss latest after 3 candles// define saisonal position multiplier >0 - long / <0 - short / 0 no tradeONCE January = 3ONCE February = 3ONCE March = 1ONCE April = 3ONCE May = 1ONCE June = 2ONCE July = 3ONCE August = -2ONCE September = -2ONCE October = 3ONCE November = 1ONCE December = 3// 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 takeProfitENDIF1 user thanked author for this post.
10/18/2016 at 4:31 PM #1512210/18/2016 at 4:35 PM #1512310/18/2016 at 5:16 PM #1513010/19/2016 at 9:18 AM #15157Hi Patrick,
Current Pathfinder’s algorithm requires 24H quoting for an underlying instrument (e.g. calculation of signalline, max holding candles, etc.). It won’t work for futures without adaptation. In IG’s world the future instruments have a very limited life time and unfortunately avoid backtesting over a longer time period. I have seen your test based on an instrument DAX30 Full1216 Future – were can I find this underlying in IG’s PRT?
best, Reiner
1 user thanked author for this post.
10/19/2016 at 10:01 AM #15161Hi Reiner,
Thank you for your reply. Unfortunately you can not find DAX30FULL1216 Future in PRT from IG. IG is a CFD provider and only has derivates of the original future or index.
With a CFD you never trade directly in the future or other product, but always in a derivate of the original product. This is also the discussion. You trade directly with CFD created software
in a CFD created environment which means that it looks like that you trade against IG, what they of course deny.
When you trade with futures from for example Interactive , you buy directly a future on the stock exchange in for example the DAX Bourse or Euronext. These bourses also closes at 20.00 hrs. or at
22.00 hrs. After these times until 08.00 hrs. there will not be a pricing and of course no candles. Now you have to take a look at the candles in the night at IG. You see sometimes very weird
results where all kind of stops are being triggered while there in the meantime no pricing is on the real stockexchange. Al these pricings in the night affect backtests of course.
If you want to adjust Pathfinder for the future market i suggest you open a free account at prorealtime.de. I thought you can get the first 2 weeks fully access including daytrading free of charge.
So if you want to you can try it free of charge and maybe you can with your experience easily adjust the Pathfinder for futuretrading. When it is working you can set your account to automatic trading
and than your trades will go through Interactive Brokers.
Best regards,
Patrick
10/19/2016 at 10:29 AM #15163Hi Reiner,
Fantastic work on the Pathfinder strategy! Do you know if this is also a good strategy for the CAC French index?
Thanks,
Mikael10/19/2016 at 11:36 AM #15168Hi Miguel,
in general MIB is suitable for Pathfinder because of the high absolute value and the volatility. With IG MIB is unfortunately not tradable because of the very high spread outside of the core trading time (48 points).
Please find attached a MIB mini backtest, I didn’t find a smoothed equity curve because of the high spreads and the tough down trends. The return is really good but drawdown is also significant. The backtest is done with an unrealistic spread of 15 points and is very optimized.
I love Italian food and especially Italian women but not the MIB, stay with the DAX is still the best :-).
best, Reiner
10/19/2016 at 12:29 PM #1517210/19/2016 at 12:31 PM #1517310/19/2016 at 1:27 PM #15177Miguel,
look at the DAX over the last days and weeks. No trend, low volatility, no saisonal behavior and catched in a small range. Only scalping systems made some money in that scenario. Pathfinder is a swing trading system makes money mainly on the long side. In my opinion it’s an advantage of the system that it stay beside the line and wait for better trading chances instead of loosing money in sideway trends.
best, Reiner
10/19/2016 at 4:05 PM #15181Hi Reiner, Hi all
The Reiner’s previous post shows the main reason why a lot of trading systems (swing trading) have some results problems.
One day you win, the day after you loose or vice and versa
At the end, you don’t earn anything but your broker does….
Reb
1 user thanked author for this post.
10/19/2016 at 5:55 PM #15183Hi Mikael,
Pathfinder works also well for CAC mini that’s not really surprising because the European Indices are more or less related. Please find attached the backtest and the code. Please be aware that this is an optimized view over the last 4 years. CAC had a longer sideway range (Feb 2015 – Feb 2016) and I suppose that a lot of traders loose the patience in that time. Overall the result is solid and drawdown is around 20% as mentioned before my favourite is still the DAX because of better performance and drawdown.
best, Reiner
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on