Reiner

Pathfinder DAX 4H

Category: Strategies By: Reiner Created: July 4, 2016, 8:19 AM
July 4, 2016, 8:19 AM
Strategies
192 Comments
Pathfinder DAX 4H

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

// 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

Download
Filename: DAX-PATHFINDER-v3.itf
Downloads: 1252
Reiner
Reiner Veteran
Operating in the shadows, I hack problems one by one. My bio is currently encrypted by a complex algorithm. Decryption underway...
Author’s Profile

Comments

danver34
10 years ago
#

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?

djtaktik
10 years ago
#

Hello reiner,

How do you explain that pathfinder have good results on DAX but not on the CAC ?

 

Reiner
10 years ago
#

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

Nicolas
10 years ago
#

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.

Master_Code
10 years ago
#

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.

 

Master_Code
10 years ago
#

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.

 

Nicolas
10 years ago
#

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.

volpiemanuele
10 years ago
#

Ok, thanks

volpiemanuele
10 years ago
#

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 = false
ONCE longPositionMultiplier = 1
ONCE shortPositionMultiplier = 1

Reiner
10 years ago
#

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).

volpiemanuele
10 years ago
#

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

Reiner
10 years ago
#

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

Bandido
10 years ago
#

Emanuele, vai nel forum e troverai di tutto e di più ;-)

demoz
10 years ago
#

Did anyone test this out with a live account?

Mr Mackey
10 years ago
#

Thank you Reiner for responding, I can only find v4, am I looking at something wrong?

Pathfinder not to be used for DFB?

Reiner
10 years ago
#

Simon, what is DFB? Please ask further question in the related forum topic.

Mr Mackey
10 years ago
#

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

 

Reiner
10 years ago
#

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

naqviak
10 years ago
#

Is this strategy converted to Ninja trader 7/8 by someone? If so, can I find the link?

Nicolas
10 years ago
#

Sorry, this website is dedicated to prorealtime programming, I don't any Ninjatrader stuff around here! do you??

GAMMA
10 years ago
#

i can understand that sp 500 other animal  , do you have for crude oil or brunt oil ?

thank you in advance.

GAMMA
10 years ago
#

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

 

Reiner
10 years ago
#

Hi GAMMA,

I didn't offer a Pathfinder version for sp500 because backtests were very poor.

best, Reiner

Wilko
10 years ago
#

 Sure. I'd be happy to answer any questions. /Wilko

Reiner
10 years ago
#

please answer here http://www.prorealcode.com/topic/pathfinder-trading-system/page/10/#post-15550

Wilko
10 years ago
#

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)

flowsen123
10 years ago
#

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

Reiner
10 years ago
#

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

Wilko
10 years ago
#

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

ProRealCode ProRealCode
Loading...