Hi,
May be it is a stupid question but let me ask anyway. I have tested your code for DAX-1 euro contract and even for DAX-5 euro and DAX-25 euoro. Number of trades, winratio and performance (shape of equity curve) differs really. How it can be so for the same period? My first feeling was it had been a curve fitting just for DAX-1 euro but I might be wrong.
Regards,
/Hakan
Hi Reiner,
I have tested DOW daily V2 and it seems good but I would like to ask a question about performance criterias. Personally I do allways comparare the system with “buy&hold” outcome. In this case buy&hold should give allmost +1900% in DOW daily where the system generates +455% since 1977 (this comparison can be done for each and every year as well to see performance distribution instead of overall comparison but I did not study in deep for moment). According to the overall comparison system is not so good, am I right or what am I missing?
Regards,
/Hakan
@Hakan,
Considering the gains, in absolute, since 1979, is not very signifiactive, especially for the ancient years: you can see that in 1979 the Dow level was under 2000, instead of near 20 000 today: the variations were not the same as today, a variation of 1% has 10x more impact today; but the system is the same in the backtest, and that is why the equity curve has this hyperbolic form, but in fact the profit factor may be quite similar.
Hi Hakan76,
If I understand you right you expect the same backtest results when you are trading with the same account size (10k in your examples) a DAX 1 Euro-, 5 Euro- or 25 Euro contract.
I think your expectation is wrong. You have to synchronize at least account size and all position sizes with the contract value. I’m also not sure if all contract sizes have the same quotes.
Pathfinder DAX 4H is of course optimized for a 1 DAX mini contract but curve fitted – I hope not.
Best, Reiner
Hej Hakan,
I think Aloysius gave a good answer to your question. I mainly developed the Pathfinder daily versions for the purpose to find out the best saisonal adjustments. I think it’s more realistic to tweak the backtest for a slightly shorter history for instance the last 15-20 years. Maybe I can encourage you to improve the backtests.
Best, Reiner
Hi Reiner,
Read in the prevoius posts that Pathfinder also works on Bund Market, but i can’t find the corresponding code;
May I ask you to post the code ?
Thank you very much for the attention.
Best whishes for a wonderful 2017, Andrea
Hello,
let's suppose that I wanto to start autotrading and the TS is already in position.
Is there a way to syncronize "by hand" the portfolio?
Regards, Massimo
AlcoParticipant
Senior
Hi Guys,
I have heng seng running on demo. It opened a position (2) on dec 28. Today it opened another position (2). Already up for around 140 pips. Heng Seng profits are amazing but it has still a high drawdown. It would be great if we could optimize the settings to get a lower drawdown. Probably a great index to add in your portfolio.
My maximum drawdown with heng seng is around €4000. I’m not able to get a lower drawdown. Maybe its a good idea if we make a V6 version for Hang Seng.
// Pathfinder Trading System based on ProRealTime 10.2
// Breakout system triggered by previous daily, weekly and monthly high/low crossings with smart position management
// Version 5 Beta 3
// Instrument: Hang Seng mini 4H, 2:15-16:00 CET, 10 points spread, account size 100.000 HKD
// ProOrder code parameter
DEFPARAM CUMULATEORDERS = true // cumulate orders if not turned off
DEFPARAM PRELOADBARS = 10000
// define intraday trading window
ONCE startTime = 22500
ONCE endTime = 170000
// define instrument signalline with help of multiple smoothed averages
ONCE periodFirstMA = 5
ONCE periodSecondMA = 10
ONCE periodThirdMA = 8
// define filter parameter
ONCE periodLongMA = 380
ONCE periodShortMA = 25
// define position and money management parameter
ONCE positionSize = 1
Capital = 10000
Risk = 5 // in %
equity = Capital + StrategyProfit
maxRisk = round(equity * Risk / 100)
ONCE stopLossLong = 3.25 // in %
ONCE stopLossShort = 2 // in %
ONCE takeProfitLong = 2.25 // in %
ONCE takeProfitShort = 2.25 // in %
maxPositionSizeLong = MAX(6, abs(round(maxRisk / (close * stopLossLong / 100) / PointValue) * pipsize))
maxPositionSizeShort = MAX(6, abs(round(maxRisk / (close * stopLossShort / 100) / PointValue) * pipsize))
ONCE trailingStartLong = 1.75 // in %
ONCE trailingStartShort = 1 // in %
ONCE trailingStepLong = 0.2 // in %
ONCE trailingStepShort = 0.2 // in %
ONCE maxCandlesLongWithProfit = 20 // take long profit latest after 20 candles
ONCE maxCandlesShortWithProfit = 13 // take short profit latest after 13 candles
ONCE maxCandlesLongWithoutProfit = 25 // limit long loss latest after 25 candles
ONCE maxCandlesShortWithoutProfit = 6 // limit short loss latest after 6 candles
// define saisonal position multiplier >0 - long / <0 - short / 0 no trade
ONCE January = 1
ONCE February = 1
ONCE March = 1
ONCE April = 3
ONCE May = 1
ONCE June = 1
ONCE July = 3
ONCE August = -1
ONCE September = -2
ONCE October = 1
ONCE November = 3
ONCE December = 2
// calculate daily high/low (include sunday values if available)
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 instrument signalline with multiple smoothed averages
firstMA = WilderAverage[periodFirstMA](close)
secondMA = TimeSeriesAverage[periodSecondMA](firstMA)
signalline = TimeSeriesAverage[periodThirdMA](secondMA)
// save position before trading window is open
If Time < startTime then
startPositionLong = COUNTOFLONGSHARES
startPositionShort = COUNTOFSHORTSHARES
EndIF
// trade only in defined trading window
IF Time >= startTime AND Time <= endTime THEN
// set saisonal pattern
IF CurrentMonth = 1 THEN
saisonalPatternMultiplier = January
ELSIF CurrentMonth = 2 THEN
saisonalPatternMultiplier = February
ELSIF CurrentMonth = 3 THEN
saisonalPatternMultiplier = March
ELSIF CurrentMonth = 4 THEN
saisonalPatternMultiplier = April
ELSIF CurrentMonth = 5 THEN
saisonalPatternMultiplier = May
ELSIF CurrentMonth = 6 THEN
saisonalPatternMultiplier = June
ELSIF CurrentMonth = 7 THEN
saisonalPatternMultiplier = July
ELSIF CurrentMonth = 8 THEN
saisonalPatternMultiplier = August
ELSIF CurrentMonth = 9 THEN
saisonalPatternMultiplier = September
ELSIF CurrentMonth = 10 THEN
saisonalPatternMultiplier = October
ELSIF CurrentMonth = 11 THEN
saisonalPatternMultiplier = November
ELSIF CurrentMonth = 12 THEN
saisonalPatternMultiplier = December
ENDIF
// define trading filters
// 1. use fast and slow averages as filter because not every breakout is profitable
f1 = close > Average[periodLongMA](close)
f2 = close < Average[periodLongMA](close)
f3 = close > Average[periodShortMA](close)
f4 = signalline < Average[periodshortMA](close)
// 2. check if position already reduced in trading window as additonal filter criteria
alreadyReducedLongPosition = COUNTOFLONGSHARES < startPositionLong
alreadyReducedShortPosition = COUNTOFSHORTSHARES < startPositionShort
// 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
s4 = signalline CROSSES UNDER dailyHigh
s5 = signalline CROSSES UNDER dailyLow
// long entry with order cumulation
IF ( (l1 OR l4 OR l2 OR (l3 AND f2) ) AND NOT alreadyReducedLongPosition) THEN
// check saisonal booster setup and max position size
IF saisonalPatternMultiplier > 0 THEN
IF (COUNTOFPOSITION + (positionSize * saisonalPatternMultiplier)) <= maxPositionSizeLong THEN
BUY positionSize * saisonalPatternMultiplier CONTRACT AT MARKET
ENDIF
ELSIF saisonalPatternMultiplier <> 0 THEN
IF (COUNTOFPOSITION + positionSize) <= maxPositionSizeLong THEN
BUY positionSize CONTRACT AT MARKET
ENDIF
ENDIF
stopLoss = stopLossLong
takeProfit = takeProfitLong
ENDIF
// short entry with order cumulation
IF ((s1 AND f3) OR (s5 AND f1) OR (f4 AND (s4 AND f2)) ) AND NOT alreadyReducedShortPosition THEN
// check saisonal booster setup and max position size
IF saisonalPatternMultiplier < 0 THEN
IF (COUNTOFPOSITION + (positionSize * ABS(saisonalPatternMultiplier))) <= maxPositionSizeShort THEN
SELLSHORT positionSize * ABS(saisonalPatternMultiplier) CONTRACT AT MARKET
ENDIF
ELSIF saisonalPatternMultiplier <> 0 THEN
IF (COUNTOFPOSITION + positionSize) <= maxPositionSizeLong THEN
SELLSHORT positionSize CONTRACT AT MARKET
ENDIF
ENDIF
stopLoss = stopLossShort
takeProfit = takeProfitShort
ENDIF
// stop and profit management
IF LONGONMARKET THEN
posProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsize
ELSIF SHORTONMARKET THEN
posProfit = (((positionprice - close) * pointvalue) * countofposition) / pipsize
ENDIF
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
// take profit after max candles
IF LONGONMARKET AND (m1 OR m3) THEN
SELL AT MARKET
ENDIF
IF SHORTONMARKET AND (m2 OR m4) THEN
EXITSHORT AT MARKET
ENDIF
// trailing stop function
trailingStartLongInPoints = tradeprice(1) * trailingStartLong / 100
trailingStartShortInPoints = tradeprice(1) * trailingStartShort / 100
trailingStepLongInPoints = tradeprice(1) * trailingStepLong / 100
trailingStepShortInPoints = tradeprice(1) * trailingStepShort / 100
// reset the stoploss value
IF NOT ONMARKET THEN
newSL = 0
ENDIF
// manage long positions
IF LONGONMARKET THEN
// first move (breakeven)
IF newSL = 0 AND close - tradeprice(1) >= trailingStartLongInPoints * pipsize THEN
newSL = tradeprice(1) + trailingStepLongInPoints * pipsize
ENDIF
// next moves
IF newSL > 0 AND close - newSL >= trailingStepLongInPoints * pipsize THEN
newSL = newSL + trailingStepLongInPoints * pipsize
ENDIF
ENDIF
// manage short positions
IF SHORTONMARKET THEN
// first move (breakeven)
IF newSL = 0 AND tradeprice(1) - close >= trailingStartShortInPoints * pipsize THEN
newSL = tradeprice(1) - trailingStepShortInPoints * pipsize
ENDIF
// next moves
IF newSL > 0 AND newSL - close >= trailingStepShortInPoints * pipsize THEN
newSL = newSL - trailingStepShortInPoints * pipsize
ENDIF
ENDIF
// stop order to exit the positions
IF newSL > 0 THEN
SELL AT newSL STOP
EXITSHORT AT newSL STOP
ENDIF
// superordinate stop and take profit
SET STOP %LOSS stopLoss
SET TARGET %PROFIT takeProfit
ENDIF
Hi Reiner,
i get with the DOW 4H V6 a huge drawdown Jan/Feb 2016. It`s different to your backtest. Do you know why? I used the 24h chart of ig, too. Thanks for your help!!
Greets
Michael
Set PRELOADBARS to 1000 instead of 10000. May depends on which instrument you backtests.
Wallstreet cash (2 contract) have this problems. Wallstreet cash (1 EUR contract) dont’t.
Hallo
I tried to rebuild the SMI according to Reiners taste. More than 80% Profit and less than 25% Drawdown.
Milk the swiss cow.
All the best for 2017
MichiM
Hi guys,
With start 2017 I’m going to manage one of my ETF account with a bunch of Pathfinder daily swing robots and for this reason I have opened a new topic for the Pathfinder swing trading system idea here https://www.prorealcode.com/topic/pathfinder-swing-ts/
This topic remains for all general Pathfinder questions and especially for the “flagship” DAX 4H. All swing trade related questions please ask in the new topic.
Best, Reiner
wp01Participant
Master
@Reiner,
Beest wishes for 2017.
It seems that DAX4HV6 opened a short yesterday at 13:00 hours @ 11.578,30 (according to BT) but was not pushed as a real trade in IG.
This is actually the first time this happened with V6. Former trades went well.
I don’t think i am the only one with this issue. Do you have any idea what went wrong?
Thanks.
Best regards,
Patrick
Hi,
I am not sure if it possible but I feel that it is a litte hard to find different versions of Pathfinder in the forum, anyone have a recommendation about how can I find them easly and recognize old ones versus new?
Regards.
/Hakan