// Pathfinder Trading System based on ProRealTime 10.2 // Breakout system triggered by previous daily high/low crossings with smart position management // Version 2 - long only // Instrument: Japan 225 1 Mini, 1D, account size 10.000 ? // Rating ? // ProOrder code parameter DEFPARAM CUMULATEORDERS = true // cumulate orders if not turned off DEFPARAM PRELOADBARS = 10000 // define instrument signalline with help of multiple smoothed averages ONCE periodFirstMA = 5 ONCE periodSecondMA = 10 ONCE periodThirdMA = 14 // define filter parameter ONCE periodLongMA = 120 // define position and money management parameter Capital = 10000 Risk = 5 // in % equity = Capital + StrategyProfit maxRisk = round(equity * Risk / 100) positionSize = 1 ONCE stopLossLong = 5 // in % ONCE takeProfitLong = 7 // in % maxPositionSizeLong = MAX(15, abs(round(maxRisk / (close * stopLossLong / 100) / PointValue) * pipsize)) ONCE maxCandlesLongWithProfit = 3 // take long profit latest after x candles ONCE maxCandlesLongWithoutProfit = 6 // limit long loss latest after x candles // define saisonal position multiplier for each month 1-15 / 16-31 (>0 - long / <0 - short / 0 no trade) ONCE January1 = 0 ONCE January2 = 1 // lol ONCE February1 = 0 ONCE February2 = 0 ONCE March1 = 0 ONCE March2 = 0 ONCE April1 = 0 ONCE April2 = 0 ONCE May1 = 0 ONCE May2 = 0 ONCE June1 = 0 ONCE June2 = 0 ONCE July1 = 0 ONCE July2 = 0 ONCE August1 = 0 ONCE August2 = 0 ONCE September1 = 0 ONCE September2 = 0 ONCE October1 = 0 ONCE October2 = 0 ONCE November1 = 0 ONCE November2 = 0 ONCE December1 = 0 ONCE December2 = 0 // calculate daily high/low (include sunday values if available) dailyHigh = DHigh(1) dailyLow = DLow(1) // calculate instrument signalline with multiple smoothed averages firstMA = WilderAverage[periodFirstMA](close) secondMA = TimeSeriesAverage[periodSecondMA](firstMA) signalline = TimeSeriesAverage[periodThirdMA](secondMA) // set saisonal multiplier currentDayOfTheMonth = Date - ((CurrentYear * 10000) + CurrentMonth * 100) 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 // use fast and slow averages as filter because not every breakout is profitable f1 = close > Average[periodLongMA](close) f2 = close < Average[periodLongMA](close) // long position conditions l = signalline CROSSES OVER dailyHigh // short position conditions s = signalline CROSSES UNDER dailyLow // long entry with order cumulation IF (l AND f2) 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 means close long position IF (s AND f1) THEN SELL AT MARKET 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 >= maxCandlesLongWithoutProfit // take profit after max candles IF LONGONMARKET AND (m1 OR m2) THEN SELL AT MARKET ENDIF // superordinate stop and take profit SET STOP %LOSS stopLoss SET TARGET %PROFIT takeProfit