Pathfinder Trading System

Viewing 15 posts - 1,726 through 1,740 (of 1,835 total)
  • Author
    Posts
  • #75631 quote
    guitarrocker
    Participant
    Average

    Your own code did a BC trade or do you mean the PF (it did)?

    #75632 quote
    Gianluca
    Participant
    Master

    Your own code did a BC trade or do you mean the PF (it did)?

    hahahaha it was a misunderstood sry

    #78847 quote
    Jaykay
    Participant
    Senior

    Hola hola,

    the dax Pathfinder 1H and 4H but also the Pathfinder Hangseng didn’t t take any trade for over a month in demo but when backtesting it did take a few trades. not sure why.

    The dax systems takes half and quarter positions in backtest. could that be one of the reasons?

    #78852 quote
    dajvop
    Participant
    Master

    I changed HS to 0.5 and 2 from 0.25 and 1. That works live for me.

    Best regards, David

    Jaykay thanked this post
    #78854 quote
    Jaykay
    Participant
    Senior

    thanks,

    lets see if it will take a trade

    #78887 quote
    Gianluca
    Participant
    Master

    Hola hola,

    the dax Pathfinder 1H and 4H but also the Pathfinder Hangseng didn’t t take any trade for over a month in demo but when backtesting it did take a few trades. not sure why.

    The dax systems takes half and quarter positions in backtest. could that be one of the reasons?

    the dax 4h took 2 trade for me in the last 2 weeks so i don’t know why for you, i’m running live.

    Jaykay thanked this post
    #81322 quote
    Gianluca
    Participant
    Master

    Here is a version  DAX 4H with some MF filter function and a different trailing sistem, i hope you guys will find usefull.

    The @reiner pathfinder is an Huge system and i found it awesome 🙂

     

    // ProOrder code parameter
    DEFPARAM CUMULATEORDERS            = true   // cumulate orders if not turned off
    DEFPARAM PRELOADBARS               = 10000
    
    // define intraday trading window
    ONCE startTime                     = 90000  // 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                  = 400    // period lenght of the long moving average that works as filter
    ONCE periodShortMA                 = 50     // 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                     = 2.5   // start risk level e.g 0.25 - 25%, 0.5 - 50%, 0.75 - 75%, 1 - 100% and so on
    ONCE maxRisk                       = 20  // max risk level e.g  1.5 - 150%
    ONCE increaseRiskLevel             = 500    // amount of profit from which the risk is to be increased
    ONCE increaseRiskStep              = 0.5   // step by which the risk should be increased
    
    // size calculation: size = positionSize * trendMultiplier * saisonalPatternMultiplier * scaleFactor
    ONCE positionSize                  = 1    // default start size
    ONCE trendMultiplier               = 2      // >1 with dynamic position sizing; 1 without
    ONCE maxPositionSizePerTrade       = 6      // maximum size per trade
    ONCE maxPositionSizeLong           = 10     // maximum size for long positions
    ONCE maxPositionSizeShort          = 10     // maximum size for short positions
    
    ONCE stopLossLong                  = 3    // in %
    ONCE stopLossShort                 = 3.5   // in %
    ONCE takeProfitLong                = 6   // in %
    ONCE takeProfitShort               = 2.5
    
    
    ONCE maxCandlesLongWithProfit      = 16     // take long profit latest after x candles
    ONCE maxCandlesShortWithProfit     = 13     // take short profit latest after x candles
    ONCE maxCandlesLongWithoutProfit   = 30     // limit long loss latest after x candles
    ONCE maxCandlesShortWithoutProfit  = 30     // 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                      = 2      //0 risk(2) *changed from 3
    ONCE January2                      = 0      //3 ok
    ONCE February1                     = 3      //3 ok
    ONCE February2                     = 3      //0 risk(3)
    ONCE March1                        = 3      //0 risk(3)
    ONCE March2                        = 2      //3 ok
    ONCE April1                        = 2      //3 ok *changed from 1
    ONCE April2                        = 3      //3 ok
    ONCE May1                          = 1      //0 risk(1)
    ONCE May2                          = 2      //0 risk(2)
    ONCE June1                         = 1      //1 ok
    ONCE June2                         = 2      //3 ok
    ONCE July1                         = 3      //1 chance
    ONCE July2                         = 2      //3 ok
    ONCE August1                       = 2      //1 ok
    ONCE August2                       = 1      //3 ok chance 1 *changed from 3
    ONCE September1                    = 3      //0 risk(3)
    ONCE September2                    = 0      //0 ok
    ONCE October1                      = 3      //0 risk(3)
    ONCE October2                      = 3      //3 ok *changed from 2
    ONCE November1                     = 2      //1 chance *changed from 1
    ONCE November2                     = 3      //3 ok
    ONCE December1                     = 3      //1 chance
    ONCE December2                     = 2      //3 ok
    ///////////////////////
    timeframe (1h)
    //1////////////////////////////////////////////////////////
    once trailinstop= 1   //1 on - 0 off
    trailingstart = 100 //trailing will start @trailinstart points profit
    trailingstep = 20 //trailing step to move the "stoploss"
    //////////////
    once breakeaven = 1    //1 on - 0 off
    startBreakeven = 100 //how much pips/points in gain to activate the breakeven function?
    PointsToKeep = 120 //how much pips/points to keep in profit above of below our entry price when the breakeven is activated (beware of spread)
    //////////////////////////////////////////////////////////
    ///2///////////////////////////////////////////////
    //reset the breakevenLevel when no trade are on market
    IF NOT ONMARKET THEN
    breakevenLevel=0
    ENDIF
    timeframe(default)
    
    ////////FILTRI//////////////////
    //condizioni
    FILTROLONG = (C02 < 0.15) and (c02 > -0.9) and (adxweigh < 63) and (i1 < 0.7)and (i1 > 0.1) and (m01<0.2)and (MT>CLOSE)
    FILTROSHORT = (c02 < -0.28) and (c02 > -0.9) and (adxweigh > 25) and (i1 < 0.9) and (i1 > 0) and (m01>0.03)//and (cc > 280)
    timeframe (1H)
    MT = CALL "Main Trend"
    timeframe (default)
    
    //filtro TILS/R2
    ONCE P            = 5
    ONCE COEFF        = 0.7
    ONCE MM           = 50
    once  PERIODO  =  30 //provare con 50 POI 30
    MME3 = ExponentialAverage[P](ExponentialAverage[P](ExponentialAverage[P](close)))
    MME4 = ExponentialAverage[P](MME3)
    MME5 = ExponentialAverage[P](MME4)
    MME6 = ExponentialAverage[P](MME5)
    REM Calcolo dei coefficienti
    ONCE c1 = SQUARE(coeff)*coeff
    ONCE c1 = -c1
    ONCE c2 = 3*SQUARE(coeff)-3*c1
    ONCE c3 = -2*c2 -3*c1 -3*coeff
    ONCE c4 = 1 + 3*coeff + c2 +2*c1
    Tilson = c1*MME6 + c2*MME5 + c3*MME4 + c4*MME3
    c02=R2[mm](Tilson)-r2[mm](average[mm])
    ////filtro2
    adxweigh, ignored, ignored, ignored = CALL "ADX Weighted RSI"[14, 14, 50](close)
    ignored, ignored, ignored, M01, ignored, ignored = CALL "Filtro Elasticita'"
    //filtro3
    i1 = R2[PERIODO](close)
    //cc=CCI[20]
    
    
    
    
    // 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
    if filtrolong then
    BUY numberContracts CONTRACT AT MARKET
    ENDIF
    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
    if filtrolong then
    BUY numberContracts CONTRACT AT MARKET
    ENDIF
    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
    if filtroshort then
    SELLSHORT numberContracts CONTRACT AT MARKET
    ENDIF
    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
    if filtroshort then
    SELLSHORT numberContracts CONTRACT AT MARKET
    ENDIF
    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
    // superordinate stop and take profit
    SET STOP %LOSS stopLoss
    SET TARGET %PROFIT takeProfit
    
    ENDIF
    
    timeframe(1h)
    //3////////////////////////////
    //test if the price have moved favourably of "startBreakeven" points already
    if breakeaven>0 then
    IF onmarket AND close-tradeprice(1)>=startBreakeven*pipsize THEN
    //calculate the breakevenLevel
    breakevenLevel = tradeprice(1)+PointsToKeep*pipsize
    ENDIF
     
    //place the new stop orders on market at breakevenLevel
    IF breakevenLevel>0 THEN
    SELL AT breakevenLevel STOP
    ENDIF
    endif
    
    //************************************************************************
    //trailing stop function
    if trailinstop>0 then
    //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)>=trailingstart*pipsize THEN
    newSL = tradeprice(1)+trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
    newSL = newSL+trailingstep*pipsize
    ENDIF
    ENDIF
    
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
    newSL = tradeprice(1)-trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
    newSL = newSL-trailingstep*pipsize
    ENDIF
    ENDIF
    
    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    endif
    timeframe (default)
    
    #81324 quote
    wp01
    Participant
    Master

    Hi Gianluca,

    Thanks for your posting.

    Unfortunatley it keeps saying “Main trend does not exist”.

    Any idea what i’m missing? Or maybe you can post the itf. file instead.

    Thanks.

    #81327 quote
    dajvop
    Participant
    Master

    Yup, there is an indicator or such missing that the new code is calling.

    #81328 quote
    Gianluca
    Participant
    Master

    oH YES Sorry i paid for this but i am happy to share it

    #81330 quote
    wp01
    Participant
    Master

    How are things going David?

    #81331 quote
    Gianluca
    Participant
    Master

    guys for the other indicator “filtro elasticita'” i am unable to share due is cripted 🙁
    but try to delete the filter of that part, the sistem works good aniway

    #81332 quote
    wp01
    Participant
    Master

    Thanks Gianluca.

    Now i get another error. ADX weighted RSI?

    Can not find it back in the code.

    #81333 quote
    Gianluca
    Participant
    Master

    that is in de PRC database

    #81334 quote
    wp01
    Participant
    Master

    Yes found it.

    ADX Weighted RSI

    Thanks.

Viewing 15 posts - 1,726 through 1,740 (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...