// Pathfinder Trading System based on ProRealTime 10.2 // Breakout system triggered by previous daily high/low crossings with smart position management // Version 3.0a - long only //******************************************************************************************************* // Instrument: Silber Kassa Mini (-), 1D, 5 points spread, account size 10.000, max. positions: ? //******************************************************************************************************* DEFPARAM CUMULATEORDERS = true DEFPARAM PRELOADBARS = 10000 //******************************************************************************************************* ONCE periodFirstMA = 5 ONCE periodSecondMA = 10 ONCE capital = 10000 ONCE risk = 5 ONCE positionSize = 1 ONCE maxPosSize = 15 //******************************************************************************************************* saisonalMulti = 0 //******************************************************************************************************* midOfMonth = 15 IF CURRENTMONTH = 1 THEN // ---- January ---- periodThirdMA = 5 periodLongMA = 63 stopLoss = 5 takeProfit = 4 maxCandlesWithProfit = 10 maxCandlesWithoutProfit = 10 IF DAY <= midOfMonth THEN saisonalMulti = 3 // January1 ELSE saisonalMulti = 0 // January2 ENDIF ELSIF CurrentMonth = 2 THEN // ---- February---- periodThirdMA = 10 periodLongMA = 185 stopLoss = 9 takeProfit = 6 maxCandlesWithProfit = 5 maxCandlesWithoutProfit = 7 IF DAY <= midOfMonth THEN saisonalMulti = 1 // February1 ELSE saisonalMulti = 0 // February2 ENDIF ELSIF CurrentMonth = 3 THEN // ---- March ---- IF DAY <= midOfMonth THEN saisonalMulti = 0 // March1 ELSE saisonalMulti = 0 // March2 ENDIF ELSIF CurrentMonth = 4 THEN // ---- April ---- IF DAY <= midOfMonth THEN saisonalMulti = 0 // April1 ELSE saisonalMulti = 0 // April2 ENDIF ELSIF CurrentMonth = 5 THEN // ---- May ---- IF DAY <= midOfMonth THEN saisonalMulti = 0 // May1 ELSE saisonalMulti = 0 // May2 ENDIF ELSIF CurrentMonth = 6 THEN // ---- June ---- IF DAY <= midOfMonth THEN saisonalMulti = 0 // June1 ELSE saisonalMulti = 0 // June2 ENDIF ELSIF CurrentMonth = 7 THEN // ---- July ---- periodThirdMA = 10 periodLongMA = 64 stopLoss = 8.8 takeProfit = 5 maxCandlesWithProfit = 3 maxCandlesWithoutProfit = 6 IF DAY <= midOfMonth THEN saisonalMulti = 1 // July1 ELSE saisonalMulti = 3 // July2 ENDIF ELSIF CurrentMonth = 8 THEN // ---- August ---- periodThirdMA = 8 periodLongMA = 100 stopLoss = 7 takeProfit = 6.5 maxCandlesWithProfit = 4 maxCandlesWithoutProfit = 9 IF DAY <= midOfMonth THEN saisonalMulti = 1 // August1 ELSE saisonalMulti = 3 // August2 ENDIF ELSIF CurrentMonth = 9 THEN // ---- September ---- periodThirdMA = 2 periodLongMA = 120 stopLoss = 8 takeProfit = 3 maxCandlesWithProfit = 9 maxCandlesWithoutProfit = 7 IF DAY <= midOfMonth THEN saisonalMulti = 1 // September1 ELSE saisonalMulti = 0 // September2 ENDIF ELSIF CurrentMonth = 10 THEN // ---- October ---- periodThirdMA = 2 periodLongMA = 40 stopLoss = 6 takeProfit = 4.7 maxCandlesWithProfit = 5 maxCandlesWithoutProfit = 11 IF DAY <= midOfMonth THEN saisonalMulti = 1 // October1 ELSE saisonalMulti = 0 // October2 ENDIF ELSIF CurrentMonth = 11 THEN // ---- November ---- periodThirdMA = 20 periodLongMA = 60 stopLoss = 9 takeProfit = 9 maxCandlesWithProfit = 5 maxCandlesWithoutProfit = 12 IF DAY <= midOfMonth THEN saisonalMulti = 0 // November1 ELSE saisonalMulti = 2 // November2 ENDIF ELSIF CurrentMonth = 12 THEN // ---- Dezember ---- periodThirdMA = 11 periodLongMA = 170 stopLoss = 8 takeProfit = 3 maxCandlesWithProfit = 10 maxCandlesWithoutProfit = 13 IF DAY <= midOfMonth THEN saisonalMulti = 0 // Dezember1 ELSE saisonalMulti = 1 // Dezember2 ENDIF ENDIF //******************************************************************************************************* equity = capital + STRATEGYPROFIT maxRisk = ROUND(equity * risk / 100) maxPositionSize = MAX(maxPosSize, ABS(ROUND(maxRisk / (CLOSE * stopLoss / 100) / POINTVALUE) * PIPSIZE)) //******************************************************************************************************* firstMA = WilderAverage [periodFirstMA] (CLOSE) secondMA = TimeSeriesAverage[periodSecondMA](firstMA) signalLine = TimeSeriesAverage[periodThirdMA] (secondMA) //******************************************************************************************************* longSignal = signalLine CROSSES OVER DHIGH(1) f2 = CLOSE < Average[periodLongMA](CLOSE) IF (longSignal AND f2) THEN IF saisonalMulti > 0 THEN IF (COUNTOFPOSITION + (positionSize * saisonalMulti)) <= maxPositionSize THEN BUY positionSize * saisonalMulti CONTRACT AT MARKET ENDIF ENDIF ENDIF shortSignal = signalLine CROSSES UNDER DLOW (1) f1 = CLOSE > Average[periodLongMA](CLOSE) IF (shortSignal AND f1) THEN SELL AT MARKET ENDIF //******************************************************************************************************* posProfit = (((CLOSE - POSITIONPRICE) * POINTVALUE) * COUNTOFPOSITION) / PIPSIZE numberCandles = (BARINDEX - TRADEINDEX) m1 = posProfit > 0 AND numberCandles >= maxCandlesWithProfit m2 = posProfit < 0 AND numberCandles >= maxCandlesWithoutProfit IF LONGONMARKET AND (m1 OR m2) THEN SELL AT MARKET ENDIF //******************************************************************************************************* SET STOP %LOSS stopLoss SET TARGET %PROFIT takeProfit //*******************************************************************************************************