Hi guys,
I want to share one of my DAX trading ideas based on simple daily, weekly and monthly high/low crossings. I observed that simple cross over and cross under of daily/weekly/monthly high/lows in combination with a multiple smoothed average and some simple filters could be a profitable approach. On the long side the cumulation of orders could be a performance booster for this system.
Comments and suggestions for improvement are welcome.
Have fun
Reiner
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
// Pathfinder DAX 4H, 9-22, 2 points spread // DAX breakout system triggered by previous daily, weekly and monthly high/low crossings // Version 3 // ProOrder code parameter DEFPARAM CUMULATEORDERS = true // cumulate orders if not turned off DEFPARAM PRELOADBARS = 10000 // trading window 8-22 ONCE startTime = 80000 ONCE endTime = 220000 // smoothed average parameter (signalline) ONCE periodFirstMA = 5 ONCE periodSecondMA = 10 ONCE periodThirdMA = 3 // filter parameter ONCE periodLongMA = 250 ONCE periodShortMA = 50 // trading paramter ONCE PositionSize = 1 // money and position management parameter ONCE stoppLoss = 5 // in % ONCE takeProfitLong = 2 // in % ONCE takeProfitShort = 1.75 // in % ONCE maxCandlesLongWithProfit = 18 // take long profit latest after 18 candles ONCE maxCandlesShortWithProfit = 13 // take short profit latest after 13 candles ONCE maxCandlesLongWithoutProfit = 30 // limit long loss latest after 30 candles ONCE maxCandlesShortWithoutProfit = 25 // limit short loss latest after 25 candles ONCE startShortPattern = 4 // April ONCE endShortPattern = 9 // September ONCE longPositionMultiplier = 2 // multiplier for long position size in case of higher saisonal probability ONCE shortPositionMultiplier = 2 // multiplier for short position size in case of higher saisonal probability // calculate daily high/low dailyHigh = DHigh(1) dailyLow = DLow(1) // calculate weekly high/low If DayOfWeek < DayOfWeek[1] then weeklyHigh = Highest[BarIndex - lastWeekBarIndex](dailyHigh) lastWeekBarIndex = BarIndex ENDIF // calculate monthly high/low If Month <> Month[1] then monthlyHigh = Highest[BarIndex - lastMonthBarIndex](dailyHigh) monthlyLow = Lowest[BarIndex - lastMonthBarIndex](dailyLow) lastMonthBarIndex = BarIndex ENDIF // calculate signalline with multiple smoothed averages firstMA = WilderAverage[periodFirstMA](close) secondMA = TimeSeriesAverage[periodSecondMA](firstMA) signalline = TimeSeriesAverage[periodThirdMA](secondMA) // trade only in trading window 8-22 IF Time >= startTime AND Time <= endTime THEN // filter criteria because not every breakout is profitable c1 = close > Average[periodLongMA](close) c2 = close < Average[periodLongMA](close) c3 = close > Average[periodShortMA](close) c4 = close < Average[periodShortMA](close) // saisonal pattern saisonalShortPattern = CurrentMonth >= startShortPattern AND CurrentMonth <= endShortPattern // long position conditions l1 = signalline CROSSES OVER monthlyHigh l2 = signalline CROSSES OVER weeklyHigh l3 = signalline CROSSES OVER dailyHigh l4 = signalline CROSSES OVER monthlyLow // short position conditions s1 = signalline CROSSES UNDER monthlyHigh s2 = signalline CROSSES UNDER monthlyLow s3 = signalline CROSSES UNDER dailyLow // long entry IF ( l1 OR l4 OR l2 OR (l3 AND c2) ) THEN // cumulate orders for long trades IF not saisonalShortPattern THEN BUY PositionSize * longPositionMultiplier CONTRACT AT MARKET ELSE BUY PositionSize CONTRACT AT MARKET ENDIF takeProfit = takeProfitLong ENDIF // short entry IF NOT SHORTONMARKET AND ( (s1 AND c3) OR (s2 AND c4) OR (s3 AND c1) ) THEN // no cumulation for short trades IF saisonalShortPattern THEN SELLSHORT positionSize * shortPositionMultiplier CONTRACT AT MARKET ELSE SELLSHORT positionSize CONTRACT AT MARKET ENDIF takeProfit = takeProfitShort ENDIF // stop and profit management posProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsize m1 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithProfit m2 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithProfit m3 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithoutProfit m4 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithoutProfit IF LONGONMARKET AND (m1 OR m3) THEN SELL AT MARKET ENDIF IF SHORTONMARKET AND (m2 OR m4) THEN EXITSHORT AT MARKET ENDIF SET STOP %LOSS stoppLoss SET TARGET %PROFIT takeProfit ENDIF |
Many other instruments and continuously updated versions are available in the dedicated forum topic of this automated trading strategy, everyone can read and participate here: Pathfinder trading strategy forum topic
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Thank you REINER for your help.
I’m working a system TRADING with the DAX 3 minutes based on the bollinger bands,but for the moment it’s very difficult.
I use your systems with sometimes some errors between the reality and the backtest.And particulary the TREND SURFER DAX 5mn.But overall it’s ok.
bye bye
Hello,
This strategy seems to work very well on the DAX, H4 timeframe. Thanks for sharing.
But do you know why it is loosing money before 2009, and earning very well since 2009 ?
Is it a problem of trading hours ?? (maybe the trading hours were different before 2009 ?)
Best regards,
I see that on ProRealTime CFD, the DAX had no quote / price before august 2010.
Hi Doctrading,
Thanks for your comment.
as an IG customer it’s a pitty that backtesting is only possible since 2013. It’s good to know that it was profitable before 2013.
2007 – 2008 were hard years for trading due the financial crises and I suppose that for this scenario the short conditions are insufficient.
Even an idea is to set the PositionSize for the short trades depending on saisonal pattern. Perhaps you find something that is better than this suggestion.
regards
Reiner
// saisonal pattern
saisonalShortPattern = CurrentMonth > 3 AND CurrentMonth < 10 // April - September
// short entry
IF NOT SHORTONMARKET AND ( (s1 AND c3) OR (s2 AND c4) OR (s3 AND c1) ) THEN // no cumulation for short trades
IF saisonalShortPattern THEN
SELLSHORT PositionSize * 2 CONTRACT AT MARKET // double position size by higher saisonal probability
ELSE
SELLSHORT PositionSize CONTRACT AT MARKET
ENDIF
ENDIF
Doctrading
You found the reason. Sorry, I only saw your first comment.
Reiner
Thanks for sharing. Backtesting almost too good to be true, however there was almost 20% loss of equity in one trade.
when i do the proback test i only get 9 trades for the last 16 years, that cant be correct? anyone know what i might be doing wrong?
Hey Reiner,
nice code, as always! Thanks a lot.
In the code you have definded the trading window from 08:00 to 22:00. But some positions are open for several days and even during the weekend. Is this supposed to happen?
Cheers
Flo
Hi Flo,
Yes, that’s the expectation. Pathfinder is not an intraday strategy and positions could hold for several days until stop or exit conditions closed the trade. I’m still work on improvements, e.g. the position management for the short side depending on saisonal pattern is promising. I’m not happy with the exit rules and have tested many complex things but at the end of the day the simple %stop is the best solution so far.
regards
Reiner
Hi Reiner,
Thanks for sharing, Some nice parts to play with.
thanks,
james
in order to understand the system better it’s helpful to see the relevant things, here is Pathfinder as indicator with the relevant lines and levels
// Pathfinder
// daily high/low
dailyHigh = DHigh(1)
dailyLow = DLow(1)
// weekly high/low
Once lastWeekBarIndex = 0
Once weeklyHigh = undefined
Once weeklyLow = undefined
If DayOfWeek < DayOfWeek[1] then
weeklyHigh = Highest[BarIndex - lastWeekBarIndex](DHigh(1))
weeklyLow = Lowest[BarIndex - lastWeekBarIndex](DLow(1))
lastWeekBarIndex = BarIndex
ENDIF
// monthly high/low
Once lastMonthBarIndex = 0
Once monthlyHigh = undefined
Once monthlyLow = undefined
If Month<>Month[1] then
monthlyHigh = Highest[BarIndex - lastMonthBarIndex](DHigh(1))
monthlyLow = Lowest[BarIndex - lastMonthBarIndex](DLow(1))
lastMonthBarIndex = BarIndex
ENDIF
// signalline
firstMA = WilderAverage[5](close)
secondMA = TimeSeriesAverage[10](firstMA)
signalline = TimeSeriesAverage[5](secondMA)
// filter
ma50 = Average[50]
ma200 = Average[200]
return signalline AS \"signal line\", dailyHigh AS \"daily High\", dailyLow AS \"daily Low\", weeklyHigh AS \"weekly High\", weeklyLow AS \"weekly Low\", monthlyHigh AS \"monthly High\", monthlyLow AS \"monthly Low\", ma50 AS \"average[50]\", ma200 AS \"average[200]\"
Massive gains on this strategy since Friday….”If only it was real money”
Hi Reiner. I decided to try and live test your code, but seems like it has insufficient data to begin with- so it never starts
Here is the screenshoot of the error it generates. http://prntscr.com/brssm3 Anyway great code, that backtest really well.
Hi Elsborgtrading,
Welcome and thanks for your comment.
the message is clear, PRT is not happy with the pre loaded bars in order to calculate all used indicators. Default are 1000 bars and that shoud be enough for the used indicators. In my IG PRT environment it works without any problem in backtesting and real trading mode. In which environment do you get this message?
I suggest to raise the bar size with the mentioned command, add the following line after the first Defparam command and play around with the size: DEFPARAM PRELOADBARS = 2000
regards
Reiner
the following link shows some pictures of Pathfinder detail information
https://www.evernote.com/shard/s80/sh/3c8432cd-63f5-4301-a3cb-9a9dd5c8713b/743defcc06fa10ab3a514b9e34fbf76a
Thx for share Reiner very good TS
Pathfinder version 2 released.
The new version include some position management extensions like e.g. saisonal pattern as booster for short trades and maximal days hold feature to save profits and limit losses.
The following link shows some additional infos.
https://www.evernote.com/shard/s80/sh/3c8432cd-63f5-4301-a3cb-9a9dd5c8713b/743defcc06fa10ab3a514b9e34fbf76a
// Pathfinder DAX 4H, 8-22, 2 points spread
// DAX breakout system triggered by previous daily, weekly and monthly high/low crossings
// Version 2
// code parameter
DEFPARAM CUMULATEORDERS = true // cumulate orders if not switch off
DEFPARAM PRELOADBARS = 1000
// trading window 8-22
ONCE startTime = 80000
ONCE endTime = 220000
// smoothed average parameter (signalline)
periodFirstMA = 5
periodSecondMA = 10
periodThirdMA = 5
// filter parameter
periodLongMA = 200
periodShortMA = 50
// trading paramter
ONCE positionSize = 10
// money and position management parameter
ONCE stoppLoss = 3 // in %
ONCE takeProfit = 1.5 // in %
ONCE maxDaysWithProfit = 3 // take profit after 3 days
ONCE maxDaysWithoutProfit = 5 // limit loss after 5 days
ONCE startShortPattern = 4 // April
ONCE endShortPattern = 9 // September
ONCE shortPositionMultiplier = 2 // double short position size in case of higher saisonal probability
// calculate weekly high/low
If DayOfWeek < DayOfWeek[1] then
weeklyHigh = Highest[BarIndex - lastWeekBarIndex](DHigh(1))
lastWeekBarIndex = BarIndex
ENDIF
// calculate monthly high/low
If Month <> Month[1] then
monthlyHigh = Highest[BarIndex - lastMonthBarIndex](DHigh(1))
monthlyLow = Lowest[BarIndex - lastMonthBarIndex](DLow(1))
lastMonthBarIndex = BarIndex
ENDIF
// calculate signalline with multiple smoothed averages
firstMA = WilderAverage[periodFirstMA](close)
secondMA = TimeSeriesAverage[periodSecondMA](firstMA)
signalline = TimeSeriesAverage[periodThirdMA](secondMA)
// trade only in trading window 8-22
IF Time >= startTime AND Time <= endTime THEN
// filter criteria because not every breakout is profitable
c1 = close > Average[periodLongMA](close)
c2 = close < Average[periodLongMA](close)
c3 = close > Average[periodShortMA](close)
c4 = close < Average[periodShortMA](close)
// saisonal pattern
saisonalShortPattern = CurrentMonth >= startShortPattern AND CurrentMonth <= endShortPattern
// long position conditions
l1 = signalline CROSSES OVER monthlyHigh
l2 = signalline CROSSES OVER weeklyHigh
l3 = signalline CROSSES OVER DHigh(1)
l4 = signalline CROSSES OVER monthlyLow
// short position conditions
s1 = signalline CROSSES UNDER monthlyHigh
s2 = signalline CROSSES UNDER monthlyLow
s3 = signalline CROSSES UNDER Dlow(1)
// long entry
IF ( l1 OR l4 OR l2 OR (l3 AND c2) ) THEN // cumulate orders for long trades
BUY PositionSize CONTRACT AT MARKET
ENDIF
// short entry
IF NOT SHORTONMARKET AND ( (s1 AND c3) OR (s2 AND c4) OR (s3 AND c1) ) THEN // no cumulation for short trades
IF saisonalShortPattern THEN
SELLSHORT positionSize * shortPositionMultiplier CONTRACT AT MARKET
ELSE
SELLSHORT positionSize CONTRACT AT MARKET
ENDIF
ENDIF
// stop and profit management
posProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsize
m1 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxDaysWithProfit * 5 // 5*4H candles are one day
m2 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxDaysWithoutProfit * 5
IF ONMARKET AND m1 OR m2 THEN
IF SHORTONMARKET THEN
EXITSHORT positionSize SHARES AT MARKET
ENDIF
IF LONGONMARKET THEN
SELL positionSize SHARES AT MARKET
ENDIF
ENDIF
SET STOP %LOSS stoppLoss
SET TARGET %PROFIT takeProfit
ENDIF
Hello, the system in backtest seems work but go on live, seems that have a problem.
Like: Partial close of position Le seguenti modifiche sono state applicate prima dell’invio del codice a ProOrder: – I sistemi di trading con ordini che chiudono parzialmente una posizione non possono essere inviati a ProOrder (ad es. SELL 3 SHARES AT MARKET).Assicurati che non sia specificata nessuna quantità nelle istruzioni che chiudono le posizioni (in questo caso, l’istruzione chiude l’intera posizione). Ad es.SELL AT MARKETEXITSHORT AT 1.5 LIMIT
Hi AleX,
Thanks for your comment. I see what you mean. For real mode trading you have to replace the following lines:
Sorry for the confusion.
Reiner
IF ONMARKET AND m1 OR m2 THEN
IF SHORTONMARKET THEN
EXITSHORT AT MARKET
ENDIF
IF LONGONMARKET THEN
SELL AT MARKET
ENDIF
ENDIF
Pathfinder version 2 update. Bug fixing for real mode trading.
// Pathfinder DAX 4H, 8-22, 2 points spread
// DAX breakout system triggered by previous daily, weekly and monthly high/low crossings
// Version 2
// code parameter
DEFPARAM CUMULATEORDERS = true // cumulate orders if not switch off
DEFPARAM PRELOADBARS = 1000
// trading window 8-22
ONCE startTime = 80000
ONCE endTime = 220000
// smoothed average parameter (signalline)
periodFirstMA = 5
periodSecondMA = 10
periodThirdMA = 5
// filter parameter
periodLongMA = 200
periodShortMA = 50
// trading paramter
ONCE positionSize = 1
// money and position management parameter
ONCE stoppLoss = 3 // in %
ONCE takeProfit = 1.5 // in %
ONCE maxDaysWithProfit = 3 // take profit after 3 days
ONCE maxDaysWithoutProfit = 5 // limit loss after 5 days
ONCE startShortPattern = 4 // April
ONCE endShortPattern = 9 // September
ONCE shortPositionMultiplier = 2 // double short position size in case of higher saisonal probability
// calculate weekly high/low
If DayOfWeek < DayOfWeek[1] then
weeklyHigh = Highest[BarIndex - lastWeekBarIndex](DHigh(1))
lastWeekBarIndex = BarIndex
ENDIF
// calculate monthly high/low
If Month <> Month[1] then
monthlyHigh = Highest[BarIndex - lastMonthBarIndex](DHigh(1))
monthlyLow = Lowest[BarIndex - lastMonthBarIndex](DLow(1))
lastMonthBarIndex = BarIndex
ENDIF
// calculate signalline with multiple smoothed averages
firstMA = WilderAverage[periodFirstMA](close)
secondMA = TimeSeriesAverage[periodSecondMA](firstMA)
signalline = TimeSeriesAverage[periodThirdMA](secondMA)
// trade only in trading window 8-22
IF Time >= startTime AND Time <= endTime THEN
// filter criteria because not every breakout is profitable
c1 = close > Average[periodLongMA](close)
c2 = close < Average[periodLongMA](close)
c3 = close > Average[periodShortMA](close)
c4 = close < Average[periodShortMA](close)
// saisonal pattern
saisonalShortPattern = CurrentMonth >= startShortPattern AND CurrentMonth <= endShortPattern
// long position conditions
l1 = signalline CROSSES OVER monthlyHigh
l2 = signalline CROSSES OVER weeklyHigh
l3 = signalline CROSSES OVER DHigh(1)
l4 = signalline CROSSES OVER monthlyLow
// short position conditions
s1 = signalline CROSSES UNDER monthlyHigh
s2 = signalline CROSSES UNDER monthlyLow
s3 = signalline CROSSES UNDER Dlow(1)
// long entry
IF ( l1 OR l4 OR l2 OR (l3 AND c2) ) THEN // cumulate orders for long trades
BUY PositionSize CONTRACT AT MARKET
ENDIF
// short entry
IF NOT SHORTONMARKET AND ( (s1 AND c3) OR (s2 AND c4) OR (s3 AND c1) ) THEN // no cumulation for short trades
IF saisonalShortPattern THEN
SELLSHORT positionSize * shortPositionMultiplier CONTRACT AT MARKET
ELSE
SELLSHORT positionSize CONTRACT AT MARKET
ENDIF
ENDIF
// stop and profit management
posProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsize
m1 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxDaysWithProfit * 5 // 5*4H candles are one day
m2 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxDaysWithoutProfit * 5
IF ONMARKET AND m1 OR m2 THEN
IF SHORTONMARKET THEN
EXITSHORT AT MARKET
ENDIF
IF LONGONMARKET THEN
SELL AT MARKET
ENDIF
ENDIF
SET STOP %LOSS stoppLoss
SET TARGET %PROFIT takeProfit
ENDIF
Hi Reiner and many thanks again for contributing to the Library. Do you want me to change the code and file of the post?
Hi Nicolas and thanks for your offer. Yes please make an update. With version 2 everything is finished what I had planed so far. Let’s make money with it. Reiner
The post code and file has been updated to your last version (version 2)
Hi Reiner,
Thanks for sharing your strategy and code. It seems to work very well on demo, Congratulations.
Hi Jesús,
Welcome and thanks for your comment. Yes backtest looks realy promising. Yesterday I have started the robot for real trading let’s see how it works in real life.
regards
Reiner
Yes, its really look good. I will try to run this live, for the beginning with a smaller Positionsize.
The problem in the automatic systems are, that we check in few minutes a Timeframe of 4 years and see, that we can earn money. But in Real, 4 Years are a lot of time. Each Day you will check your system, maybe you will loss money on that day but you have the belive in your System an have to still wait. And i think, that is the most difficult thing at the automatic trading.
Vielen Dank Reiner für die ganzen tollen Codes. Tradest du die selber auch live ?
Gruß
Thanks.
Hallo Bolu14,
Danke für deinen Kommentar und Willkommen. Ich trade verschiedene Strategien automatisch oder manuell aber nicht alle die ich hier veröffentlich habe. Pathfinder ist eine Sammlung von Techniken die ich bisher manuell gehandelt habe, den Breakout von Tages- oder Monats Hoch/Tief haben viele Trader auf dem Plan. Bisher ist das System noch in der Entwicklung und ich bin ehrlich selbst überrascht wie gut der Backtest ist. Das Grundgerüst scheint mir robust zu sein, 100% zufrieden bin ich aber noch nicht, da das System doch spät einsteigt und den Trend nicht lange genug mitnimmt durch die harten Stop und Target Limits. Aber vlt. finden wir gemeinsam ja eine noch bessere Lösung.
Gruß
Reiner
Hi Reiner,
I am testing in demo account and for now only made a one positive trade. For me it is too early to put the strategy in real mode, but I hope your comments as you go running in real. Again, thank you very much for your excellent work Rainer.
Hallo Bolu14,
Danke für deinen Kommentar und Willkommen. Ich trade verschiedene Strategien automatisch oder manuell aber nicht alle die ich hier veröffentlich habe. Pathfinder ist eine Sammlung von Techniken die ich bisher manuell gehandelt habe, den Breakout von Tages- oder Monats Hoch/Tief haben viele Trader auf dem Plan. Bisher ist das System noch in der Entwicklung und ich bin ehrlich selbst überrascht wie gut der Backtest ist. Das Grundgerüst scheint mir robust zu sein, 100% zufrieden bin ich aber noch nicht, da das System doch spät einsteigt und den Trend nicht lange genug mitnimmt durch die harten Stop und Target Limits. Aber vlt. finden wir gemeinsam ja eine noch bessere Lösung.
Gruß
Reiner
I also have one positive trade on demo. The only thing which concerns me long-term is that stoploss is 3% vs target profit of 1.5%. To my knowledge it means a negative expectancy in the long run because you need consistent 60%+ win/lose ratio to accommodate system requirements.
Hi absent1980,
Thanks for your comment and welcome. You ‘re right. I’m not happy with the hard % limits and 300 points loss is a big number. Maybe we find together a better solution. regards Reiner
Capital = 10000
Risk = 0.01
StopCoefficient = 75 //it can be any number, 75 gives you initial positionsize of 1.
REM Calculate contracts
equity = Capital + StrategyProfit
maxrisk = round(equity*Risk)
PositionSize = abs(round((maxrisk/StopCoefficient)/PointValue))
// money and position management parameter
ONCE stoppLoss = 1 // in % (reduced from 3 to 1)
ONCE takeProfit = 2.5 // in % (increased from 1.5 to 2.5)
This amendment will reduce your system performance on backtesting but you shouldn’t lose more than 1%(or 2% for cumulative positions) of your equity on a trade. R/R ratio is still high enough to be profitable long term due to compounding position sizing. Also may i ask you how much automated optimization have you done? Your system looks very good but over optimizing will make it curve fitted, thus very vulnerable to market changes.
I understand what you mean and thanks for your contribution. Give me a moment to play around with your idea. Key feature of Pathfinder is the smoothed average as signalline. The used period lenghts are optimized. Stop and take profit limits and max days holding period values as well. The backtest result is certainly an optimized view but I’m confident that it could work because Pathfinder is a backward engineering of some of my manual but profitable trading techniques. We will see.
Also you can try to optimize your system to volatility and trade only if volatility is within certain range. I did some backtesting and noticed better performance.
Il timing è il mio mestiere .
Dopo aver testato in demo … ieri primo trade in reale … No comment (solo parolacce)
Comunque in base alla mia esperienza , un trade negativo , anche se il primo , non condiziona il mio giudizio sul codice che ritengo tra i più validi in circolazione.
peccato sarebbe stato più bello partire con un gain .
Grazie comunque per il tuo contributo Reiner .
miguel
Hi miguell33,
Thanks for your comment and welcome. Yesterday evening Pathfinder shorted the DAX at 9968 because signalline crossed under previous daily low. Unfortunately good company news from SAP and VW pushed the DAX higher and the trade is under water so far. Please find below some additional infos. regards Reiner
https://www.evernote.com/shard/s80/sh/3c8432cd-63f5-4301-a3cb-9a9dd5c8713b/743defcc06fa10ab3a514b9e34fbf76a
Hi Reiner.
First of all, thanks for sharing this exceptional system code with all of us.
I also agree with absent1980 as I also understand that a system with a stop loss of 3% against a take profit of 1,5% should be a long term loser. This is not the case with the backtests I did.
With the backtest between 4th of January and 18/07, I got a profit of 21.282€. However, changing this fix nr. by a variable number and substituting the take profit of 1.5% by a 2.3%, the backtest increases the profit up to 27.641€. Do you recommend to increase this take profit in general, or this could be a too high risk to work normally with? And do you also think that reducing the stop loss could be a solution to minimize the losses? Although you have an excellent ratio benefits/losses…
Und danke für deine Hilfe für die Anfänger wie ich.
Grüsse
Petrus
Hi Petrus,
Thanks for your comment and welcome. The stop loss in Pathfinder works in a sense of a disaster stopp. You can omit it or set it to a higher value like e.g 5% without lose significant performance. The take profit limit depends to your willingness to take risk. Higher profit limits lead to higher performance and lower profitable trade rates. Personally I prefer trading systems with 70% rate of profitable trades. A good take profit limit is 2%.
regards
Reiner
Dear Reiner
Thanks for sharing all your codes,
rather than using fix profit limit and stop loss, have you tried to use weekly/daily pivot point for exit?
Regards
Yannick
Bonjour Yannick,
Thanks for your comment and welcome. I didn’t test pivots as exit trigger but this idea would be worth to test.
regards
Reiner
Yannick, I have made a “quick and dirty” test of your idea. Results were partially better but drawdowns were higher and the rate of profitable trades were under 50%. Weekly pivots delivered the best results. Here is the code to play around – just uncomment the related pivot calculations. regards Reiner
// Pathfinder DAX 4H, 8-22, 2 points spread
// DAX breakout system triggered by previous daily, weekly and monthly high/low crossings
// Version test pivots as exit trigger
// code parameter
DEFPARAM CUMULATEORDERS = true // cumulate orders if not turned off
DEFPARAM PRELOADBARS = 1000
// trading window 8-22
ONCE startTime = 80000
ONCE endTime = 220000
// smoothed average parameter (signalline)
periodFirstMA = 5
periodSecondMA = 10
periodThirdMA = 5
// filter parameter
periodLongMA = 200
periodShortMA = 50
// trading paramter
positionSize = 1
// money and position management parameter
ONCE startShortPattern = 4 // April
ONCE endShortPattern = 9 // September
ONCE shortPositionMultiplier = 2 // double short position size in case of higher saisonal probability
// daily pivots
//dailyPivot = (DHigh(1) + DLow(1) + Close[1]) / 3
//dailyR1 = 2*dailyPivot - DLow(1)
//dailyS1 = 2*dailyPivot - DHigh(1)
//dailyR2 = dailyPivot + (DHigh(1) - DLow(1))
//dailyS2 = dailyPivot - (DHigh(1) - DLow(1))
//dailyR3 = dailyR1 + (DHigh(1) - DLow(1))
//dailyS3 = dailyS1 - (DHigh(1) - DLow(1))
// calculate weekly high/low and pivots
If DayOfWeek < DayOfWeek[1] then
weeklyHigh = Highest[BarIndex - lastWeekBarIndex](DHigh(1))
weeklyLow = Lowest[BarIndex - lastWeekBarIndex](DLow(1))
lastWeekBarIndex = BarIndex
weeklyPivot = (weeklyHigh + weeklyLow + DClose(1)) / 3
weeklyR1 = 2*weeklyPivot - weeklyLow
weeklyS1 = 2*weeklyPivot - weeklyHigh
//weeklyR2 = weeklyPivot + (weeklyHigh - weeklyLow)
//weeklyS2 = weeklyPivot - (weeklyHigh - weeklyLow)
weeklyR3 = weeklyR1 + (weeklyHigh - weeklyLow)
weeklyS3 = weeklyS1 - (weeklyHigh - weeklyLow)
ENDIF
// calculate monthly high/low and pivots
If Month <> Month[1] then
monthlyHigh = Highest[BarIndex - lastMonthBarIndex](DHigh(1))
monthlyLow = Lowest[BarIndex - lastMonthBarIndex](DLow(1))
lastMonthBarIndex = BarIndex
//monthlyPivot = (monthlyHigh + monthlyLow + DClose(1)) / 3
//monthlyR1 = 2*monthlyPivot - monthlyLow
//monthlyS1 = 2*monthlyPivot - monthlyHigh
//monthlyR2 = monthlyPivot + (monthlyHigh - monthlyLow)
//monthlyS2 = monthlyPivot - (monthlyHigh - monthlyLow)
//monthlyR3 = monthlyR1 + (monthlyHigh - monthlyLow)
//monthlyS3 = monthlyS1 - (monthlyHigh - monthlyLow)
ENDIF
// calculate signalline with multiple smoothed averages
firstMA = WilderAverage[periodFirstMA](close)
secondMA = TimeSeriesAverage[periodSecondMA](firstMA)
signalline = TimeSeriesAverage[periodThirdMA](secondMA)
// trade only in trading window 8-22
IF Time >= startTime AND Time <= endTime THEN
// filter criteria because not every breakout is profitable
c1 = close > Average[periodLongMA](close)
c2 = close < Average[periodLongMA](close)
c3 = close > Average[periodShortMA](close)
c4 = close < Average[periodShortMA](close)
// saisonal pattern
saisonalShortPattern = CurrentMonth >= startShortPattern AND CurrentMonth <= endShortPattern
// long position conditions
l1 = signalline CROSSES OVER monthlyHigh
l2 = signalline CROSSES OVER weeklyHigh
l3 = signalline CROSSES OVER DHigh(1)
l4 = signalline CROSSES OVER monthlyLow
// short position conditions
s1 = signalline CROSSES UNDER monthlyHigh
s2 = signalline CROSSES UNDER monthlyLow
s3 = signalline CROSSES UNDER Dlow(1)
// long entry
IF ( l1 OR l4 OR l2 OR (l3 AND c2) ) THEN // cumulate orders for long trades
BUY PositionSize CONTRACT AT MARKET
ENDIF
// short entry
IF NOT SHORTONMARKET AND ( (s1 AND c3) OR (s2 AND c4) OR (s3 AND c1) ) THEN // no cumulation for short trades
IF saisonalShortPattern THEN
SELLSHORT positionSize * shortPositionMultiplier CONTRACT AT MARKET
ELSE
SELLSHORT positionSize CONTRACT AT MARKET
ENDIF
ENDIF
// stop and profit management triggered by pivots
// long
IF LONGONMARKET AND close CROSSES OVER weeklyR3 THEN // take profit
SELL AT MARKET
ENDIF
IF LONGONMARKET AND close CROSSES UNDER weeklyS3 THEN // stop
SELL AT MARKET
ENDIF
// short
IF SHORTONMARKET AND close CROSSES UNDER weeklyS3 THEN // take profit
EXITSHORT AT MARKET
ENDIF
IF SHORTONMARKET AND close CROSSES OVER weeklyR3 THEN // stop
EXITSHORT AT MARKET
ENDIF
ENDIF
Hi Reiner ,
oggi il codice ha generato un ordine long mentre in backtest e’ sempre short dal 19 luglio.
come mai questa diseguaglianza ?
Grazie .
miguel
Hi Miguel,
Pathfinder closed at 9:00 the short postion and opened in the same transaction a long position at 10190. Trigger was that signalline crossed over the weekly high. Backtest mode needs one additional candle to display the syncronized events. regards Reiner
Si ho visto adesso .
Grazie per la tua cortesia.
miguel
Hi Reiner,
Great system and thank you for sharing it with the community here.
I’m having trouble with setting this part of the code working for my timezone (GMT+8 Australia AWST):
// trading window 8-22
ONCE startTime = 80000
ONCE endTime = 220000
For me, DAX opens @ 1500 and closes @ 2330 for 1pt spread. 2pt spread ends at 0500.
The problem I’m having is that I’m not sure how I can modify the code to take into account my timezone since the below code doesn’t work:
// trading window 8-22
ONCE startTime = 150000
ONCE endTime = 050000
I haven’t yet found a way for it to work, and is a common issue I face quite often with systems that work through till the end of 2pt spread session.
Are you able to shed some light on this and help if possible?
Thanks again Reiner, love your work by the way especially with the DAX up/down and DAX Bluemoon!
Siaoman
Hi Siaoman,
Thanks for your comment and welcome. I asume the problem is that the used indicator calculation doesn’t work correctly in different timezones. Please check workstation-options and timezone settings or check the forum for relevant topics. I have found a related discussion here: http://www.prorealcode.com/topic/proorder-and-customized-time-zones/
regards
Reiner
Hi Reiner. I start pathfinder in real on 23/07 but at today it’s doesn’t start. what you think about this? It’s normal or my proorder get some trouble?
thank you for sharing your strategy
Hi Luigi,
Thanks for your comment and welcome. I’m still analyzing the backtest trades and that’s why I’m currently not trading in real mode but I observed that proorder needs more than max 1 position size because Pathfinder works with variable order sizes. When you started at 23/07 I would expect the last trade on 26/07 9:00 Buy 1 at 10190 and close on 27/07 9:00 at 10343. Please find more details in Pathfinder Inside.
https://www.evernote.com/shard/s80/sh/3c8432cd-63f5-4301-a3cb-9a9dd5c8713b/743defcc06fa10ab3a514b9e34fbf76a
regards
Reiner
Hi Reiner.
In order to solve the IG problem on mondays (DHigh[1] is then the High from Sunday), perhaps you could try this solution I programmed:
a1=DayOfWeek
b1=DHigh(1)
b2=DHigh(2)
c1=DLow(1)
c2=DLow(2)
d1=DClose(1)
d2=DClose(2)
IF a1=1 THEN
b1=b2
c1=c2
d1=d2
ELSE
b1=b1
c1=c1
d1=d1
ENDIF
H1 = b1//High
L1 = c1//Low
C = d1//Close
Pivot = (H1 + L1 + C) / 3
RETURN b1 AS \"DHigh[1]\", c1 AS \"DLow[1]\", Pivot AS \"Pivot Point[1]\"
It is not 100% perfect, but it works.
Regards
Petrus
Petrus, I have made a quick test of your idea. Results with weekly pivots were not better. Replace Pathfinders DHigh/DLow calculation of weekly and monthly high/low leads not to better results as well. It seems that for Pathfinder the “IG problem” is a feature and not a bug.
See below the code I have used.
regards Reiner
IF dayOfWeek = 1 THEN
dayHigh = DHigh(2)
dayLow = DLow(2)
dayClose = DClose(2)
ENDIF
IF dayOfWeek >=2 and dayOfWeek < 6 THEN
dayHigh = DHigh(1)
dayLow = DLow(1)
dayClose = DClose(1)
ENDIF
dailyPivot = (dayHigh + dayLow + dayClose) / 3
// calculate weekly high/low and pivots
If DayOfWeek < DayOfWeek[1] then
weeklyHigh = Highest[BarIndex - lastWeekBarIndex](dayHigh)
weeklyLow = Lowest[BarIndex - lastWeekBarIndex](dayLow)
lastWeekBarIndex = BarIndex
weeklyPivot = (weeklyHigh + weeklyLow + dayClose) / 3
weeklyR1 = 2*weeklyPivot - weeklyLow
weeklyS1 = 2*weeklyPivot - weeklyHigh
//weeklyR2 = weeklyPivot + (weeklyHigh - weeklyLow)
//weeklyS2 = weeklyPivot - (weeklyHigh - weeklyLow)
weeklyR3 = weeklyR1 + (weeklyHigh - weeklyLow)
weeklyS3 = weeklyS1 - (weeklyHigh - weeklyLow)
ENDIF
hi reiner, proorder tell my error message for preloadbars, I change 1000 in 2000,it’s ok?
thanks for your answer and for your system
Luigi, you can set this parameter to every value as long as proorder is happy with it. I never had this problem in backtest or real mode. In which environment you are getting this message?
Hi reiner, thanks for your reply in advance….I’m trying to launch pathfinder in real with 1 contract with Dax and the same for CAC and FTSE100. It’s strange because this night Pathfinder try to start CAC and FTSE100 and proorder stop them with the message of the preloadbars, so on DAX never start and I’m waiting to see what pathfinder do in real. I write from Italy and my platform is IG.
Have you something to suggest me? ( I think thet your system is very good and then I would spend time to see what the system do in real instead of waiting)
thank you very much
Luigi, Pathfinder works with cumulative and variable order sizes maybe that’s your problem. When you start Pathfinder and proorder is asking after the max position size set a higher value then 1 also if you have set positionSize to 1 in Pathfinder’s code. Take care with CAC and FTSE100 – Pathfinder was not tested with these instruments.
Hi reainer and Thanks again for your reply, I saw that also in my backtest pathfinder don’t start from 27 july, it’s correct?
Luigi, Pathfinder shorted the DAX at 10130 today.
Hi reiner, today afternoon pathfinder start in real 2 contracts on Dax and 2 in Cac, I see that don’t start in backtest….why?
I don’t change nothing of your version 2 ready for real trading
PRT will synchronize the trading events in backtest mode after an additional candle.
Perfekt !!
Ho reiner, Yes in Dax 2 position open at 10130,5 and 2 position at 10128,5… I don’t know why
on cac open 2 position at 4319,9
Reiner
Mi puoi spiegare perché inserendo lo stesso codice in prt 10.2 e prt 10.3 ho dei risultati diversi ?
Ieri per esempio nella versione 10.3 mi fa uscire in profit (entrato prima in short) mentre nella versione 10.2 m
fa entrare short .
cosa non capisco ?
grazie per la tua collaborazione e cortesia .
miguel
Miguel,
as IG customer currently only 10.2 is available for me. I haven’t used 10.3 so far and unfortunately I have no answer to your question. – regards Reiner
Good move on DAX today.
Hallo Reiner,
Really impressed by this strategy, vielen dank for sharing it. I’ve been reading a couple of times to completely understand the workflow and I just wondered why maxDaysWith and WithoutProfit are * 5 as maybe stupidely, I always thought that there where 6 candles of 4 hours in a day. To be sure I changed maxDays by MaxCandles to test. The optimal result shows 16 candles with profit and a different number withoutProfit, depending on if it is a long or a short trade. As it works great “like it is”, and just to be sure, is there in your opinion any special reason to keep the MaxDays and with *5 without breaking the global coherency?
Thank you again,
My best regards
Bonjour mofiman,
Thanks for your comment and welcome. You are wright using candles is better to understand. I will change this in the next version.
regards
Reiner
@mofiman
yes, 5 * 4H-Candles per Day is not correct but it gives the best result.
OK OldGerman, thanks for your reply. So there is nothing against using candles instead of 5 candle packs. Everything is clear now. Thank you again
best regards
Pathfinder version 3 released. I have reorganized the code a little bit to make things clearer. Based on comments and results of the last trades I tried to improve the trading algorithm as well. The main changes are:
the separation of the limits for long and short trades
introduction of seasonal position management for long and short trades
the conversion of maximum holding period from days to candles
optimizing of some parameters like periodThirdMA, periodLongMA
Please find more details in Pathfinder Inside.
https://www.evernote.com/shard/s80/sh/3c8432cd-63f5-4301-a3cb-9a9dd5c8713b/743defcc06fa10ab3a514b9e34fbf76a
// Pathfinder DAX 4H, 9-22, 2 points spread
// DAX breakout system triggered by previous daily, weekly and monthly high/low crossings
// Version 3
// ProOrder code parameter
DEFPARAM CUMULATEORDERS = true // cumulate orders if not turned off
DEFPARAM PRELOADBARS = 10000
// trading window 8-22
ONCE startTime = 80000
ONCE endTime = 220000
// smoothed average parameter (signalline)
ONCE periodFirstMA = 5
ONCE periodSecondMA = 10
ONCE periodThirdMA = 3
// filter parameter
ONCE periodLongMA = 250
ONCE periodShortMA = 50
// trading paramter
ONCE PositionSize = 1
// money and position management parameter
ONCE stoppLoss = 5 // in %
ONCE takeProfitLong = 2 // in %
ONCE takeProfitShort = 1.75 // in %
ONCE maxCandlesLongWithProfit = 18 // take long profit latest after 18 candles
ONCE maxCandlesShortWithProfit = 13 // take short profit latest after 13 candles
ONCE maxCandlesLongWithoutProfit = 30 // limit long loss latest after 30 candles
ONCE maxCandlesShortWithoutProfit = 25 // limit short loss latest after 25 candles
ONCE startShortPattern = 4 // April
ONCE endShortPattern = 9 // September
ONCE longPositionMultiplier = 2 // multiplier for long position size in case of higher saisonal probability
ONCE shortPositionMultiplier = 2 // multiplier for short position size in case of higher saisonal probability
// calculate daily high/low
dailyHigh = DHigh(1)
dailyLow = DLow(1)
// calculate weekly high/low
If DayOfWeek < DayOfWeek[1] then
weeklyHigh = Highest[BarIndex - lastWeekBarIndex](dailyHigh)
lastWeekBarIndex = BarIndex
ENDIF
// calculate monthly high/low
If Month <> Month[1] then
monthlyHigh = Highest[BarIndex - lastMonthBarIndex](dailyHigh)
monthlyLow = Lowest[BarIndex - lastMonthBarIndex](dailyLow)
lastMonthBarIndex = BarIndex
ENDIF
// calculate signalline with multiple smoothed averages
firstMA = WilderAverage[periodFirstMA](close)
secondMA = TimeSeriesAverage[periodSecondMA](firstMA)
signalline = TimeSeriesAverage[periodThirdMA](secondMA)
// trade only in trading window 8-22
IF Time >= startTime AND Time <= endTime THEN
// filter criteria because not every breakout is profitable
c1 = close > Average[periodLongMA](close)
c2 = close < Average[periodLongMA](close)
c3 = close > Average[periodShortMA](close)
c4 = close < Average[periodShortMA](close)
// saisonal pattern
saisonalShortPattern = CurrentMonth >= startShortPattern AND CurrentMonth <= endShortPattern
// long position conditions
l1 = signalline CROSSES OVER monthlyHigh
l2 = signalline CROSSES OVER weeklyHigh
l3 = signalline CROSSES OVER dailyHigh
l4 = signalline CROSSES OVER monthlyLow
// short position conditions
s1 = signalline CROSSES UNDER monthlyHigh
s2 = signalline CROSSES UNDER monthlyLow
s3 = signalline CROSSES UNDER dailyLow
// long entry
IF ( l1 OR l4 OR l2 OR (l3 AND c2) ) THEN // cumulate orders for long trades
IF not saisonalShortPattern THEN
BUY PositionSize * longPositionMultiplier CONTRACT AT MARKET
ELSE
BUY PositionSize CONTRACT AT MARKET
ENDIF
takeProfit = takeProfitLong
ENDIF
// short entry
IF NOT SHORTONMARKET AND ( (s1 AND c3) OR (s2 AND c4) OR (s3 AND c1) ) THEN // no cumulation for short trades
IF saisonalShortPattern THEN
SELLSHORT positionSize * shortPositionMultiplier CONTRACT AT MARKET
ELSE
SELLSHORT positionSize CONTRACT AT MARKET
ENDIF
takeProfit = takeProfitShort
ENDIF
// stop and profit management
posProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsize
m1 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithProfit
m2 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithProfit
m3 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithoutProfit
m4 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithoutProfit
IF LONGONMARKET AND (m1 OR m3) THEN
SELL AT MARKET
ENDIF
IF SHORTONMARKET AND (m2 OR m4) THEN
EXITSHORT AT MARKET
ENDIF
SET STOP %LOSS stoppLoss
SET TARGET %PROFIT takeProfit
ENDIF
Do you want me to update the main post ITF file Reiner?
Hi Reiner, and good job 🙂 I really like that you works very hard and persistent to optimize and tweak your own code. When I backtest Ver.3 on DAX I see very early you put up 10 positionsize the 22 nov. 2012 and risk around 20% of your account?
I added this small code
graph ((tradeprice*stopploss)/100)*positionsize*pointvalue*pipsize/(equity+capital)*100 COLOURED(0,0,0) AS \"MAXRISK\"//Aqua
forgot this code as well
Capital=1000
equity = Capital + StrategyProfit
Nicolas, please make an update. Thanks
Your post has been updated with the V3 code and ITF file too.
Hi Reiner,Your v3 Path Finder Performance is excellent! However, i do not have large capital to manage any of the losing trade. so I resized the output by changing the SL% and TP%. Unfortunately, the result is not good as compared to default parameters. Could you please advice what are parameters i need to change in order to maintain the performance? br,CKW
Hi CKW,
a reduction of risk with the same performance is impossible. You can reduce risk and drawdown when you omit order cumulation and the seasonal pattern booster and increase the take profit limit. Change the following parameters:
DEFPARAM CUMULATEORDERS = falseONCE takeProfitLong = 3.25
ONCE longPositionMultiplier = 1
ONCE shortPositionMultiplier = 1
With these changes Pathfinder is trading only with fixed position size of 1 contract and the drawdown is reduced under 10%. Unfortunately the performance is reduced as well.
regards
Reiner
Hi Reiner,
Crazy performance on this one – great work! Have you tested it with that variable position sizing code you’re using in some of your other algos? If you have the time please consider including it – would be interessting to see the result.
Hi dane,
Yes, I have tested it and it delivers exceptional but results. Pathfinder V3 has some features for variable position sizing and for me it’s enough thrill. But if you have the “balls” for bigger drawdowns here is the code to play around and in Pathfinder Inside you can see an example of smart position sizing.
https://www.evernote.com/shard/s80/sh/3c8432cd-63f5-4301-a3cb-9a9dd5c8713b/743defcc06fa10ab3a514b9e34fbf76a
regards
Reiner
// Pathfinder DAX 4H, 9-22, 2 points spread
// DAX breakout system triggered by previous daily, weekly and monthly high/low crossings
// Version 3 with smart position sizing
// ProOrder code parameter
DEFPARAM CUMULATEORDERS = true // cumulate orders if not turned off
DEFPARAM PRELOADBARS = 10000
// trading window 8-22
ONCE startTime = 80000
ONCE endTime = 220000
// smoothed average parameter (signalline)
ONCE periodFirstMA = 5
ONCE periodSecondMA = 10
ONCE periodThirdMA = 3
// filter parameter
ONCE periodLongMA = 250
ONCE periodShortMA = 50
// trading paramter
// smart position sizing
Capital = 10000
Risk = 0.01
StopCoefficient = 75
equity = Capital + StrategyProfit
maxrisk = round(equity * Risk)
PositionSize = abs(round((maxrisk / StopCoefficient) / PointValue))
//ONCE PositionSize = 1
// money and position management parameter
ONCE stoppLoss = 5 // in %
ONCE takeProfitLong = 3.25 // in %
ONCE takeProfitShort = 1.75 // in %
ONCE maxCandlesLongWithProfit = 18 // take long profit latest after 18 candles
ONCE maxCandlesShortWithProfit = 13 // take short profit latest after 13 candles
ONCE maxCandlesLongWithoutProfit = 30 // limit long loss latest after 30 candles
ONCE maxCandlesShortWithoutProfit = 25 // limit short loss latest after 25 candles
ONCE startShortPattern = 4 // April
ONCE endShortPattern = 9 // September
ONCE longPositionMultiplier = 2 // multiplier for long position size in case of higher saisonal probability
ONCE shortPositionMultiplier = 2 // multiplier for short position size in case of higher saisonal probability
// calculate daily high/low
dailyHigh = DHigh(1)
dailyLow = DLow(1)
// calculate weekly high/low
If DayOfWeek < DayOfWeek[1] then
weeklyHigh = Highest[BarIndex - lastWeekBarIndex](dailyHigh)
lastWeekBarIndex = BarIndex
ENDIF
// calculate monthly high/low
If Month <> Month[1] then
monthlyHigh = Highest[BarIndex - lastMonthBarIndex](dailyHigh)
monthlyLow = Lowest[BarIndex - lastMonthBarIndex](dailyLow)
lastMonthBarIndex = BarIndex
ENDIF
// calculate signalline with multiple smoothed averages
firstMA = WilderAverage[periodFirstMA](close)
secondMA = TimeSeriesAverage[periodSecondMA](firstMA)
signalline = TimeSeriesAverage[periodThirdMA](secondMA)
// trade only in trading window 8-22
IF Time >= startTime AND Time <= endTime THEN
// filter criteria because not every breakout is profitable
c1 = close > Average[periodLongMA](close)
c2 = close < Average[periodLongMA](close)
c3 = close > Average[periodShortMA](close)
c4 = close < Average[periodShortMA](close)
// saisonal pattern
saisonalShortPattern = CurrentMonth >= startShortPattern AND CurrentMonth <= endShortPattern
// long position conditions
l1 = signalline CROSSES OVER monthlyHigh
l2 = signalline CROSSES OVER weeklyHigh
l3 = signalline CROSSES OVER dailyHigh
l4 = signalline CROSSES OVER monthlyLow
// short position conditions
s1 = signalline CROSSES UNDER monthlyHigh
s2 = signalline CROSSES UNDER monthlyLow
s3 = signalline CROSSES UNDER dailyLow
// long entry
IF ( l1 OR l4 OR l2 OR (l3 AND c2) ) THEN // cumulate orders for long trades
IF not saisonalShortPattern THEN
BUY PositionSize * longPositionMultiplier CONTRACT AT MARKET
ELSE
BUY PositionSize CONTRACT AT MARKET
ENDIF
takeProfit = takeProfitLong
ENDIF
// short entry
IF NOT SHORTONMARKET AND ( (s1 AND c3) OR (s2 AND c4) OR (s3 AND c1) ) THEN // no cumulation for short trades
IF saisonalShortPattern THEN
SELLSHORT positionSize * shortPositionMultiplier CONTRACT AT MARKET
ELSE
SELLSHORT positionSize CONTRACT AT MARKET
ENDIF
takeProfit = takeProfitShort
ENDIF
// stop and profit management
posProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsize
m1 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithProfit
m2 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithProfit
m3 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithoutProfit
m4 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithoutProfit
IF LONGONMARKET AND (m1 OR m3) THEN
SELL AT MARKET
ENDIF
IF SHORTONMARKET AND (m2 OR m4) THEN
EXITSHORT AT MARKET
ENDIF
SET STOP %LOSS stoppLoss
SET TARGET %PROFIT takeProfit
ENDIF
Great, thanks! Yes, the drawdowns indeed increase but they seem to be in relation to the higher gains. As long as you are way past your initial capital it is kind of justified – although easy to say when you’re not dealing with real money 🙂
Saw that if you enter a smaller amount than roughly 5000 the PositionSize variable will sometimes round down to zero and thus practically end the backtest. For those who wish to test with lower initial capital I added this to the smart position sizing:
// smart position sizing
Capital = 2000
Risk = 0.01
StopCoefficient = 75
equity = Capital + StrategyProfit
maxrisk = round(equity * Risk)
PositionSize = abs(round((maxrisk / StopCoefficient) / PointValue))
// prevent PositionSize to be zero
IF PositionSize < 1 THEN
PositionSize = 1
ENDIF
Hi Reiner,
Thanks for your advice.I made a small analysis based on the trade (2012 May – 2016 Aug) executed to improve the confident to go on Live. Your “path Finder v3” backtest result is very stable! I just launched this strategy on Live Demo account:)
Few Points:#Month of Dec is Perfect!#2016 having the best performance so far!#Weak Gain on Month on Feb, May but still Good (Which Below <75%)
Sorry, I don’t have the permission the share the screenshot so i share on this link:
https://1drv.ms/i/s!Aq8pIkk5CfoblQznPSXXZ7u54wJ-
br,CKW
Hi Reiner,
Good job, congratulations !!!
Hey guys, is anybody actually trading this for real?
Mark
Hi Mark,
I trade the system real with minor changes since 01.08.2016 . It’s a nice addition to my intraday systems .
Antonius
Hi antonius,
what changes have you made? And how are you results?
Hello mbaker,
//————————————————-// PositionSize longONCE LongSize = 1 //1 // Optimum = >= 2ONCE MaxLongShares = 3 //3 // Optimum = 3 * LongSize//————————————————-// PositionSize shortONCE ShortSizeSmall = 0 // Optimum = 0 Size in WinterONCE ShortSizeBig = 3 // Optimum = MaxLongShares in Summer//————————————————-// money and position management parameterONCE stoppLosslongProz = 3 // in %ONCE stoppLossshortProz = 1.75 // in %ONCE takeProfitlongProz = 4 // in %ONCE takeProfitshortProz = 1.95 // in %
Backtest-Results in four Years are now with long and short nearly the same.
Antonius
Hall Reiner , was passiert wenn ich auf prelaodbars verzichte ?
Beste Grüße
Hallo Michael,
Danke für deine Frage und Willkommen.
ProOrder benötigt für die Berechnung der Indikatoren eine Werte Historie abhängig von den gewählten Parametern. Mit Preloadbars kannst du diese Anzahl einstellen. Pathfinder V3 hat z.B. einen Filter basierend auf einem einfachen gleitenden Durchschnitt mit der Periode 250. Das System benötigt also 250 Kerzen Historie um den korrekten Wert zu berechnen. Lässt du Preloadbars weg und das System benötigt über den Defaultwert hinaus historische Daten liefert ProOrder eine Fehlermeldung. Du kannst den aktuellen Wert von 10.000 reduzieren, aber weglassen würde ich ihn nicht.
Gruß
Reiner
Hey Reiner,
ich hab versucht den MaxDrawdown zu verringern indem ich für die einzelnen Short und Long conditions (monthly, weekly, daily) verschiedene Take Profit und StopLoss Level definiert habe. Hat leider nicht ganz so gut funktioniert, aber dadurch ist es möglich das Ergebnis marginal zu verbessern und den StopLoss manchmal geringer zu setzen.
Ich finde es krass wie du die Performance über die verschiedenen Versionen hinweg verbessern konntest. Danke und weiter so!
Gruß
Flo
// Pathfinder DAX 4H, 9-22, 2 points spread
// DAX breakout system triggered by previous daily, weekly and monthly high/low crossings
// Version 3 with smart position sizing
// ProOrder code parameter
DEFPARAM CUMULATEORDERS = true // cumulate orders if not turned off
DEFPARAM PRELOADBARS = 10000
// trading window 8-22
ONCE startTime = 80000
ONCE endTime = 220000
// smoothed average parameter (signalline)
ONCE periodFirstMA = 5
ONCE periodSecondMA = 10
ONCE periodThirdMA = 3
// filter parameter
ONCE periodLongMA = 250
ONCE periodShortMA = 50
// trading paramter
// smart position sizing
ONCE PositionSize = 1
// money and position management parameter
ONCE stoppLossL1 = 3.25 // in %
ONCE stoppLossL2 = 4.75 // in %
ONCE stoppLossL3 = 5.5 // in %
ONCE stoppLossL4 = 4 // in %
ONCE stoppLossS1 = 2 // in %
ONCE stoppLossS2 = 3 // in %
ONCE stoppLossS3 = 3 // in %
ONCE takeProfitL1 = 3.5 // in %
ONCE takeProfitL2 = 3 // in %
ONCE takeProfitL3 = 4 // in %
ONCE takeProfitL4 = 4 // in %
ONCE takeProfitS1 = 2 // in %
ONCE takeProfitS2 = 2 // in %
ONCE takeProfitS3 = 3 // in %
ONCE maxCandlesLongWithProfit = 18 // take long profit latest after 18 candles
ONCE maxCandlesShortWithProfit = 13 // take short profit latest after 13 candles
ONCE maxCandlesLongWithoutProfit = 30 // limit long loss latest after 30 candles
ONCE maxCandlesShortWithoutProfit = 25 // limit short loss latest after 25 candles
ONCE startShortPattern = 4 // April
ONCE endShortPattern = 9 // September
ONCE longPositionMultiplier = 1 // multiplier for long position size in case of higher saisonal probability
ONCE shortPositionMultiplier = 1 // multiplier for short position size in case of higher saisonal probability
// calculate daily high/low
dailyHigh = DHigh(1)
dailyLow = DLow(1)
// calculate weekly high/low
If DayOfWeek < DayOfWeek[1] then
weeklyHigh = Highest[BarIndex - lastWeekBarIndex](dailyHigh)
lastWeekBarIndex = BarIndex
ENDIF
// calculate monthly high/low
If Month <> Month[1] then
monthlyHigh = Highest[BarIndex - lastMonthBarIndex](dailyHigh)
monthlyLow = Lowest[BarIndex - lastMonthBarIndex](dailyLow)
lastMonthBarIndex = BarIndex
ENDIF
// calculate signalline with multiple smoothed averages
firstMA = WilderAverage[periodFirstMA](close)
secondMA = TimeSeriesAverage[periodSecondMA](firstMA)
signalline = TimeSeriesAverage[periodThirdMA](secondMA)
// trade only in trading window 8-22
IF Time >= startTime AND Time <= endTime THEN
// filter criteria because not every breakout is profitable
c1 = close > Average[periodLongMA](close)
c2 = close < Average[periodLongMA](close)
c3 = close > Average[periodShortMA](close)
c4 = close < Average[periodShortMA](close)
// saisonal pattern
saisonalShortPattern = CurrentMonth >= startShortPattern AND CurrentMonth <= endShortPattern
// long position conditions
l1 = signalline CROSSES OVER monthlyHigh
l2 = signalline CROSSES OVER weeklyHigh
l3 = signalline CROSSES OVER dailyHigh
l4 = signalline CROSSES OVER monthlyLow
// short position conditions
s1 = signalline CROSSES UNDER monthlyHigh
s2 = signalline CROSSES UNDER monthlyLow
s3 = signalline CROSSES UNDER dailyLow
// long entry monthly (L1)
IF l1 THEN // cumulate orders for long trades
IF not saisonalShortPattern THEN
BUY PositionSize * longPositionMultiplier CONTRACT AT MARKET
SET STOP %LOSS stoppLossL1
SET TARGET %PROFIT takeProfitL1
ELSE
BUY PositionSize CONTRACT AT MARKET
SET STOP %LOSS stoppLossL1
SET TARGET %PROFIT takeProfitL1
ENDIF
ENDIF
// long entry weekly (L2)
IF l2 THEN // cumulate orders for long trades
IF not saisonalShortPattern THEN
BUY PositionSize * longPositionMultiplier CONTRACT AT MARKET
SET STOP %LOSS stoppLossL2
SET TARGET %PROFIT takeProfitL2
ELSE
BUY PositionSize CONTRACT AT MARKET
SET STOP %LOSS stoppLossL2
SET TARGET %PROFIT takeProfitL2
ENDIF
ENDIF
// long entry dayly (L3)
IF l3 AND c2 THEN // cumulate orders for long trades
IF not saisonalShortPattern THEN
BUY PositionSize * longPositionMultiplier CONTRACT AT MARKET
SET STOP %LOSS stoppLossL3
SET TARGET %PROFIT takeProfitL3
ELSE
BUY PositionSize CONTRACT AT MARKET
SET STOP %LOSS stoppLossL3
SET TARGET %PROFIT takeProfitL3
ENDIF
ENDIF
// long entry monthly low (L4)
IF l4 THEN // cumulate orders for long trades
IF not saisonalShortPattern THEN
BUY PositionSize * longPositionMultiplier CONTRACT AT MARKET
SET STOP %LOSS stoppLossL4
SET TARGET %PROFIT takeProfitL4
ELSE
BUY PositionSize CONTRACT AT MARKET
SET STOP %LOSS stoppLossL4
SET TARGET %PROFIT takeProfitL4
ENDIF
ENDIF
// short entry (S1)
IF NOT SHORTONMARKET AND s1 AND c3 THEN // no cumulation for short trades
IF saisonalShortPattern THEN
SELLSHORT positionSize * shortPositionMultiplier CONTRACT AT MARKET
SET STOP %LOSS stoppLossS1
SET TARGET %PROFIT takeProfitS1
ELSE
SELLSHORT positionSize CONTRACT AT MARKET
SET STOP %LOSS stoppLossS1
SET TARGET %PROFIT takeProfitS1
ENDIF
ENDIF
// short entry (S2)
IF NOT SHORTONMARKET AND s2 AND c4 THEN // no cumulation for short trades
IF saisonalShortPattern THEN
SELLSHORT positionSize * shortPositionMultiplier CONTRACT AT MARKET
SET STOP %LOSS stoppLossS2
SET TARGET %PROFIT takeProfitS2
ELSE
SELLSHORT positionSize CONTRACT AT MARKET
SET STOP %LOSS stoppLossS2
SET TARGET %PROFIT takeProfitS2
ENDIF
ENDIF
// short entry (S3)
IF NOT SHORTONMARKET AND s3 AND c1 THEN // no cumulation for short trades
IF saisonalShortPattern THEN
SELLSHORT positionSize * shortPositionMultiplier CONTRACT AT MARKET
SET STOP %LOSS stoppLossS3
SET TARGET %PROFIT takeProfitS3
ELSE
SELLSHORT positionSize CONTRACT AT MARKET
SET STOP %LOSS stoppLossS3
SET TARGET %PROFIT takeProfitS3
ENDIF
ENDIF
// stop and profit management
posProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsize
m1 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithProfit
m2 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithProfit
m3 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithoutProfit
m4 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithoutProfit
IF LONGONMARKET AND (m1 OR m3) THEN
SELL AT MARKET
ENDIF
IF SHORTONMARKET AND (m2 OR m4) THEN
EXITSHORT AT MARKET
ENDIF
ENDIF
Flo, Danke für deinen Beitrag. Die Idee ist nicht schlecht, ich hatte etwas ähnliches getestet. Die Ergebnisse waren aber nicht so viel besser, dass sich die zusätzliche Komplexität rechtfertig.
sorry, war nicht das aktuellste
// Pathfinder DAX 4H, 9-22, 2 points spread
// DAX breakout system triggered by previous daily, weekly and monthly high/low crossings
// Version 3 with smart position sizing
// ProOrder code parameter
DEFPARAM CUMULATEORDERS = true // cumulate orders if not turned off
DEFPARAM PRELOADBARS = 10000
// trading window 8-22
ONCE startTime = 80000
ONCE endTime = 220000
// smoothed average parameter (signalline)
ONCE periodFirstMA = 5
ONCE periodSecondMA = 10
ONCE periodThirdMA = 3
// filter parameter
ONCE periodLongMA = 250
ONCE periodShortMA = 50
// trading paramter
// smart position sizing
ONCE PositionSize = 1
// money and position management parameter
ONCE stoppLossL1 = 3.25 // in %
ONCE stoppLossL2 = 4.75 // in %
ONCE stoppLossL3 = 5.5 // in %
ONCE stoppLossL4 = 4 // in %
ONCE stoppLossS1 = 2 // in %
ONCE stoppLossS2 = 3 // in %
ONCE stoppLossS3 = 3 // in %
ONCE takeProfitL1 = 3.5 // in %
ONCE takeProfitL2 = 3 // in %
ONCE takeProfitL3 = 4 // in %
ONCE takeProfitL4 = 4 // in %
ONCE takeProfitS1 = 3.5 // in %
ONCE takeProfitS2 = 1.15 // in %
ONCE takeProfitS3 = 1.75 // in %
ONCE maxCandlesLongWithProfit = 20 // take long profit latest after 18 candles
ONCE maxCandlesShortWithProfit = 13 // take short profit latest after 13 candles
ONCE maxCandlesLongWithoutProfit = 30 // limit long loss latest after 30 candles
ONCE maxCandlesShortWithoutProfit = 25 // limit short loss latest after 25 candles
ONCE startShortPattern = 4 // April
ONCE endShortPattern = 9 // September
ONCE longPositionMultiplier = 1 // multiplier for long position size in case of higher saisonal probability
ONCE shortPositionMultiplier = 1 // multiplier for short position size in case of higher saisonal probability
// calculate daily high/low
dailyHigh = DHigh(1)
dailyLow = DLow(1)
// calculate weekly high/low
If DayOfWeek < DayOfWeek[1] then
weeklyHigh = Highest[BarIndex - lastWeekBarIndex](dailyHigh)
lastWeekBarIndex = BarIndex
ENDIF
// calculate monthly high/low
If Month <> Month[1] then
monthlyHigh = Highest[BarIndex - lastMonthBarIndex](dailyHigh)
monthlyLow = Lowest[BarIndex - lastMonthBarIndex](dailyLow)
lastMonthBarIndex = BarIndex
ENDIF
// calculate signalline with multiple smoothed averages
firstMA = WilderAverage[periodFirstMA](close)
secondMA = TimeSeriesAverage[periodSecondMA](firstMA)
signalline = TimeSeriesAverage[periodThirdMA](secondMA)
// trade only in trading window 8-22
IF Time >= startTime AND Time <= endTime THEN
// filter criteria because not every breakout is profitable
c1 = close > Average[periodLongMA](close)
c2 = close < Average[periodLongMA](close)
c3 = close > Average[periodShortMA](close)
c4 = close < Average[periodShortMA](close)
// saisonal pattern
saisonalShortPattern = CurrentMonth >= startShortPattern AND CurrentMonth <= endShortPattern
// long position conditions
l1 = signalline CROSSES OVER monthlyHigh
l2 = signalline CROSSES OVER weeklyHigh
l3 = signalline CROSSES OVER dailyHigh
l4 = signalline CROSSES OVER monthlyLow
// short position conditions
s1 = signalline CROSSES UNDER monthlyHigh
s2 = signalline CROSSES UNDER monthlyLow
s3 = signalline CROSSES UNDER dailyLow
// long entry monthly (L1)
IF l1 THEN // cumulate orders for long trades
IF not saisonalShortPattern THEN
BUY PositionSize * longPositionMultiplier CONTRACT AT MARKET
SET STOP %LOSS stoppLossL1
SET TARGET %PROFIT takeProfitL1
ELSE
BUY PositionSize CONTRACT AT MARKET
SET STOP %LOSS stoppLossL1
SET TARGET %PROFIT takeProfitL1
ENDIF
ENDIF
// long entry weekly (L2)
IF l2 THEN // cumulate orders for long trades
IF not saisonalShortPattern THEN
BUY PositionSize * longPositionMultiplier CONTRACT AT MARKET
SET STOP %LOSS stoppLossL2
SET TARGET %PROFIT takeProfitL2
ELSE
BUY PositionSize CONTRACT AT MARKET
SET STOP %LOSS stoppLossL2
SET TARGET %PROFIT takeProfitL2
ENDIF
ENDIF
// long entry dayly (L3)
IF l3 AND c2 THEN // cumulate orders for long trades
IF not saisonalShortPattern THEN
BUY PositionSize * longPositionMultiplier CONTRACT AT MARKET
SET STOP %LOSS stoppLossL3
SET TARGET %PROFIT takeProfitL3
ELSE
BUY PositionSize CONTRACT AT MARKET
SET STOP %LOSS stoppLossL3
SET TARGET %PROFIT takeProfitL3
ENDIF
ENDIF
// long entry monthly low (L4)
IF l4 THEN // cumulate orders for long trades
IF not saisonalShortPattern THEN
BUY PositionSize * longPositionMultiplier CONTRACT AT MARKET
SET STOP %LOSS stoppLossL4
SET TARGET %PROFIT takeProfitL4
ELSE
BUY PositionSize CONTRACT AT MARKET
SET STOP %LOSS stoppLossL4
SET TARGET %PROFIT takeProfitL4
ENDIF
ENDIF
// short entry (S1)
IF NOT SHORTONMARKET AND s1 AND c3 THEN // no cumulation for short trades
IF saisonalShortPattern THEN
SELLSHORT positionSize * shortPositionMultiplier CONTRACT AT MARKET
SET STOP %LOSS stoppLossS1
SET TARGET %PROFIT takeProfitS1
ELSE
SELLSHORT positionSize CONTRACT AT MARKET
SET STOP %LOSS stoppLossS1
SET TARGET %PROFIT takeProfitS1
ENDIF
ENDIF
// short entry (S2)
IF NOT SHORTONMARKET AND s2 AND c4 THEN // no cumulation for short trades
IF saisonalShortPattern THEN
SELLSHORT positionSize * shortPositionMultiplier CONTRACT AT MARKET
SET STOP %LOSS stoppLossS2
SET TARGET %PROFIT takeProfitS2
ELSE
SELLSHORT positionSize CONTRACT AT MARKET
SET STOP %LOSS stoppLossS2
SET TARGET %PROFIT takeProfitS2
ENDIF
ENDIF
// short entry (S3)
IF NOT SHORTONMARKET AND s3 AND c1 THEN // no cumulation for short trades
IF saisonalShortPattern THEN
SELLSHORT positionSize * shortPositionMultiplier CONTRACT AT MARKET
SET STOP %LOSS stoppLossS3
SET TARGET %PROFIT takeProfitS3
ELSE
SELLSHORT positionSize CONTRACT AT MARKET
SET STOP %LOSS stoppLossS3
SET TARGET %PROFIT takeProfitS3
ENDIF
ENDIF
// stop and profit management
posProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsize
m1 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithProfit
m2 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithProfit
m3 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithoutProfit
m4 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithoutProfit
IF LONGONMARKET AND (m1 OR m3) THEN
SELL AT MARKET
ENDIF
IF SHORTONMARKET AND (m2 OR m4) THEN
EXITSHORT AT MARKET
ENDIF
ENDIF
Reiner , das bedeutet 10.000 Kerzen (4h Bar) , dann muss ja eine Ewigkeit warten ehe das System startet ?
das System startet immer ab dem Moment, ab dem du es aktivierst. preloadbars steuert die Anzahl Kerzen die ab dem aktuellen Zeitpunkt historisch!!! geladen werden sollen um deine Algo Parameter zu berechnen – das sind bei dem dem aktuellen Setup mindestens 250 Kerzen. preloadbars hat je nach PRT Instanz einen Standardwert, der liegt für die deutsche Instanz m.E. bei 2000 Kerzen. Pathfinder wird also mit dem Defaultwert funktionieren wenn du preloadbars weglässt. Da es aber immer wieder Probleme mit anderen Länderinstanzen und ProOrder gibt habe ich bewusst einen hohen Wert ghewählt.
hi firstly say thanks to the creator, im just new into prorealtime and I’m really enjoying it, its a great platform.
Im checking your automated system and I realised 2 hour bars is the best for backtest, are you testint it on real account or anyone is doing it, or real time? cuz i cant really imagine that working like this in real, but it’ll be great.
If you check backtest you can se that the first month of the year are the worst of the backtest.
Hi pep17,
Thanks for your comment and welcome. Pathfinder was created original for H4. The shown backtest is of course an optimized view to historic data. The results are promising but Pathfinder must prove that it works in real mode. I’m trading V2 since mid of July and I can confirm that the results are like the backtest. I’m now switched to V3.
reagrds
Reiner
Hello Reiner,
thank you for sharing your strategy, it seems to be awesome, and I would like to test it in real environment. I will do with Mini DAX 1Eur (CFDs), and spread is differente at IG Spain than yours I think, 1 point from 9 to 17:30 and 2 from 8 to 9 and from 17:30 to 22:00. I supose that this is not a problem for the calculations, isn’t it?
And about the automatic trading preferences, is there something to consider? For example, maximun number of orders per day that could be launched? maximun position size? Close for maximun X orders in queue?
Thank you again,
Regards,
Fran
Hi Fran,
Thanks for your comment and welcome. The spreads you mentioned in your post are the same condition like here in Germany. The backtest was calculated with 2 point spread from 8-22. Please consider that Pathfinder works with cumulative and variable order sizes when you start Pathfinder and ProOrder is asking after the max position size set a higher value then 1 also if you have set positionSize to 1 in Pathfinder’s code. When you don’t like this behavior you can omit order cumulation and the seasonal pattern booster when you change the following parameters:
DEFPARAM CUMULATEORDERS = false
ONCE longPositionMultiplier = 1
ONCE shortPositionMultiplier = 1
With these changes Pathfinder is trading only with fixed position size of 1 contract.
Max Orders per day depends on your number of running trading systems. Pathfinder usually trades not very often intraday.
regards
Reiner
The system has just open a long at 10.719 at 13:00h
thank you for your comments Rainer. Is it normal the behavior about this early begining? I have uploaded the strategy at prorealtime at 12:35 h and 25 minutes later it has just beging to open a position.
the system is aktiv immediately after start, Pathfinder in H4 checks every start of 9:00, 13:00, 17:00 and 21:00 candle the trading conditions
Great bit of code this. I can see you have put a lot of thought in to it. Doesn’t seem to work before 2009 for some reason. I used an IN/OUT sample from Jan 2009 until May 2014, optimising the stoploss, takeprofitlong, takeprofit short. I used 0.5 – 5 with 0.25 increments. This still works well going forward to today’s date so seems to stand up 🙂 I’m considering running stopploss 3, takeprofitlong 5, takeprofitshort 3.5. I think the next IN/OUT sample test should be the candle lengths perhaps?
@Nicolas Can’t seem to attach my opp excel spreadsheet?
Hi Cosmic,
Thanks for your comment. Regarding performance before 2009 Doctrading made the remark that on ProRealTime CFD, the DAX had no quote / price before August 2010.
regards
Reiner
Hey Reiner,
there are 4h candles since March 2006. But before August 2010 there are no prices for the time between 22:00 and 08:00. If you need the list of orders for the complete periode, just let me know and I will send you the excel file.
Is it possible to open a trade as soon as I start the system, even though there is no new position? Because I would like to wait for a trade to be negative and then start the system. So if the worst drawdown is e.g. 1.500€, I would wait for a 500€ drawdown and then start the system with a capital of 2.000, to be save.
Thanks
Flo
Flo, thanks for your offer but for me the current backtest results are sufficient. As I understand you right you want to wait for a first virtual looser before you start real trading. I think that is possible to realize but in my opinion not a good approach. With 80% profitable trades you will miss a lot of good possibilities before you start trading. Pathfinders drawdown is around 15-17% and I recommend a trading budget of at least 5.000 Euro.
I have tested Pathfinder with other popular indices. Due every index has it’s own “heartbeat” minor adjustments were necessary. Here are the results for FTSE, EU Stocks 50 and CAC. Please be aware that this is an optimized view to historic data. Please find more details in Pathfinder Inside.
https://www.evernote.com/shard/s80/sh/3c8432cd-63f5-4301-a3cb-9a9dd5c8713b/743defcc06fa10ab3a514b9e34fbf76a
Here is the code for the FTSE:
// Pathfinder FTSE 4H, 9-22, 2 points spread
// FTSE breakout system triggered by previous daily, weekly and monthly high/low crossings
// Version 3
// ProOrder code parameter
DEFPARAM CUMULATEORDERS = true // cumulate orders if not turned off
DEFPARAM PRELOADBARS = 10000
// trading window 9-22
ONCE startTime = 90000
ONCE endTime = 220000
// smoothed average parameter (signalline)
ONCE periodFirstMA = 5
ONCE periodSecondMA = 10
ONCE periodThirdMA = 7
// filter parameter
ONCE periodLongMA = 200
ONCE periodShortMA = 40
// trading paramter
ONCE PositionSize = 1
// money and position management parameter
ONCE stoppLoss = 5 // in %
ONCE takeProfitLong = 3 // in %
ONCE takeProfitShort = 2.25 // in %
ONCE maxCandlesLongWithProfit = 25 // take long profit latest after 25 candles
ONCE maxCandlesShortWithProfit = 13 // take short profit latest after 13 candles
ONCE maxCandlesLongWithoutProfit = 40 // limit long loss latest after 30 candles
ONCE maxCandlesShortWithoutProfit = 25 // limit short loss latest after 25 candles
ONCE startShortPattern = 8 // August
ONCE endShortPattern = 9 // September
ONCE longPositionMultiplier = 2 // multiplier for long position size in case of higher saisonal probability
ONCE shortPositionMultiplier = 2 // multiplier for short position size in case of higher saisonal probability
// calculate daily high/low
dailyHigh = DHigh(1)
dailyLow = DLow(1)
// calculate weekly high/low
If DayOfWeek < DayOfWeek[1] then
weeklyHigh = Highest[BarIndex - lastWeekBarIndex](dailyHigh)
lastWeekBarIndex = BarIndex
ENDIF
// calculate monthly high/low
If Month <> Month[1] then
monthlyHigh = Highest[BarIndex - lastMonthBarIndex](dailyHigh)
monthlyLow = Lowest[BarIndex - lastMonthBarIndex](dailyLow)
lastMonthBarIndex = BarIndex
ENDIF
// calculate signalline with multiple smoothed averages
firstMA = WilderAverage[periodFirstMA](close)
secondMA = TimeSeriesAverage[periodSecondMA](firstMA)
signalline = TimeSeriesAverage[periodThirdMA](secondMA)
// trade only in trading window 9-22
IF Time >= startTime AND Time <= endTime THEN
// filter criteria because not every breakout is profitable
c1 = close > Average[periodLongMA](close)
c2 = close < Average[periodLongMA](close)
c3 = close > Average[periodShortMA](close)
// saisonal pattern
saisonalShortPattern = CurrentMonth >= startShortPattern AND CurrentMonth <= endShortPattern
// long position conditions
l1 = signalline CROSSES OVER monthlyHigh
l2 = signalline CROSSES OVER weeklyHigh
l3 = signalline CROSSES OVER dailyHigh
l4 = signalline CROSSES OVER monthlyLow
// short position conditions
s1 = signalline CROSSES UNDER monthlyHigh
s2 = signalline CROSSES UNDER dailyLow
// long entry
IF ( l1 OR l4 OR l2 OR (l3 AND c2) ) THEN // cumulate orders for long trades
IF not saisonalShortPattern THEN
BUY PositionSize * longPositionMultiplier CONTRACT AT MARKET
ELSE
BUY PositionSize CONTRACT AT MARKET
ENDIF
takeProfit = takeProfitLong
ENDIF
// short entry
// (s2 AND c1) deliver better results
IF NOT SHORTONMARKET AND ( (s1 AND c3) OR (s2 AND c1) ) THEN // no cumulation for short trades
IF saisonalShortPattern THEN
SELLSHORT positionSize * shortPositionMultiplier CONTRACT AT MARKET
ELSE
SELLSHORT positionSize CONTRACT AT MARKET
ENDIF
takeProfit = takeProfitShort
ENDIF
// stop and profit management
posProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsize
m1 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithProfit
m2 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithProfit
m3 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithoutProfit
m4 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithoutProfit
IF LONGONMARKET AND (m1 OR m3) THEN
SELL AT MARKET
ENDIF
IF SHORTONMARKET AND (m2 OR m4) THEN
EXITSHORT AT MARKET
ENDIF
SET STOP %LOSS stoppLoss
SET TARGET %PROFIT takeProfit
ENDIF
Reiner ,
your contribution is formidable. thank you.
Hello Reiner,
Since the strategy had begun, it has passed 18 candlesticks and with a little profit (diference only of +16 points at 13:00h) and I supose that for the code the condition called m1 it should have made that the position close, but it continues open.
What should it be wrong?
Thank you!!!!!!
Fran, today at 13:00 we had 17 candles, so no reason to trade. At 17:00 we had 18 candles but close was under 10720 (loss) and the system will stay now until 30 candles or one of the other conditions are reached
Ciao Reiner
As you have optimized for the DJ ?
for the FTSE 100 has the best ratio with 5 % 3 % 1.75% ratio is 6,13
grazie.
Salve Miguel, Dow backtest also looks very promising. tanti saluti Reiner
Please find more details in Pathfinder Inside.
https://www.evernote.com/shard/s80/sh/3c8432cd-63f5-4301-a3cb-9a9dd5c8713b/743defcc06fa10ab3a514b9e34fbf76a
Here is the code for the DJ:
// Pathfinder DOW 4H, 8-22, 2.8 points spread
// DAX breakout system triggered by previous daily, weekly and monthly high/low crossings
// Version 3
// ProOrder code parameter
DEFPARAM CUMULATEORDERS = true // cumulate orders if not turned off
DEFPARAM PRELOADBARS = 10000
// trading window 8-22
ONCE startTime = 080000
ONCE endTime = 220000
// smoothed average parameter (signalline)
ONCE periodFirstMA = 5
ONCE periodSecondMA = 10
ONCE periodThirdMA = 7
// filter parameter
ONCE periodLongMA = 300
ONCE periodShortMA = 10
// trading paramter
ONCE PositionSize = 1
// money and position management parameter
ONCE stoppLossLong = 5.5 // in %
ONCE stoppLossShort = 2.75 // in %
ONCE takeProfitLong = 2.75 // in %
ONCE takeProfitShort = 1.75 // in %
ONCE maxCandlesLongWithProfit = 17 // take long profit latest after 17 candles
ONCE maxCandlesShortWithProfit = 13 // take short profit latest after 13 candles
ONCE maxCandlesLongWithoutProfit = 40 // limit long loss latest after 40 candles
ONCE maxCandlesShortWithoutProfit = 25 // limit short loss latest after 25 candles
ONCE startShortPattern = 8 // August
ONCE endShortPattern = 9 // September
ONCE longPositionMultiplier = 2 // multiplier for long position size in case of higher saisonal probability
ONCE shortPositionMultiplier = 2 // multiplier for short position size in case of higher saisonal probability
// calculate daily high/low
dailyHigh = DHigh(1)
dailyLow = DLow(1)
// calculate weekly high/low
If DayOfWeek < DayOfWeek[1] then
weeklyHigh = Highest[BarIndex - lastWeekBarIndex](dailyHigh)
lastWeekBarIndex = BarIndex
ENDIF
// calculate monthly high/low
If Month <> Month[1] then
monthlyHigh = Highest[BarIndex - lastMonthBarIndex](dailyHigh)
monthlyLow = Lowest[BarIndex - lastMonthBarIndex](dailyLow)
lastMonthBarIndex = BarIndex
ENDIF
// calculate signalline with multiple smoothed averages
firstMA = WilderAverage[periodFirstMA](close)
secondMA = TimeSeriesAverage[periodSecondMA](firstMA)
signalline = TimeSeriesAverage[periodThirdMA](secondMA)
// trade only in trading window 8-22
IF Time >= startTime AND Time <= endTime THEN
// filter criteria because not every breakout is profitable
c1 = close > Average[periodLongMA](close)
c2 = close < Average[periodLongMA](close)
c3 = close > Average[periodShortMA](close)
// saisonal pattern
saisonalShortPattern = CurrentMonth >= startShortPattern AND CurrentMonth <= endShortPattern
// long position conditions
l1 = signalline CROSSES OVER monthlyHigh
l2 = signalline CROSSES OVER weeklyHigh
l3 = signalline CROSSES OVER dailyHigh
l4 = signalline CROSSES OVER monthlyLow
// short position conditions
s1 = signalline CROSSES UNDER monthlyHigh
s2 = signalline CROSSES UNDER dailyLow
// long entry
IF ( l1 OR l4 OR l2 OR (l3 AND c2) ) THEN // cumulate orders for long trades
IF not saisonalShortPattern THEN
BUY PositionSize * longPositionMultiplier CONTRACT AT MARKET
ELSE
BUY PositionSize CONTRACT AT MARKET
ENDIF
stoppLoss = stoppLossLong
takeProfit = takeProfitLong
ENDIF
// short entry
IF NOT SHORTONMARKET AND ( (s1 AND c3) OR (s2 AND c1) ) THEN // no cumulation for short trades
IF saisonalShortPattern THEN
SELLSHORT positionSize * shortPositionMultiplier CONTRACT AT MARKET
ELSE
SELLSHORT positionSize CONTRACT AT MARKET
ENDIF
stoppLoss = stoppLossShort
takeProfit = takeProfitShort
ENDIF
// stop and profit management
posProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsize
m1 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithProfit
m2 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithProfit
m3 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithoutProfit
m4 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithoutProfit
IF LONGONMARKET AND (m1 OR m3) THEN
SELL AT MARKET
ENDIF
IF SHORTONMARKET AND (m2 OR m4) THEN
EXITSHORT AT MARKET
ENDIF
SET STOP %LOSS stoppLoss
SET TARGET %PROFIT takeProfit
ENDIF
Hello Reiner, If I count candlesticks well next monday at 9:00 the system is going to close my position with a lot of loss -300 points- 30 candlesticks since last monday at 13:00h. If I close the system before 9:00 the position will be open for more time and may be I will decide to do it. If I do that before 9:00, and I launch the system again at the same time before 9:00h, will it be problem for your system?
Thank you
Hi Fran, last DAX trade will be unfortunately a looser. Triggered by cross over of weekly high Pathfinder goes long at 10720 but DAX buyers had not enough power to move it over the resistance around 10750 – 10775 and then the DAX followed a very weak Dow on Friday evening. The position will closed with a loss latest after 30 candles. What happens with the position when you stop the system depends on your trading option settings. By default the position will be closed immediately after stopping the system.
IL sistema ha grandi possibilità visto in backtest . Pertanto se si dispone di buoni capitali si può impostare e “lasciare fare” . A mio avviso è utile essere attenti a bloccare il sistema quando sono in programma eventi straordinari (bce , FED o attentati ecc) che fanno salire volatilità e condizionano molto la direzione del trade. Pertanto stoppare subito potrebbe diminuire o annullare un loss alto. Infatti nel trade ultimo mentre Draghi parlava vista la direzione intrapresa ho stoppata con un loss di soli 22,00 € . Ovviamente questa è una mia idea .
the system has great possibilities seen in backtest. So if you have good capital you can be set up and “let it do.” I think it is useful to be careful to lock the system when they are extraordinary events program (ECB, FED, or attacks etc) which drive up volatility and very affect the direction of trade. Therefore stop immediately may decrease or cancel a high loss. In fact in the last trade as Draghi spoke given the direction taken I stopped out with a loss of only € 22.00. Obviously this is my idea.
On FTSE there are some 0 bars. Wondering if there are any adjustments to be made
Hi Emil,
Thanks for your comment and welcome. Yes ,there are some zero bars but 3% for long and 2.25% for short trades should reduce the backtest fake risk. Due I’m not a FTSE expert feel free to make it better.
regards
Reiner
Dear Reiner,
I’d like to thank you for sharing your system. It look great!
When you have the time can you please check if you can adapt this for the AEX?
Thanks in advance.
Regards,
Patrick
Hi Patrik,
Thanks for your comment and welcome. As requested here is a Pathfinder version optimized for the AEX mini. The result is awesome but have an eye to the drawdown, you realy need some “balls” to trade this. I suggest to reduce the risk and omit the saisonal pattern booster. I’m not an AEX expert and this code is optimized may be curve fitted so please play around and test it in demo accound before you start trade this in real.
Please find backtest details in Pathfinder Inside.
https://www.evernote.com/shard/s80/sh/3c8432cd-63f5-4301-a3cb-9a9dd5c8713b/743defcc06fa10ab3a514b9e34fbf76a
Here is the code for the AEX:
// Pathfinder AEX 4H, 8-22, 0.3 points spread
// AEX breakout system triggered by previous daily, weekly and monthly high/low crossings
// Version 4
// ProOrder code parameter
DEFPARAM CUMULATEORDERS = true // cumulate orders if not turned off
DEFPARAM PRELOADBARS = 10000
// trading window 8-22
ONCE startTime = 80000
ONCE endTime = 220000
// smoothed average parameter (signalline)
ONCE periodFirstMA = 5
ONCE periodSecondMA = 10
ONCE periodThirdMA = 3
// filter parameter
ONCE periodLongMA = 170
ONCE periodShortMA = 10
// trading paramter
ONCE PositionSize = 1
// money and position management parameter
ONCE stoppLossLong = 5 // in %
ONCE stoppLossShort = 3.5 // in %
ONCE takeProfitLong = 3 // in %
ONCE takeProfitShort = 1.25 // in %
ONCE maxCandlesLongWithProfit = 28 // take long profit latest after 18 candles
ONCE maxCandlesShortWithProfit = 13 // take short profit latest after 13 candles
ONCE maxCandlesLongWithoutProfit = 40 // limit long loss latest after 30 candles
ONCE maxCandlesShortWithoutProfit = 25 // limit short loss latest after 25 candles
ONCE startShortPattern = 8 // May
ONCE endShortPattern = 9 // September
ONCE longPositionMultiplier = 2 // multiplier for long position size in case of higher saisonal probability
ONCE shortPositionMultiplier = 2 // multiplier for short position size in case of higher saisonal probability
// calculate daily high/low
dailyHigh = DHigh(1)
dailyLow = DLow(1)
// calculate weekly high/low
If DayOfWeek < DayOfWeek[1] then
weeklyHigh = Highest[BarIndex - lastWeekBarIndex](dailyHigh)
lastWeekBarIndex = BarIndex
ENDIF
// calculate monthly high/low
If Month <> Month[1] then
monthlyHigh = Highest[BarIndex - lastMonthBarIndex](dailyHigh)
monthlyLow = Lowest[BarIndex - lastMonthBarIndex](dailyLow)
lastMonthBarIndex = BarIndex
ENDIF
// calculate signalline with multiple smoothed averages
firstMA = WilderAverage[periodFirstMA](close)
secondMA = TimeSeriesAverage[periodSecondMA](firstMA)
signalline = TimeSeriesAverage[periodThirdMA](secondMA)
// trade only in trading window 8-22
IF Time >= startTime AND Time <= endTime THEN
// filter criteria because not every breakout is profitable
c1 = close > Average[periodLongMA](close)
c2 = close < Average[periodLongMA](close)
c3 = close > Average[periodShortMA](close)
// saisonal pattern
saisonalShortPattern = CurrentMonth >= startShortPattern AND CurrentMonth <= endShortPattern
// long position conditions
l1 = signalline CROSSES OVER monthlyHigh
l2 = signalline CROSSES OVER weeklyHigh
l3 = signalline CROSSES OVER dailyHigh
l4 = signalline CROSSES OVER monthlyLow
// short position conditions
s1 = signalline CROSSES UNDER monthlyHigh
s2 = signalline CROSSES UNDER dailyLow
// long entry
IF ( l1 OR l4 OR l2 OR (l3 AND c2) ) THEN // cumulate orders for long trades
IF not saisonalShortPattern THEN
BUY PositionSize * longPositionMultiplier CONTRACT AT MARKET
ELSE
BUY PositionSize CONTRACT AT MARKET
ENDIF
stoppLoss = stoppLossLong
takeProfit = takeProfitLong
ENDIF
// short entry
IF NOT SHORTONMARKET AND ( (s1 AND c3) OR (s2 AND c1) ) THEN // no cumulation for short trades
IF saisonalShortPattern THEN
SELLSHORT positionSize * shortPositionMultiplier CONTRACT AT MARKET
ELSE
SELLSHORT positionSize CONTRACT AT MARKET
ENDIF
stoppLoss = stoppLossShort
takeProfit = takeProfitShort
ENDIF
// stop and profit management
posProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsize
m1 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithProfit
m2 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithProfit
m3 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithoutProfit
m4 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithoutProfit
IF LONGONMARKET AND (m1 OR m3) THEN
SELL AT MARKET
ENDIF
IF SHORTONMARKET AND (m2 OR m4) THEN
EXITSHORT AT MARKET
ENDIF
SET STOP %LOSS stoppLoss
SET TARGET %PROFIT takeProfit
ENDIF
Dear Reiner,
Thank you very much for the adjusted code. I will look into your suggestions regarding the
drawdown and the booster.
Thanks again.
kind regards,
Patrick
Hallo Reiner,
ersteinmal danke für das Teilen des Codes.
Ich habe ein Problem: ich habe die itf-File importiert und ebenfalls im DAX30 (1EUR mini von IG) den gleichen Zeitraum getestet. Ich erhalte ein Ergebnis von ca. 265% Gewinn (26.557,4€ Gewinn bei 10.000€ Einsatz) statt deinen über 1.000%. Ist Dir das Problem bekannt? Was muss ich ändern?
Gruß, Wisko
Hallo Wisko,
Danke für deinen Kommentar und Willkommen. Du hast alles richtig gemacht. Der abgebildete Backtest basiert noch auf der ersten Version von Pathfinder. Damals war die eingestellte Positionsgrösse noch 10. In der aktuellen V3 ist dieser Wert 1. Wenn du einen Backtest mit 10 CFDs machst, erhälst du ein vergleichbares aber deutlich besseres Ergebnis. Pathfinder liefert im Backtest erstaunliche Ergebnisse, ist aber letztlich nur ein optimierter Blick auf historische Daten und keine Garantie auf vergleichbare Ergebnisse in der Zukunft. Passe die Parameter auf deine Risikobereitschaft an bevor du mit echtem Geld handelst. Für die aktuellen Einstellungen sollte ein Kapital von mindest 5.000 Euro vorhanden sein.
Gruss Reiner
salve sono italiano e parlo poco inglese potete dirmi qual è la versione definitiva del codice e se posso usarla con un conto da 2000euro sul (dax mini contract 1euro)???
sono giovane e faccio trading da un anno e vorrei sperimentare qualche trading system grazie a chiunque voglia aiutarmi 😉
Alles klar, dachte mir schon sowas in der Art. MM und RM ist klar. Bin neu hier und gerade erst dabei, mich ein wenig umzusehen und mich mit ProOrder vertraut zu machen.
Wie sind deine Erfahrungen im echten Trading? Kann der Pathfinder die 80% TQ halten?
Hi entony,
Thanks for your comment and welcome. Pathfinders drawdown with a 10.000 Euro account is in best case 15-20%. This mean that an account with 2000 Euro is to small to trade Pathfinder as it is in real mode.
regards
Reiner
you have something that you would recommend for a small account like mine ??
thank you
Bisogna aprire prima un conto (IG) poi con PRT inserire il codice in prOrder .
poi …. Buona fortuna.
#miguel grazie per il consiglio ma volevo chedere se esistesse qualche codice che andasse bene per un conto piccolo come il mio…
Hi wisko,
Ich habe Pathfinder seit der ersten Idee hier veröffentlicht und handle auch genau das System – erst V2, jetzt V3 und bald V4. Die Entwicklung ist aber noch nicht abgeschlossen. Seit mitte Juli entsprechen die Trades den Backtest Ergebnissen, die Treffererquote liegt bei circa 70%, allerdings ist das System bisher ein paar Euro im Verlust. Bei dem gewählten 4H Zeitrahmen wird es auch einige Monate dauern, bis man beurteilen kann, ob es in Realität funktioniert.
Gruss Reiner
Entony
come dice reiner ci vogliono mesi per valutare se in reale si hanno gli stessi risultati del backtest .
Forse sarebbe meglio attendere i risultati oppure puoi provare tu stesso in backtest.
Se hai soldi da rischiare puoi andare in reale . Reiner ha postato già la v.3 sul DAX , FTSE e Wallstreet.
comincia sul Dax (a mio avviso) mini 1euro . Basta fare copia incolla.
Reiner, did I ask you before before about IN/OUT sample? Did you check anything this way?
Cosmic, I’m currently working on better risk and saisonal pattern management. Also the adaptation to other instruments is a topic. I will release a new version of Pathfinder soon . Of course I’m interested in your ideas,let’s discuss later.
Hi Reiner, thanks for all your time and effort on replying comments 🙂
If you plan to involved more ideas of improvements or work on other instruments evolvement of the current code, maybe a forum topic would be a better place to discuss about this. I prefer to let people discuss here as a guidance on a “how-to” for the actual code, not to throw other ideas or codes snippets, more than 130 comments begin to look like a big mess 🙂
Ciao reiner
it would be useful to include a volatility parameter to pre-trial the system for unexpected events or expected type FED ECB disasters terrorism etc. For example yesterday when the Fed increased interest rates, the system would have recorded a loss
Miguel, Thanks for your idea. I will think about it. May be somthing for V5 because the next release V4 is almost ready.
Hi Reiner. I think My comment to the ver.3 got lost along the rest 🙂 So I’m gonna put it here in the end so I will be noticed
First of all ..good job!! it a very nice code you have developed and I really like that you works very hard and persistent to optimize and tweak your own code. I will follow your blog with interest.
The reason why I’m asking, is that I did a monte carlo simulation on the output from the Ver.3 DAX and I showed that a small amount of initial capital as 1000$ only has a 3% chance of ruin, and 1500$ has 0% of ruin the first year. Very positive result, however I see very early the code put up 10 positionsize @ 22 nov. 2012 and risk around 20% of your account? Of cause I see later that you recommend at least 10000$ as an initial capital, and then it not 20% but more around 2% risk.
I used this small code
Capital=1000
equity = Capital + StrategyProfit
graph ((tradeprice*stopploss)/100)*positionsize*pointvalue*pipsize/(equity+capital)*100 COLOURED(0,0,0) AS \"MAXRISK\"//Aqua
Hi Elsborgtrading, Thanks for your contribution. Risk management is something that I have to improve in the next versions. I will check your idea.
Sounds good Reiner, shall we post here then or forums?
I have created a forum topic for discussions related to Pathfinder
http://www.prorealcode.com/topic/pathfinder-trading-system/
Guten Abend Reiner
Auch von mir an dieser Stelle ein grosses Dankeschön für die Bereitstellung der verschieden Pathfinder-Codes. Der DAX, DOW und FTSE sind bei mir die letzten 2 Tage sehr positiv gelaufen, vielen Dank. Ich würde mir ein automatisiertes Trailingsystem wie es Nicolas in den Blog gestellt hat wünschen. Gerade bei einer Welle 3 wie sie im Moment läuft, kann man somit versuchen das maximum damit rauszuholen.
Hallo MichiM,
Danke für deine Anmerkung und Willkommen. Es freut mich, dass du mit einem Gewinn gestartet bist. Ich hatte diverse Trailing Tests gemacht, aber die Ergebnisse waren über einen längeren Zeitraum immer schlechter als die aktuellen Einstellungen. Ich schaue mir das aber nochmal an, weil ich in die nächste Version eine bessere Absicherung der Gewinne einbauen möchte.
VG, Reiner
MichiM, ich habe nochmal trailing stop in Pathfinder gtestet. Die Tests liefern keine deutlich besseren Ergebnisse. Hier findest du den Code:
http://www.prorealcode.com/topic/pathfinder-trading-system/page/4/#post-14262
Hallo Reiner
Hab die Strategie (V.2., V.3. und auch die Version 4) nun auf dem Demo-Konto seit dem 23.09 laufen. Habe die Positionsgröße auf 1 Kontrakt reduziert und auf dem Demo-Konto sind ca. 30K vorhanden. Es wurde bis jetzt aber noch kein einzige Trade ausgeführt.
Weisst du wo der Fehler liegt?
Vielen Dank.
Hallo Skubidu,
Danke für deinen Kommentar und Willkommen. V4 hat den letzten long Trade am 22.09 erföffnet und am 29.09. geschlossen. Wenn du erst am 23.9 gestartet hast, ist das m.E. richtig, dass Pathfinder bisher keine neue Postion eröffnet hat. Ansonsten solltest du die max. Anzahl Kontrakte in ProOrder auf z.B. 10 setzen, da das System pyramidisiert, wenn du es nicht ausgeschaltet hast.
Gruß
Reiner
Vielen Dank für die schnelle Antwort. Habe es auf einen Kontrakt reduziert weil ich danach auch im Live-Trading nur 1 Kontrakt handeln werde.
Gruss Skubi 🙂
Könntest du etwas genauer auf die Signallinie eingehen? Wie kommt dieses komplexe Konstrukt zustande? Ich würde den Pathfinder gerne in einem anderen Programm laufen lassen, bekomme aber die Signallinie nicht programmiert.
Wisko, die Signallinie ist eine der Key-Komponenten von Pathfinder. Ein mehrfach geglätteter, gleitender Durchschnitt, welcher fast ohne Time-Lag sehr gut den Kursverlauf abbildet und gleichzeit das Rauschen eliminiert wird als Trendindikator verwendet. Das gewählte Konstrukt verhält sich sehr robost in Seitwärtsphasen. In PRT ist das sehr einfach umzusetzen mit Hilfe der zwei GDS Wilder und TimeSeries.
firstMA = WilderAverage[periodFirstMA](close)
secondMA = TimeSeriesAverage[periodSecondMA](firstMA)
signalline = TimeSeriesAverage[periodThirdMA](secondMA)
Wenn du dies in einem anderen System nicht abilden kannst, versuche alternativ andere adaptive Durchschnitte wie z.B. Dema, Hull, Tema, Kaufmann, Mesa, T3, Jurik usw. Ich hatte in PRT alle möglichen getestet, keine lieferte allerdings so gute Ergebnisse wie der von mir gewählte Ansatz. Generell sollten aber andere adaptive Durschnitte zumindest ähnliche Ergebnisse liefern.
Wisko asked for an alternative calculation of the signalline because he wants migrate Pathfinder to another platform. I have tested several moving averages and the original used formula is still the best. I tested some alternative adaptive averages from the library (e.g. MAMA, FAMA, KAMA, TEMA, DEMA, etc) and one of the best result delivers the Hull Average. Here is the used formular:
Period = 15
inner = 2 * WeightedAverage[round(Period/2)](close) - WeightedAverage[Period](close)
HullAverage = WeightedAverage[round(sqrt(Period))](inner)
signalline = HullAverage
Have you tried ALMA?
ALMA was the second best and also delivers good results but Hull is more “sustainable”
Vielen Dank für deine Hilfe, Reiner. Ich werde mir das mal ansehen
HELLO REINER,
I’M WRITING A SRATEGY ON 15 M CHART WHICH CAN WORK WITH YOUR PATHFINDER STRATEGYCOUD YOU SET STRATEGY TO WORK WITH 15 M TIME FRAME, TO HAVE THE SAME POSITION OF THE 4 H TIME FRAME , IN THE LAST 2 YEARS?
ON THE EXCEL FILES I’VE SEEN THAT THE TWO STRATEGY, IF THEY WORK TOGETHER LOWER DRAWDOWN AND INCREASE PROFIT.
THE ACTUALLY RESULT OF THE TWO STRATEGY IN THE LAST 25 MONTH ARE THE FOLLOWING :DEPOSIT 5500€DRAWDOWN 1250€
RATIO 1.85
GAIN 27.823 ,00€
IT WOUD BE A GOOD STRATEGY NOT RELATED
PS: I’M PREPARING FILES TO SHARE MY STRATEGY IN THE NEXT DAYS
THANKS
ALE
ALE, I haven’t use 15M with Pathfinder so far. Let us take part on your work and share the results.
Hello reiner
yes I’m working on it
tks
Guten Morgen Reiner
Ich sehe gerade, dass der Dax in der Pathfinder Version 3 und 2 gestern Abend um 17.00 Uhr long gegangen ist (Dow übrigens auch). Bei mir laufen alle deine Versionen und keine auch nicht der Dow ist bei mir long gegangen.
Hat das mit der Positionsgrösse zu tun? Es sollte doch 1 CFD Kontrakt reichen oder nicht?
Lieben Dank für deine Antwort.
MichiM, ich handle aktuell life nur V4 und kann deine Aussage bestätigen, dass das System gestern um 17:00 Uhr bei 10501 long gegangen ist. Ich habe das System mit max 15 Kontrakte gestartet, da per default durch Pyramidisierung und saisonale Verstärker mehr als 1 Kontrakt gehandelt werden können. Ich empfehle, auch wenn du das System so eingestellt hast, dass du nur 1 Kontrakt handeln möchtest, die max Kontrakte auf einen grösseren Wert zu setzen.
Hey Reiner,
im Backtest sieht es so aus, als ob Trades nur zum Open einer neuen 4h-Kerze eröffnet werden. Wie läuft das im Live-Trading? Wird der Trade eröffnet, sobald der CrossOver/Under der Signallinie passiert? Was passiert, wenn der Kurs um ein High/Low Level schwankt und es innerhalb kurzer Zeit mehrere CrossOvers/Unders gibt?
Ich hab auch noch eine Frage zur Tradingzeit: Trades werden nur zwischen 8 und 22 Uhr gestartet, ich gehe also davon aus, dass auch nur dann die CrossOvers/Unders zählen und nachts stattfindende Crosses ignoriert werden, oder? Wie sieht es mit den Ausstiegen aus? Wenn nachts ein SL/TP erreicht wird, oder die jeweilige Anzahl der Kerzen erreicht wird, wird dann direkt verkauft oder erst am nächsten Morgen um 8?
Danke schonmal für die Hilfe
Hi Wisko,
Der Trade Entry erfolgt im DAX nur zur Eröffnung der Kerzen um 9, 13, 17 und 21 Uhr und wenn genau! zu diesem Zeitpunkt ein Crossover/-under vorliegt. Crossings ausserhalb des Trading Windows führen nicht zu einem Trade. SL/TP ist im Life Trading bisher nur im Trading Window eingetreten, ich vermute aber, dass dies generell auch ausserhalb des Fensters passieren könnte, diese Fälle sind aber sehr selten und du kannst diese dann morgens um 8/9 schliessen. Tritt die Erreichnug der maximalen Haltedauer ausserhalb des Tradingfensters ein, wird morgens um 9:00 die Position glattgestellt.
Auf welche Plattform willst du Pathfinder migrieren?
Gruß Reiner
OK, falls es also vorkommen sollte, dass zB der Cross der Signallinie über das Daily High während einer langen bullischen Kerze erfolgt und bei Beginn der neuen Kerze demnach kein neuer CrossOver vorliegt, findet kein Trade statt? Die Signallinie müsste sich doch (wie andere MAs auch) während die Kerze wächst auch bewegen, oder? Hast du das mal beobachten können?
Ich würde den Pathfinder gerne auf die MT4-Plattform übertragen, da dort Microlots (0,1 €/Punkt) angeboten werden und dadurch ein deutlich präziseres Risikomanagement möglich ist.
die Prüfung der Bedingungen erfolgt ausschließlich beim Open der Kerze z.B. 9:00:00, in deinem skizzierten Szenario wird nicht gehandelt
Alles klar, danke
this strategy is formidable, the jpeg above is of the first version?
Yes, description and picture is still from V1. We shoult make an update. Current version is available in the forum.
hi, can i have the latest version of the strategy ? I wont to try it in FTSE 100 cash on IG market. What is the time frame that you suggest me to use ? 4H? And the time zone ? 8 -22 the same of DAX? What are the variable that I must to optimize ? Thanks Emanuele
Welcome Emanuele,
You will find the latest version of Pathfinder FTSE H4 V5B2 here in the forum http://www.prorealcode.com/topic/pathfinder-trading-system/page/7/#post-15130
Pathfinder was developed for H4 only, trading window for FTSE is 9-22 CET, variables are up to date, please adjust position size to your account size.
best, Reiner
Dear Reiner,
Thank you for posting an interesting system, indeed. I’m looking at it and trying to analyse potential weaknesses. I was a bit sceptical to the numbers you are using for the triple smoothing. I suspected that you had merely curve-fitted, but so far I have run the optimisation myself, and it appears that neighbouring numbers work almost equally well, although your chosen numbers are “optimal”. But this result would indicate that the notion of triple smoothing is not necessarily curve fitted. What bothers me, though, is that PRT backtest, for all its’ benefits, has a couple of serious drawbacks that can give you very different results if/when you go live. One of them is that it appears (at least to me) that PRT backtest is unable to handle backtesting a system that can trigger both a long and short position. I can’t see that the code will in itself not trigger both a long and then a short on a different signal cross-over, or vice-versa. So my question is; Have you tried to disintegrate the system into its different “parts” ie treat each signal separatetely in a system for each signal, to see if you get the same results when you add them up?
Kind regards,
Wilko
Dear Reiner, dear fellow forum members,
After writing the previous post, I have myself decomposed the system into several independent systems and backtested them separately without the seasonailty boosting. What I found was that each of the parts/strategies independently generated not many trades over the full available database. In other words, allthough the outcome for each part/strategy may be positive, it is based on few observations, meaning the statistical expectation that historical results would repeat is weak. If you merely add a lot of weak parts/strategies together, this does not in itself guarntee the end-result is a strong (or rubust) system. Therefore, I would issue a warning: The parts/strategies incorporated in this system need to be tested independently on a much bigger dataset in order to be able to say with any statistical significance that the integrated system is likely to repeat past performance. In my book, one needs at least 100 observations for each of the different parts/strategies. To avoid misunderstanding, with parts I mean one part/strategy buys break of monthly high, the next part/strategy buys on break of weekly high, and so on. Pathfinder is comprised of 7 different parts/strategies. On top of that filters and seasonality boosts are applied, not uniformly, increasing the risk of curve-fitting. IMHO.
There are some nice ideas in the code that have been well applied, and for these ideas I thank Reiner! I’m not saying the integrated system won’t work, I’m saying the certainty that it will work live is not high enough for me. I hope my findings can be of some help to fellow forum members. Please be careful out there! (Quote h/t the tv-series Hill Street Blues from the 80’s)
Hi Wilko,
Thanks for your feedback and welcome. I will move your comment to the realated forum for further discussion. I think many people are really interested to underand a little bit more your arguments.
best, Reiner
Hey Wilko,
that is an interesting point. could you upload the results of the “single” test that you made? if I understood you correct, you see this strategy as several strategies that are combined and you tested them separatly?
Thank you
Flo
Sure. I’d be happy to answer any questions. /Wilko
please answer here http://www.prorealcode.com/topic/pathfinder-trading-system/page/10/#post-15550
thank you for this system, I try to run on down/nd very good, but when I try on sp500 it not take any trade? try crude oil not good luck ,
looking forward to hear from you
Hi GAMMA,
I didn’t offer a Pathfinder version for sp500 because backtests were very poor.
best, Reiner
i can understand that sp 500 other animal , do you have for crude oil or brunt oil ?
thank you in advance.
Is this strategy converted to Ninja trader 7/8 by someone? If so, can I find the link?
Sorry, this website is dedicated to prorealtime programming, I don’t any Ninjatrader stuff around here! do you??
Greeting Reiner, Simon here from London…
Just joined this site, even though I have no clue to programming, what a great site… I was intrigued by your code…
I like using DFB spreadbetting here in London for tax reasons so I backtested pathfinder v3 for DAX30 and found fantastic results, I compared it to v4 and the results wasnt nearly as good, so here are my questions:
I am running v3 on a demo account and it opened a position at £2 per point, how do you change these figures?
The open position has put a stop nearly 500 points away? I do not understand this as it is using the margin?
Same for the limit, nearly 500 points away
When I activated the autotrading, proorder asked for my position size, I inputed 10 per point, but the bet is still 2 per point?
Only opened it yesterday and the first order is, so far, doing well!!!!!
Thanks in advance
Simon
Hi Simon,
Thanks for your comment and welcome. You’ll find the last news and releases for Pathfinder here in the forum http://www.prorealcode.com/topic/pathfinder-trading-system/
In the meantime we have version 6 running. All settings are controlled by the code and have nothing to do with the margin. Pathfinder is pyramiding the position and the position size is related to a saisonal multiplier. The requested position size in ProOrder is a maximal value in a sense of an overall limit for the whole strategy. By default Pathfinder is trading maximal 15 contracts. I recommend that you go through the forum entries and create a post if something isn’t clear. There are also some UK guys subscribed with the same IG accout features to answer your questions.
best, Reiner
Thank you Reiner for responding, I can only find v4, am I looking at something wrong?
Pathfinder not to be used for DFB?
Simon, what is DFB? Please ask further question in the related forum topic.
Did anyone test this out with a live account?
Good morning,
I would use the strategy on my IG account on FTSE 100 futures, rometime (9/22). Someone have already optimized this strategy on this instrument? Please could you give me a link of the ultimate version of the strategy. If no one has optimized the strategy on this market please could you tell me which parameters I have to optimized and the best time frame? Thanks emanuele
Emanuele, vai nel forum e troverai di tutto e di più 😉
Hi Emanuele and welcome,
You’ll find the latest versions at the first post in the related forum https://www.prorealcode.com/topic/pathfinder-trading-system/#post-13565
Best, Reiner
Tanks, if I want to enter in a market only with 1 lot do you confirm that I cam modify only this parameters? Also the seasonal logic is bypassed with these parameters?
DEFPARAM CUMULATEORDERS = falseONCE longPositionMultiplier = 1ONCE shortPositionMultiplier = 1
Emanuele, please ask in forum in the future. Set position size and maximum position as well. Please be aware that Pathfinder’s performance based on grid orders and without you have another system with much higher drawdown. I’ve posted a Pathfinder DAX version for small accounts (4k).
Ok, thanks
Bonjour,
Je ne comprends pas bien ce qu’apporte la V3 par rapport à la V2, car le ratio nb Gain/ nb Perte est légèrement inférieur.
Merci.
Un topic de l’auteur du système est disponible ici: https://www.prorealcode.com/topic/pathfinder-trading-system/
De nombreuses autres versions et améliorations sont disponibles à cet endroit.
Bonjour,
Est ce normal qu’un ordre ne passe pas en backtest, mais passe en réel ?
Ca m’a crée une perte très douloureuse.
Merci de votre partage.
Hello reiner,
How do you explain that pathfinder have good results on DAX but not on the CAC ?
You should join and read the forum thread about this strategy. There are plenty of different parameters to adapt from an instrument to another. Since I’m not the author of this code, Reiner could probably answer with more details though.
Hi djtaktik and welcome,
I have answered your question in the related Pathfinder forum because I want show you a picture.
https://www.prorealcode.com/topic/pathfinder-trading-system/page/55/#post-24973
Best, Reiner
is this version the definitive one or from the original one have there been modifications to the code ? Also I see that members have used it on different time fames any time frame that was favourite or is 4H still the best for dax?