ProRealCode - Trading & Coding with ProRealTime™
To trade the PF US500 in ProOrder you have to change line 51 to 5 and line 53/54/55 to 50. The minimum tradesize is 5 according to IG.
You get more or less the same outcome in the results as with the original sizes. Which is weird because if you take a look at the orderlist in the beginning of 2010
you see a couple of times orders with 2 positions only. The trades should have been rejected in live by the way.
And in this code the startrisk is 2. If you take less risk (<2) you probably have to change the minimumsize as well.
Regards,
Hello.
I’ve been following you here for a longer while. It’s very interesting and I can see how much work is already done in the Pathfinder trading systems.
Many thanks to all of you for this!
I would like to share my results with you in demo mode.
Here attached.
And I would like to ask you two three things too.
Is there anyone who runs the Pathfinder in the Dax live? If so, how long you do this and would you be willing to share the results?
What results have been obtained over the longest period of time tested with which system?
And last but not least.
Does anyone or can someone provide one of the Pathfinder systems as mt4. file? If not, do we want to pool money and hire a professional programming service?
until then
JohnScher
Translated with http://www.DeepL.com/Translator
Pathfinder Silver looks a lot better if you can backtest with 200.000 candles. So I am running it as well.
I am now live with 13 PF-4H algos. Wow, I hope they perform like in the last 2 weeks. Not a big hit, but all the small profits summed up to a nice chunk of cash.
I actually also hope they will not trigger all at once, this could severly crush my margin.
I will definitly reduce the algos when I hit 50%.
@wp01: Thanks for the tip with the Us 500. I changed it accordingly and updated the dropbox.
life/demo and backtest: backtest needs an additional candle before the data is synchronized again
From yesterday a position was opened on NIKKEI, but nothing on backtest. And there was more than 4h.
Is it normal?
Thanks a lot for sharing the code of the Pathfinder. Very organised and very well explained what it is doing in the code.
life/demo and backtest: backtest needs an additional candle before the data is synchronized again
From yesterday a position was opened on NIKKEI, but nothing on backtest. And there was more than 4h. Is it normal?
Guys, i checked the TS on Nikkei, and it should not have open a trade on 26 of febr, but it did. And i lost 1.200$ for it, could someone help me? @reiner @nicolas
// ProOrder code parameter
DEFPARAM CUMULATEORDERS = true // cumulate orders if not turned off
DEFPARAM PRELOADBARS = 10000
// define intraday trading window
ONCE startTime = 50000 // start time of trading window in CET
ONCE endTime = 210000 // end time of trading window in CET
// define instrument signalline with help of multiple smoothed averages
ONCE periodFirstMA = 5 // 5 is center of gravity, do not change
ONCE periodSecondMA = 10 // 10 is center of gravity, do not change
ONCE periodThirdMA = 3 // heartbeat of the instrument
// define filter parameter
ONCE periodLongMA = 250 // period lenght of the long moving average that works as filter
ONCE periodShortMA = 10 // period lenght of the short moving average that works as filter
// define money and position management parameter
// dynamic scaling of the chance/risk profile depending on account size
ONCE startRisk = 0.25 // start risk level e.g 0.25 - 25%, 0.5 - 50%, 0.75 - 75%, 1 - 100% and so on
ONCE maxRisk = 1 // max risk level e.g 1.5 - 150%
ONCE increaseRiskLevel = 300 // amount of profit from which the risk is to be increased
ONCE increaseRiskStep = 0.25 // step by which the risk should be increased
// size calculation: size = positionSize * trendMultiplier * saisonalPatternMultiplier * scaleFactor
ONCE positionSize = 1 // default start size
ONCE trendMultiplier = 3 // >1 with dynamic position sizing; 1 without
ONCE maxPositionSizePerTrade = 3 // maximum size per trade
ONCE maxPositionSizeLong = 6 // maximum size for long positions
ONCE maxPositionSizeShort = 1 // maximum size for short positions
ONCE stopLossLong = 5 // in % *changed from 4.75
ONCE stopLossShort = 1.5 // in % *changed from 3
ONCE takeProfitLong = 3.5 // in % *changed from 3.25
ONCE takeProfitShort = 1.75 // in %
ONCE trailingStartLong = 1.25 // in %
ONCE trailingStartShort = 0.5 // in %
ONCE trailingStepLong = 0.8 // in %
ONCE trailingStepShort = 0.3 // in %
ONCE maxCandlesLongWithProfit = 13 // take long profit latest after x candles *changed from 12
ONCE maxCandlesShortWithProfit = 10 // take short profit latest after x candles
ONCE maxCandlesLongWithoutProfit = 35 // limit long loss latest after x candles
ONCE maxCandlesShortWithoutProfit = 10 // limit short loss latest after x candles *changed from 25
// define saisonal position multiplier for each month 1-15 / 16-31 (>0 - long / <0 - short / 0 no trade)
ONCE January1 = 1 //0 *changed from 0
ONCE January2 = 0 //0
ONCE February1 = 0 //0
ONCE February2 = 1.5 //2 *changed from 2
ONCE March1 = 0 //0
ONCE March2 = 0 //0
ONCE April1 = 1.5 //2 *changed from 2
ONCE April2 = 1.5 //2 *changed from 2
ONCE May1 = 0 //0
ONCE May2 = 1 //1
ONCE June1 = 0 //0
ONCE June2 = 1.5 //2 *changed from 2
ONCE July1 = 1.5 //2 *changed from 2
ONCE July2 = 0 //0
ONCE August1 = 0 //0
ONCE August2 = 0 //0
ONCE September1 = 2 //2
ONCE September2 = 0 //0
ONCE October1 = 1.5 //2 *changed from
ONCE October2 = 1.5 //1.5
ONCE November1 = 1.5 //2 *changed from 2
ONCE November2 = 1.5 //1.5
ONCE December1 = 1.5 //2 *changed from 2
ONCE December2 = 1.5 //2 *changed from 2
// calculate the scaling factor based on the parameter
scaleFactor = MIN(maxRisk, MAX(startRisk, ROUND(StrategyProfit / increaseRiskLevel) * increaseRiskStep))
// dynamic position sizing based on weekly performance
ONCE profitLastWeek = 0
IF DayOfWeek <> DayOfWeek[1] AND DayOfWeek = 1 THEN
IF StrategyProfit > profitLastWeek + 1 THEN
positionSize = MIN(trendMultiplier, positionSize + 1) // increase risk
ELSE
positionSize = MAX(1, positionSize - 1) // decrease risk
ENDIF
profitLastWeek = strategyProfit
ENDIF
// calculate daily high/low (include sunday values if available)
dailyHigh = DHigh(1)
dailyLow = DLow(1)
previousDailyHigh = DHigh(2)
// calculate weekly high, weekly low is a poor signal
If DayOfWeek < DayOfWeek[1] AND lastweekbarindex = 0 THEN
lastWeekBarIndex = BarIndex
ELSE
IF DayOfWeek < DayOfWeek[1] THEN
weeklyHigh = Highest[BarIndex - lastWeekBarIndex](dailyHigh)
lastWeekBarIndex = BarIndex
ENDIF
ENDIF
// calculate monthly high/low
IF Month <> Month[1] AND lastMonthBarIndex=0 THEN
lastMonthBarIndex=barindex
ELSIF 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 multiplier
currentDayOfTheMonth = OpenDay
midOfMonth = 15
IF CurrentMonth = 1 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = January1
ELSE
saisonalPatternMultiplier = January2
ENDIF
ELSIF CurrentMonth = 2 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = February1
ELSE
saisonalPatternMultiplier = February2
ENDIF
ELSIF CurrentMonth = 3 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = March1
ELSE
saisonalPatternMultiplier = March2
ENDIF
ELSIF CurrentMonth = 4 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = April1
ELSE
saisonalPatternMultiplier = April2
ENDIF
ELSIF CurrentMonth = 5 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = May1
ELSE
saisonalPatternMultiplier = May2
ENDIF
ELSIF CurrentMonth = 6 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = June1
ELSE
saisonalPatternMultiplier = June2
ENDIF
ELSIF CurrentMonth = 7 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = July1
ELSE
saisonalPatternMultiplier = July2
ENDIF
ELSIF CurrentMonth = 8 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = August1
ELSE
saisonalPatternMultiplier = August2
ENDIF
ELSIF CurrentMonth = 9 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = September1
ELSE
saisonalPatternMultiplier = September2
ENDIF
ELSIF CurrentMonth = 10 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = October1
ELSE
saisonalPatternMultiplier = October2
ENDIF
ELSIF CurrentMonth = 11 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = November1
ELSE
saisonalPatternMultiplier = November2
ENDIF
ELSIF CurrentMonth = 12 THEN
IF currentDayOfTheMonth <= midOfMonth THEN
saisonalPatternMultiplier = December1
ELSE
saisonalPatternMultiplier = December2
ENDIF
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)
// 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
s2 = signalline CROSSES UNDER dailyLow
s3 = signalline CROSSES UNDER previousDailyHigh
// 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
numberContracts = MAX(1, MIN(maxPositionSizePerTrade, positionSize * saisonalPatternMultiplier) * scaleFactor)
IF (COUNTOFPOSITION + numberContracts) <= maxPositionSizeLong * scaleFactor THEN
IF SHORTONMARKET THEN
EXITSHORT AT MARKET
ENDIF
BUY numberContracts CONTRACT AT MARKET
ENDIF
ELSIF saisonalPatternMultiplier <> 0 THEN
numberContracts = MAX(1, MIN(maxPositionSizePerTrade, positionSize) * scaleFactor)
IF (COUNTOFPOSITION + numberContracts) <= maxPositionSizeLong * scaleFactor THEN
IF SHORTONMARKET THEN
EXITSHORT AT MARKET
ENDIF
BUY numberContracts CONTRACT AT MARKET
ENDIF
ENDIF
stopLoss = stopLossLong
takeProfit = takeProfitLong
ENDIF
// short entry with order cumulation
IF ( (s1 AND f3) OR (s2 AND f1) OR (s3 AND f3) ) AND NOT alreadyReducedShortPosition THEN
// check saisonal booster setup and max position size
IF saisonalPatternMultiplier < 0 THEN
numberContracts = MAX(1, MIN(maxPositionSizePerTrade, positionSize * ABS(saisonalPatternMultiplier)) * scaleFactor)
IF (ABS(COUNTOFPOSITION) + numberContracts) <= maxPositionSizeShort * scaleFactor THEN
IF LONGONMARKET THEN
SELL AT MARKET
ENDIF
SELLSHORT numberContracts CONTRACT AT MARKET
ENDIF
ELSIF saisonalPatternMultiplier <> 0 THEN
numberContracts = MAX(1, MIN(maxPositionSizePerTrade, positionSize) * scaleFactor)
IF (ABS(COUNTOFPOSITION) + numberContracts) <= maxPositionSizeShort * scaleFactor THEN
IF LONGONMARKET THEN
SELL AT MARKET
ENDIF
SELLSHORT numberContracts CONTRACT AT MARKET
ENDIF
ENDIF
stopLoss = stopLossShort
takeProfit = takeProfitShort
ENDIF
// stop and profit management
posProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsize
numberCandles = (BarIndex - TradeIndex)
m1 = posProfit > 0 AND numberCandles >= maxCandlesLongWithProfit
m2 = posProfit > 0 AND numberCandles >= maxCandlesShortWithProfit
m3 = posProfit < 0 AND numberCandles >= maxCandlesLongWithoutProfit
m4 = posProfit < 0 AND numberCandles >= 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 (convert % to pips)
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
stopLoss = stopLossLong * 0.1
takeProfit = takeProfitLong * 2
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
IF LONGONMARKET THEN
SELL AT newSL STOP
ENDIF
IF SHORTONMARKET THEN
EXITSHORT AT newSL STOP
ENDIF
ENDIF
// superordinate stop and take profit
SET STOP %LOSS stopLoss
SET TARGET %PROFIT takeProfit
ENDIF
I loaded PF Nikkei V6 to check the latest positions and V6 also opened a position on the same date and time. I see in your tradelog that the opening was from PF V7, but
have you checked that you also activated the correct version in ProOrder or that maybe an old version is hanging there? I’m asking because your BT also show two versions.
Dajvop and Pfeiler are also running PF Nikkei V7. Maybe they can tell you if they had the same positions.
Kind regards,
Hello Wp thank you for your reply, the version on the screenshot are almost the same, i am running the code that i’ve posted, no trade on Backtest, trade in real :-/ Could you try to backtest it the same?
I already loaded your mac version and i get the same results as you have.
When did you activate it in ProOrder? There is a date on the right in ProOrder. I’m asking because i had some issues in the past when i activated a code in ProOrder while it is in position,
live and backtest were not always in sync. So if you activated it between 16-02-2018 09:00 hours and 26-02-2018 05:00 hours you were not have all the buys. I’m not sure if it goes well when the position
is closed. I can remember i had a few times a problem with that in the past. But this is easy to check for you. If it was before that date than this could not be the problem and i’m out of options.
Mmm i started the code on 20 of february…i need to try from that day, i will next week now i will be out for holiday.
I activated the latest NIKKEI v7 on Feb 6. The first buy was on Feb 16 0900, the second on Feb 19 0500 and the third on Feb 19 0900. Now, the backtest and live trading differs.
BT buys on Feb 21 0900 and then exits on Feb 26 0500.
LT exits all positions on Feb 21 1700, then buys on Feb 26 2100 and exits with loss on Mar 1 1946.
Thanks dajvop. The latest trade is the same as Gianluca reported after he activated it on the 20th. of february.
Do you have an idea why it bought on the 26th. at 09.00 and why it didn’t show up in the BT?
My idea is that it bought a position because of the dynamic positionsize. The algo had a profit in the week before.
IF DayOfWeek <> DayOfWeek[1] AND DayOfWeek = 1 THEN
IF StrategyProfit > profitLastWeek + 1 THEN
positionSize = MIN(trendMultiplier, positionSize + 1) // increase risk
ELSE
positionSize = MAX(1, positionSize – 1) // decrease risk
ENDIF
profitLastWeek = strategyProfi
You also had the full profit because you activated it earlier instead of Gianluca. He activated it the 20th. According to your tradelog from above he didn’t had one of the buy orders.
I think the reason why the results differ from the LT is that when you start the algo, it also starts with 1 position, depending on the risk you take. But when you look at the BT for over
5 or more years it had already increased multi positions and risk because of the positive results. Looking at the dynamic positionsize it increases the positionsize looking at results and
seasonal multiplier. (see line 47 and 48). When activated in LT it basicly starts at zero.
Buongiorno a tutti e un ringraziamento speciale a Reiner per la sua disponibilità, ha preso a disposizione il suo sistema pathfinder. Ho notato che quando uso pathfinder in modo reale le operazioni sono differenti da quelli eseguiti su backtest. Ho anche notato che, in modo reale, le operazioni dipendono dal momento in cui si avvia il sistema. La mia domanda è: qual è il momento giusto si deve lanciare il sistema? Qual è il momento giusto per le operazioni in modo reale coincidere con quelli in modo backtest? Grazie mille per l’eventuale risposta.
Hello Ant.g
Il mio italiano non e sufficiente per una risposta
This post is in the english forum, so could you be kind to continue in this language ?
thks
Reb
Pathfinder Trading System
This topic contains 1,834 replies,
has 139 voices, and was last updated by CFD AutoTrading
2 years, 6 months ago.
| Forum: | ProOrder support |
| Language: | English |
| Started: | 09/22/2016 |
| Status: | Active |
| Attachments: | 435 files |
The information collected on this form is stored in a computer file by ProRealCode to create and access your ProRealCode profile. This data is kept in a secure database for the duration of the member's membership. They will be kept as long as you use our services and will be automatically deleted after 3 years of inactivity. Your personal data is used to create your private profile on ProRealCode. This data is maintained by SAS ProRealCode, 407 rue Freycinet, 59151 Arleux, France. If you subscribe to our newsletters, your email address is provided to our service provider "MailChimp" located in the United States, with whom we have signed a confidentiality agreement. This company is also compliant with the EU/Swiss Privacy Shield, and the GDPR. For any request for correction or deletion concerning your data, you can directly contact the ProRealCode team by email at privacy@prorealcode.com If you would like to lodge a complaint regarding the use of your personal data, you can contact your data protection supervisory authority.