// 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: RUT FUTURES, 1D, 0.5 points spread, account size 25.000 // Rating A //******************************************************************************************************* DEFPARAM CUMULATEORDERS = true DEFPARAM PRELOADBARS = 10000 //******************************************************************************************************* periodFirstMA = 5 periodSecondMA = 10 capital = 25000 risk = 5 positionSize = 20 maxPosSizeLong = 240 //******************************************************************************************************* periodThirdMA = 0 periodLongMA = 0 stopLossLong = 0 takeProfitLong = 0 maxCandlesLongWithProfit = 0 maxCandlesLongWithoutProfit = 0 //******************************************************************************************************* midOfMonth = 15 IF CurrentMonth = 1 THEN // ---- January ---- IF Day <= midOfMonth THEN saisonalPatternMultiplier = 0 // January1 ELSE saisonalPatternMultiplier = 0 // January2 ENDIF ELSIF CurrentMonth = 2 THEN // ---- February---- periodThirdMA = 8 periodLongMA = 65 stopLossLong = 8 takeProfitLong = 10 maxCandlesLongWithProfit = 11 maxCandlesLongWithoutProfit = 15 IF Day <= midOfMonth THEN saisonalPatternMultiplier = 1 // February1 ELSE saisonalPatternMultiplier = 1 // February2 ENDIF ELSIF CurrentMonth = 3 THEN // ---- March ---- periodThirdMA = 5 periodLongMA = 20 stopLossLong = 7 takeProfitLong = 10 maxCandlesLongWithProfit = 10 maxCandlesLongWithoutProfit = 16 IF Day <= midOfMonth THEN saisonalPatternMultiplier = 2 // March1 ELSE saisonalPatternMultiplier = 2 // March2 ENDIF ELSIF CurrentMonth = 4 THEN // ---- April ---- periodThirdMA = 4 periodLongMA = 13 stopLossLong = 5 takeProfitLong = 4 maxCandlesLongWithProfit = 12 maxCandlesLongWithoutProfit = 12 IF Day <= midOfMonth THEN saisonalPatternMultiplier = 1 // April1 ELSE saisonalPatternMultiplier = 1 // April2 ENDIF ELSIF CurrentMonth = 5 THEN // ---- May ---- periodThirdMA = 9 periodLongMA = 20 stopLossLong = 5 takeProfitLong = 5 maxCandlesLongWithProfit = 14 maxCandlesLongWithoutProfit = 13 IF Day <= midOfMonth THEN saisonalPatternMultiplier = 3 // May1 ELSE saisonalPatternMultiplier = 3 // May2 ENDIF ELSIF CurrentMonth = 6 THEN // ---- June ---- periodThirdMA = 2 periodLongMA = 85 stopLossLong = 8 takeProfitLong = 9 maxCandlesLongWithProfit = 12 maxCandlesLongWithoutProfit = 16 IF Day <= midOfMonth THEN // June1 saisonalPatternMultiplier = 2 ELSE // June2 saisonalPatternMultiplier = 3 ENDIF ELSIF CurrentMonth = 7 THEN // ---- July ---- IF Day <= midOfMonth THEN // July1 saisonalPatternMultiplier = 0 ELSE // July2 saisonalPatternMultiplier = 0 ENDIF ELSIF CurrentMonth = 8 THEN // ---- August ---- IF Day <= midOfMonth THEN // August1 saisonalPatternMultiplier = 0 ELSE // August2 saisonalPatternMultiplier = 0 ENDIF ELSIF CurrentMonth = 9 THEN // ---- September ---- IF Day <= midOfMonth THEN // September1 saisonalPatternMultiplier = 0 ELSE // September2 saisonalPatternMultiplier = 0 ENDIF ELSIF CurrentMonth = 10 THEN // ---- October ---- periodThirdMA = 10 periodLongMA = 80 stopLossLong = 8 takeProfitLong = 10 maxCandlesLongWithProfit = 16 maxCandlesLongWithoutProfit = 15 IF Day <= midOfMonth THEN // October1 saisonalPatternMultiplier = 2 ELSE // October2 saisonalPatternMultiplier = 3 ENDIF ELSIF CurrentMonth = 11 THEN // ---- November ---- periodThirdMA = 2 periodLongMA = 12 stopLossLong = 7 takeProfitLong = 10 maxCandlesLongWithProfit = 15 maxCandlesLongWithoutProfit = 15 IF Day <= midOfMonth THEN // November1 saisonalPatternMultiplier = 0 ELSE // November2 saisonalPatternMultiplier = 3 ENDIF ELSIF CurrentMonth = 12 THEN // ---- Dezember ---- periodThirdMA = 2 periodLongMA = 12 stopLossLong = 7 takeProfitLong = 10 maxCandlesLongWithProfit = 15 maxCandlesLongWithoutProfit = 15 IF Day <= midOfMonth THEN // Dezember1 saisonalPatternMultiplier = 3 ELSE // Dezember2 saisonalPatternMultiplier = 0 ENDIF ENDIF //******************************************************************************************************* equity = capital + StrategyProfit maxRisk = round(equity * risk / 100) maxPositionSizeLong = MAX(maxPosSizeLong, abs(round(maxRisk / (close * stopLossLong / 100) / PointValue) * pipsize)) //******************************************************************************************************* dailyHigh = DHigh(1) dailyLow = DLow (1) //******************************************************************************************************* firstMA = WilderAverage [periodFirstMA] (close) secondMA = TimeSeriesAverage[periodSecondMA](firstMA) signalLine = TimeSeriesAverage[periodThirdMA] (secondMA) //******************************************************************************************************* //******************************************************************************************************* f1 = close > Average[periodLongMA](close) f2 = close < Average[periodLongMA](close) l = signalLine CROSSES OVER dailyHigh s = signalLine CROSSES UNDER dailyLow IF (l AND f2) THEN 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 IF (s AND f1) THEN SELL AT MARKET ENDIF //******************************************************************************************************* posProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsize numberCandles = (BarIndex - TradeIndex) m1 = posProfit > 0 AND numberCandles >= maxCandlesLongWithProfit m2 = posProfit < 0 AND numberCandles >= maxCandlesLongWithoutProfit IF LONGONMARKET AND (m1 OR m2) THEN SELL AT MARKET ENDIF //******************************************************************************************************* SET STOP %LOSS stopLoss SET TARGET %PROFIT takeProfit //*******************************************************************************************************