Pathfinder Trading System

Viewing 15 posts - 181 through 195 (of 1,835 total)
  • Author
    Posts
  • #15856 quote
    Reiner
    Participant
    Veteran

    Hi MichiM,

    wie du vlt. gelesen hast, hatten wir alle mehr oder weniger das gleiche Problem. Ich habe mir den Code von V5B2 nochmal genau angeschaut und einen Fehler bei der Berechnung der Haltedauer für einen short trade gefunden (siehe oben). Ich werde in kürze eine neuen Version hierzu veröffentlichen. Ich handle nur den DAX und da waren die Real Mode Trades und die Backtest Trades bis auf eine slippage von ein paar Punkten bisher eigentlich immer identisch. Es muss da aber noch irgendwas mit der PRT Plattform passiert sein, ich hatte z.B auch ein völlig falschen Stopp – ich werde das beobachten.

    MichiM had the same problems like many others here. As mentioned above I made a code review for V5B2 and found the described error. In my opinion there must be some additional PRT platform anomalies because I had a false stop limit. In my opinion Pathfinder code looks OK so far and I’ll release a fixed version soon.

    best, Reiner

    #15857 quote
    Reiner
    Participant
    Veteran

    Hi Flo,

    Yes, the found error wasn’t responsible for everthing what I saw e.g. the stop limit was wrong as well. I made a code review and found no further points. I’ll keep my eye on it.

    best, Reiner

    #15860 quote
    Reiner
    Participant
    Veteran

    I have created a new version Pathfinder DAX H4 V5. Contains all beta funnctions and additional the following changes:

    • fixed a bug in the calculation of the maximum holding period for short trades
    • adaption of  Pathfinder’s parameter to the maximum available data history with 24 quotes (from August 2010)

    best, Reiner

    wp01, miguel33, flowsen123 and 5 others thanked this post
    #15914 quote
    flowsen123
    Participant
    Senior

    Hey Reiner,

    in deinem System ist der Handel von 8:00 bis 22:00 Uhr begrenzt. Bezieht sich das auch auf die anderen Indikatoren?

    Also z.B. Tages/Wochen/Monatshoch und -tief? Oder die geglätteten Durchschnitte?

    Denn ich hab mir Gedanken darüber gemacht wie man den Backtest aussagekräftiger machen kann und noch mehr historische Daten nutzen. Der eigentliche Handel an den Börsen findet ja zwischen 8 und 22 Uhr statt. Wie genau IG seine Kurse dazwischen stellt weiß ich leider auch nicht. Wäre es möglich dem System zu sagen, dass es für die Zeit von 22 bis 8 Uhr einfach den Endkurs des Tages (also den Kurs von 22Uhr) für die Berechnungen heranziehen soll? Also das es virtuell mit einer Kerze rechnet, die eigentlich gar nicht da ist?

    Ich hoffe du verstehst was ich meine. Dein Screenshot von dem System, das auf die Kernhandelszeiten beschränkt ist war zwar wesentlich schlechter als das aktuelle System und hatte einen größeren Drawdown, aber das Ergebnis war trotzdem gut. Eventuell lässt es sich das Ergebnis verbessern, indem ein 24h handel simuliert wird durch diese virtuelle Kerze.

    Das ganze ist wahrscheinlich nicht so einfach umzusetzen, aber ich würde mich trotzdem freuen wenn du mir deine Meinung dazu sagen könntest.

    MfG, Flo

    Bandido thanked this post
    #15916 quote
    reb
    Participant
    Master

    Prima Reiner

    🙂

    #15921 quote
    Nicolas
    Keymaster
    Master

    For everyone convenience,  please speak English in the english forums. Thanks in advance 🙂

    #15929 quote
    flowsen123
    Participant
    Senior

    Hello Nicolas, yes I am sorry. I had to write it fast, so I did it in german.

    I was asking if it is possible to implement a piece of code, that all the indicators and the whole systems is calculated with the last “official” price of the day for the time between 22:00 and 8:00.

    Before August 2010 there was no pricing at night. Today there is, but I think it is made by IG because the futures are not traded during that time. But as we saw, the performance of the system is better, if there happens to be candles between 22 and 8. If it would be possible to have a “virtual candle” which is only one price, maybe the system could be backtested for the complete time of the historical data.

    but i am not sure if this is possible or if this would require to code all used indicators new.

    cheers, flo

    #15933 quote
    miguel33
    Participant
    Senior

    are always the idea that if pathfinder provides closure candle 9.00 and ‘better to close the trade at 21.00 the day before (- 3 candles)
    it prevents nocturnal surprises. The night often brings disappointments. I tried the reiner code but does not work.

    mig

    #15980 quote
    Reiner
    Participant
    Veteran

    Miguel,

    regarding maximal holding  check, the following code check at 21:00:00 the condition like next morning at 9:00:00

    numberCandles = (BarIndex - TradeIndex)
    IF Time = 210000 THEN
    numberCandles = numberCandles + 3
    ENDIF
    
    m1 = posProfit > 0 AND numberCandles >= maxCandlesLongWithProfit
    m2 = posProfit > 0 AND numberCandles >= maxCandlesShortWithProfit
    m3 = posProfit < 0 AND numberCandles >= maxCandlesLongWithoutProfit
    m4 = posProfit < 0 AND numberCandles >= maxCandlesShortWithoutProfit
    
    #15982 quote
    Reiner
    Participant
    Veteran

    Hi Flo,

    Thanks for your idea, I appreciate your contribution.

    The signalline calculation consider 24 hours  and sunday quotes. This behavior is an advantage and make the system much better. The quotes outside of the core trading time will predict the future trend and give probably better signals. Without additional external price information Pathfinder isn’t in the position to calculate comparable valueable quotes.

    Pathfinder has already 250 lines of code and the complexity is high enough.

    best, Reiner

    #16050 quote
    miguel33
    Participant
    Senior

    I tried using pathfinder for eur / usd. The results are interesting but you have to remove the trade in balance and eliminate seasonality.

    // 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 Beta
    // Instrument: EUR/USD mini 4H, 3-23 CET, 0.6 points spread, account size 10.000 Euro
    
    // ProOrder code parameter
    DEFPARAM CUMULATEORDERS = true  // cumulate orders if not turned off
    DEFPARAM PRELOADBARS = 10000
    
    // define intraday trading window
    ONCE startTime = 030000
    ONCE endTime = 230000
    
    // define instrument signalline with help of multiple smoothed averages
    ONCE periodFirstMA = 7
    ONCE periodSecondMA = 11
    ONCE periodThirdMA = 9
    
    // define filter parameter
    ONCE periodLongMA = 50
    ONCE periodShortMA = 20
    
    // define position and money management parameter
    ONCE positionSize = 1
    
    Capital = 1000
    Risk = 2 // in %
    equity = Capital + StrategyProfit
    maxRisk = round(equity * Risk / 100)
    
    ONCE stopLossLong = 2 // in %
    ONCE stopLossShort = 2 // in %
    ONCE takeProfitLong = 4 // in %
    ONCE takeProfitShort = 3 // in %
    
    maxPositionSizeLong = MAX(15, abs(round(maxRisk / (close * stopLossLong / 100) / PointValue) * pipsize))
    maxPositionSizeShort = MAX(5, abs(round(maxRisk / (close * stopLossShort / 100) / PointValue) * pipsize))
    
    ONCE trailingStartLong = 1.6 // in %
    ONCE trailingStartShort = 0.6 // in %
    ONCE trailingStepLong = 0.6 // in %
    ONCE trailingStepShort = 0.2 // in %
    
    ONCE maxCandlesLongWithProfit = 17  // take long profit latest after 16 candles
    ONCE maxCandlesShortWithProfit = 19  // take short profit latest after 15 candles
    ONCE maxCandlesLongWithoutProfit = 39  // limit long loss latest after 30 candles
    ONCE maxCandlesShortWithoutProfit = 13  // limit short loss latest after 13 candles
    
    // define saisonal position multiplier >0 - long / <0 - short / 0 no trade
    ONCE January = 1
    ONCE February = 1
    ONCE March = 1
    ONCE April = 1
    ONCE May = 1
    ONCE June = 1
    ONCE July = 1
    ONCE August = 1
    ONCE September = 1
    ONCE October = 1
    ONCE November = 1
    ONCE December = 1
    
    // 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)
    
    // 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
    
    // 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 without order cumulation
    IF NOT SHORTONMARKET  AND ( (s1 AND f3) OR (s2 AND f1) ) 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
    #16098 quote
    flowsen123
    Participant
    Senior

    The IT support of IG says, that the change from summer- to wintertime caused the bug in the program.

    Reiner thanked this post
    #16104 quote
    RomanK_actor
    Participant
    Junior

    Hello Ale and Reiner,

    Congrats Reiner for the code quality.

    I have a question for you Ale about the backtest realized before 2009, do you know how many points the strategy made in 2008 ?

    Thank you

    Kindest regards,

    Roman

    #16108 quote
    GAMMA
    Participant
    Junior

    how about the crude oil and gas

    #16109 quote
    Nicolas
    Keymaster
    Master
    @RomanK

    >> Please update your country flag in your profile. Thank you 🙂 <<

    @GAMMA Since no one is a robot or a slave here, please make polite request when you ask something 🙂 Thank you.
Viewing 15 posts - 181 through 195 (of 1,835 total)
  • You must be logged in to reply to this topic.

Pathfinder Trading System


ProOrder support

New Reply
Author
author-avatar
Reiner @reiner Participant
Summary

This topic contains 1,834 replies,
has 139 voices, and was last updated by CFD AutoTrading
2 years, 6 months ago.

Topic Details
Forum: ProOrder support
Language: English
Started: 09/22/2016
Status: Active
Attachments: 435 files
Logo Logo
Loading...