Pathfinder Trading System

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

    Hi guys,

    this topic is for all discussions related to the Pathfinder trading system strategies. The system based on four components that work perfectly together.

    • signalline – instrument trend line based on two smoothed averages (Wilder and Time Series)
    • breakout levels – previous daily, weekly and monthly high/lows in combination with fast and slow averages as filters because not every breakout is profitable
    • saisonal behavior – position size will be boost with a multiplier for each month depending on the historical seasonal behavior
    • smart money and position management – grid orders, maximal position size monitoring, superordinate stop loss/take profit, trailing stop and maximum holding periods are used mechanisms

     

    The Pathfinder breakout logic works well for many instruments with 24 hour quotes such as DAX, DOW, FTSE, Hang Seng, NIKKEI in 4 hours timeframe. All versions are optimized for an 10k Euro account.

    Pathfinder strategies offer a statistical advantage but are of course not a holy grail and there is no guarantee to make money with it. The systems are optimized for historical data and historical gains are not a guarantee to be successful in the future. I strictly recommend to adjust the position sizes to your personal account size and try first in demo mode. The results in life trading will differ from the backtest results. I also recommend to start in life trading with a small account size. Anyone can use the programs for free and at their own risk.

    Pathfinder is my private and fully transparent algorithmic trading project exclusively implemented for ProRealTime 10.3. The status is experimental and I don’t trade all the systems presented here. I would also like to thank all members who have helped to improve the system with their contributions.

    Please find below the last released Pathfinder trading system versions for suitable instruments.

    Dropbox Link: https://www.dropbox.com/sh/xyymvk6gscxbfbe/AABaOs9_ZExILA18HxKW9kdqa

    Best, Reiner

    04.02.2018 Updated dropbox with new algos V7-FEB-2018 with automatic scaling for ASX, DAX, DOW, FTSEGOLD, HS, NIKKEI, SAF and STXE (#post-61450)
    08.01.2017 Checkout the results from 2017 (#post-56978)  || introducing new PF algo category DAX-1H-V8 (#post-57005)  || new algos in dropbox DAX-V7-2018 (#post-57521), DOW-V7-2018 (#post-57524) and HS-V7-2018 (#post-57528)
    02.08.2017 Updated dropbox with new algos FTSE-V7 and Nikkei-V7 (#post-42223), ASX-V7 (#post-42249) and STXE-V7 (#post-42332)
    31.07.2017 Updated dropbox with new algos DAX-V7-2, DOW-V7-2 and HS-V7-2 (#post-41811)
    18.07.2017 Release V7 containing error fixes, improvements and new features for DAX-V7 (#post-40798) and DOW-V7 (#post-40880)

    Nicolas, Wing, OldGerman and 55 others thanked this post
    #13568 quote
    Cosmic1
    Participant
    Senior

    Hi Reiner, Great work on the code. Can I ask what variables you have been optimising in your backtests? I’d like to run this live but I wanted to run some IN/OUT testing first.

    burghy17 (Andrea), parvus, sorosuub and 3 others thanked this post
    #13605 quote
    Reiner
    Participant
    Veteran

    Hi Cosmic1, here are the optimized variables that are important for your test. Also check these variables if you want to adjust Pathfinder to other instruments.

    ONCE periodThirdMA = 3 // this variable define the "heartbeat" of every instrument and have to be adjusted, possible values are 3, 4, 5, 6, 7
    
    // filter parameter
    ONCE periodLongMA = 250 // the settings of the filter periods are also important for the profit factor, 200, 250, 300 are good values
    ONCE periodShortMA = 50 // 10,  40 or 50 are good settings
    
    // money and position management parameter - these parameters are important for the risk and performance
    ONCE stoppLoss = 5 // in %   the system would works without a stopp loss, it's more in the sense of a disaster exit
    ONCE takeProfitLong = 2 // in %
    ONCE takeProfitShort = 1.75 // in %
    
    ONCE maxCandlesLongWithProfit = 18 // take long profit latest after 18 candles - 15 with a higher take profit is my new favorite in the next version
    ONCE maxCandlesShortWithProfit = 13 // take short profit latest after 12 candles - 13 is a good value for every instrument
    ONCE maxCandlesLongWithoutProfit = 30 // limit long loss latest after 30 candles - 30 or 40 are good values
    ONCE maxCandlesShortWithoutProfit = 25 // limit short loss latest after 25 candles - 25 is my favorite for all instruments
    jamesgodfrey80, Juan Salas and paolosab69 thanked this post
    #13618 quote
    miguel33
    Participant
    Senior

    Reiner

    it may be useful to avoid returning the same day (or candle) to me makes no sense out of the trade and return immediately after. it would be appropriate to wait a day. what do you think ?

    #13628 quote
    Reiner
    Participant
    Veteran

    Miguel, I saw it, Pathfinder re-entered in the DAX on the same day – from today’s perspective that’s probably not a good trade. I will try to test it.

    #13634 quote
    Cosmic1
    Participant
    Senior

    Thanks Reiner, I presumed that was the case. That is a lot of variables so will have to cut it up in to chunks and run many tests. Will try it over the weekend and let you know what I find.

    #13641 quote
    Reiner
    Participant
    Veteran

    I have created a new version. Pathfinder V4 is now more applicable to other indices such as DOW or FTSE. Here are the changes:

    • reorganize the code a little bit to make things clearer
    • introduce maximal position size for long and short trades to avoid an excessive risk
    • separation of the stop loss for long and short trades
    • introduce monthly saisonal pattern management
    • adjust signal and filter logic for other indices such as FTSE or DOW
    • modify some trading parameter

    changes in detail for the DAX:

    • new: maxPositionSizeLong
    • new: maxPositionSizeShort
    • new: stoppLossShort
    • change: periodLongMA = 300 // 250
    • change: stopLossLong = 5 // 5.5
    • change: takeProfitLong = 2.75 // 2
    • change: maxCandlesWithProfit = 15 // 18
    • rename: c1, c2, c3 in f1, f2, f3
    • remove: c4 filter
    • remove: monthlyLow for short trades

    Here is the code for the DAX (backtest result is attached):

    // 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 4
    // Instrument: DAX mini 4H, 8-22 CET, 2 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 = 80000
    ONCE endTime = 220000
    
    // define instrument signalline with help of multiple smoothed averages
    ONCE periodFirstMA = 5
    ONCE periodSecondMA = 10
    ONCE periodThirdMA = 3
    
    // define filter parameter
    ONCE periodLongMA = 300
    ONCE periodShortMA = 50
    
    // define position and money management parameter
    ONCE positionSize = 1
    ONCE maxPositionSizeLong = 15
    ONCE maxPositionSizeShort = 10
    
    ONCE stopLossLong = 5.5 // in %
    ONCE stopLossShort = 3.5 // in %
    ONCE takeProfitLong = 2.75 // in %
    ONCE takeProfitShort = 1.75 // in %
    
    ONCE maxCandlesLongWithProfit = 15  // take long profit latest after 15 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
    
    // define saisonal position multiplier >0 - long / <0 - short / 0 no trade
    ONCE January = 2
    ONCE February = 2
    ONCE March = 2
    ONCE April = 3
    ONCE May = 2
    ONCE June = 2
    ONCE July = 3
    ONCE August = -1
    ONCE September = -2
    ONCE October = 1
    ONCE November = 3
    ONCE December = 3
    
    // 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 instrument signalline with multiple smoothed averages
    firstMA = WilderAverage[periodFirstMA](close)
    secondMA = TimeSeriesAverage[periodSecondMA](firstMA)
    signalline = TimeSeriesAverage[periodThirdMA](secondMA)
    
    // trade only in defined trading window
    IF Time >= startTime AND Time <= endTime THEN
    
    // filter criteria because not every breakout is profitable
    f1 = close > Average[periodLongMA](close)
    f2 = close < Average[periodLongMA](close)
    f3 = close > Average[periodShortMA](close)
    
    // 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
    
    // 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 f2) ) THEN  // cumulate orders for long trades
    IF saisonalPatternMultiplier > 0 THEN // check saisonal booster setup and max position size
    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
    IF NOT SHORTONMARKET  AND ( (s1 AND f3) OR (s2 AND f1) ) THEN // no cumulation for short trades
    IF saisonalPatternMultiplier < 0 THEN // check saisonal booster setup and max position size
    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
    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 stopLoss
    SET TARGET %PROFIT takeProfit
    
    ENDIF
    
    Cosmic1, xadami, Elsborgtrading and 9 others thanked this post
    #13644 quote
    Cosmic1
    Participant
    Senior

    Will take some time to look at this over the weekend but looks very impressive. I finished running some IN/OUT opp just now on V3 Jan 2009 – March 2014 and results were very similar on the forward test, infact slightly better so this gives very good confidence.  🙂

    Elsborgtrading thanked this post
    #13645 quote
    Reiner
    Participant
    Veteran

    The consideration of seasonal patterns have improved my trading results significantly. Especially for commodities they are very helpful. On the webpage http://www.equityclock.com you will find excellent information about this topic. I have created a first Pathfinder version for crude oil based on the historic backtest results of saisonal patterns  http://charts.equityclock.com/crude-oil-futures-cl-seasonal-chart. Unfortunately IG PRT has only a very limited data history and maybe someone with longer history is able to check the reliability of the results.

    // 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 1
    // Instrument: CL mini 4H, 7-23 CET, 3 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 = 70000
    ONCE endTime = 230000
    
    // define instrument signalline with help of multiple smoothed averages
    ONCE periodFirstMA = 5
    ONCE periodSecondMA = 10
    ONCE periodThirdMA = 4
    
    // define filter parameter
    ONCE periodLongMA = 100
    ONCE periodShortMA = 10
    
    // define position and money management parameter
    ONCE positionSize = 1
    ONCE maxPositionSizeLong = 15
    ONCE maxPositionSizeShort = 15
    
    ONCE stopLossLong = 10 // in %
    ONCE stopLossShort = 5 // in %
    ONCE takeProfitLong = 8 // in %
    ONCE takeProfitShort = 10 // in %
    
    ONCE maxCandlesLongWithProfit = 20  // take long profit latest after 20 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
    
    // define saisonal position multiplier >0 - long / <0 - short / 0 no trade (www.equityclock.com)
    ONCE January = 5
    ONCE February = -5
    ONCE March = 5
    ONCE April = 5
    ONCE May = 5
    ONCE June = 5
    ONCE July = 5
    ONCE August = 5
    ONCE September = 5
    ONCE October = -5
    ONCE November = -5
    ONCE December = 3
    
    // calculate daily high/low
    dailyHigh = DHigh(1)
    dailyLow = DLow(1)
    
    // calculate weekly high/low
    If DayOfWeek < DayOfWeek[1] then
    weeklyHigh = Highest[BarIndex - lastWeekBarIndex](dailyHigh)
    weeklyLow = Lowest[BarIndex - lastWeekBarIndex](dailyLow)
    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)
    
    // trade only in defined trading window
    IF Time >= startTime AND Time <= endTime THEN
    
    // filter criteria because not every breakout is profitable
    f1 = close > Average[periodLongMA](close)
    f2 = close < Average[periodLongMA](close)
    f3 = close > Average[periodShortMA](close)
    
    // 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
    
    // 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 weeklyHigh
    s3 = signalline CROSSES UNDER weeklyLow
    s4 = signalline CROSSES UNDER dailyHigh
    s5 = signalline CROSSES UNDER dailyLow
    
    
    // long entry
    IF ( l1 OR l4 OR l2 OR (l3 AND f2) ) THEN  // cumulate orders for long trades
    IF saisonalPatternMultiplier > 0 THEN // check saisonal booster setup and max position size
    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
    IF NOT SHORTONMARKET  AND ( (s1 AND f3) OR (s2 AND f1) OR (s3 AND f2) OR (s4 AND f1) OR (s5 AND f1) ) THEN // no cumulation for short trades
    IF saisonalPatternMultiplier < 0 THEN // check saisonal booster setup and max position size
    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
    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 stopLoss
    SET TARGET %PROFIT takeProfit
    
    ENDIF
    
    
            
        
    #13648 quote
    Cosmic1
    Participant
    Senior

    End part matches yours at least… Choppy ride. I will take a look at the weekend further.

    #13652 quote
    Reiner
    Participant
    Veteran

    Thanks Cosmic1, long trades are good, short trades are bad, next step is to sort out the weak short conditions, I asume that weekly high/low and daily high are not realy working with oil

    #13657 quote
    miguel33
    Participant
    Senior

    perfect. Also this version will look. do you think it’s OK to Wallstreet and FTSE 100? after oil might be useful for a gold system. I hope that your great work is rewarded.

    Grazie.

    miguel

    #13658 quote
    Reiner
    Participant
    Veteran

    Miguel, FTSE and DOW is almost ready for V4, I will release it soon. Gold and silver are on my agenda as well. This weekend is sunny weather here in Frankfurt and my family have requested some outdoor activities, so my time is limited on this weekend 🙂

    Nicolas and Midlanddave thanked this post
    #13666 quote
    miguel33
    Participant
    Senior

    y’re the best.  I Will send you My tradizional  christmas  sweets of puglia. . promised. good wekend.

    Miguel

    ALE thanked this post
    #13714 quote
    Reiner
    Participant
    Veteran

    I adapted Pathfinder V4 on FTSE and DOW. Due every index has it’s own “heartbeat” minor adjustments were necessary. Please be aware that this is an optimized view to historic data. Please check the position size and the related drawdown and adjust it to your own risk.

    Pathfinder FTSE V4

    // 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 4
    // Instrument: FTSE mini 4H, 9-22 CET, 2 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 = 90000
    ONCE endTime = 220000
    
    // define instrument signalline with help of multiple smoothed averages
    ONCE periodFirstMA = 5
    ONCE periodSecondMA = 10
    ONCE periodThirdMA = 7
    
    // define filter parameter
    ONCE periodLongMA = 200
    ONCE periodShortMA = 10
    
    // define position and money management parameter
    ONCE positionSize = 1
    ONCE maxPositionSizeLong = 15
    ONCE maxPositionSizeShort = 10
    
    ONCE stopLossLong = 5.25 // in %
    ONCE stopLossShort = 2.5 // in %
    ONCE takeProfitLong = 3 // in %
    ONCE takeProfitShort = 2 // 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 40 candles
    ONCE maxCandlesShortWithoutProfit = 25  // limit short loss latest after 25 candles
    
    // define saisonal position multiplier >0 - long / <0 - short
    ONCE January = 3
    ONCE February = 3
    ONCE March = 3
    ONCE April = 2
    ONCE May = 2
    ONCE June = 2
    ONCE July = 3
    ONCE August = 2
    ONCE September = -3
    ONCE October = 2
    ONCE November = 3
    ONCE December = 3
    
    // 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 instrument signalline with multiple smoothed averages
    firstMA = WilderAverage[periodFirstMA](close)
    secondMA = TimeSeriesAverage[periodSecondMA](firstMA)
    signalline = TimeSeriesAverage[periodThirdMA](secondMA)
    
    // trade only in defined trading window
    IF Time >= startTime AND Time <= endTime THEN
    
    // filter criteria because not every breakout is profitable
    f1 = close > Average[periodLongMA](close)
    f2 = close < Average[periodLongMA](close)
    f3 = close > Average[periodShortMA](close)
    
    // 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
    
    // 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 f2) ) THEN  // cumulate orders for long trades
    IF saisonalPatternMultiplier > 0 THEN // check saisonal booster setup and max position size
    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
    IF NOT SHORTONMARKET  AND ( (s1 AND f3) OR (s2 AND f1) ) THEN // no cumulation for short trades
    IF saisonalPatternMultiplier < 0 THEN // check saisonal booster setup and max position size
    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
    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 stopLoss
    SET TARGET %PROFIT takeProfit
    
    ENDIF
    
    wp01 thanked this post
Viewing 15 posts - 1 through 15 (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...