Combined Supertrend stapt in in de trendrichting wanneer de dagelijkse close tegelijk boven (of onder) drie verschillende trendlijnen staat. Het vereist ook dat de ATR-lijn en de procentlijn twee bars lang meer dan 7 punten van elkaar liggen. Trades sluiten wanneer die twee lijnen weer samenkomen of de prijs terug door alle lijnen kruist.
Beste run van 3. USD/JPY, Dagelijks, spread 1, uit run sweeps:2026-09-16-USDJPY-D-opt.tsv:2.
| Periode | Tot 2026-09-16 |
| Instrument | USD/JPY, Dagelijks |
| Spread | 1 punten |
| Contracten | 1 |
| Startkapitaal | 1,000,000 |
| Kosten | Alleen spread. Commissies en overnight financiering zijn niet meegerekend. |
| Bars | Tot 200,000 bars, minder waar het instrument minder historie heeft |
| Laatst getest | 2026-09-16 |
| positionSize Contracten per trade | 1 |
| lookbackPeriod Venster voor de ATR-trendlijn | 21 |
| atrMultiplier ATR-veelvoud voor de ATR-trendlijn | 3 |
| pctStopFactor Afstand van de procentuele supertrend, als fractie van de close | 0.005 |
| rsqPeriod R-kwadraatvenster voor de adaptieve supertrend | 10 |
| rsqMultiplier Multiplier van de adaptieve supertrend | 2 |
| rsqCentre R-kwadraatwaarde waarbij de adaptieve lengte gelijk is aan rsqPeriod | 0.25 |
| exitStFactor Multiplier van de standaard supertrend die bij de uitstappen wordt gebruikt | 3 |
| exitStPeriod Lengte van de standaard supertrend die bij de uitstappen wordt gebruikt | 5 |
| minGapPoints Trendlijnen moeten minstens zo ver van elkaar liggen om te traden | 7 |
| pctDirection Procentuele supertrend start in up-modus | 1 |
| prevStopLong Vorige long stop van de procentuele supertrend | 0 |
| prevStopShort Vorige short stop, zeer hoog geïnitialiseerd | 1000000000000 |
Elke run
| Markt | Tijdframe | PF | Trades | Winst % | Netto | Max DD |
|---|---|---|---|---|---|---|
| USD/JPYBeste run | Dagelijks | n/a | 53 | 52.83 | 1,613,780 JPY | -1,041,500 |
| EUR/USD | Dagelijks | n/a | 25 | 60.00 | 83,943 USD | -82,640 |
| GBP/USD | Dagelijks | n/a | 44 | 43.18 | 12,847 USD | -11,278 |
Grafieken
De code
// ============================================================ // Combined Supertrend // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long & short // Timeframe tested: Daily // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false DEFPARAM PreloadBars = 10000 // --- Parameters --- positionSize = 1 // contracts per trade lookbackPeriod = 21 // window for the ATR trend line atrMultiplier = 3 // ATR multiple for the ATR trend line pctStopFactor = 0.005 // percentage supertrend distance, as a fraction of close rsqPeriod = 10 // r-squared window for the adaptive supertrend rsqMultiplier = 2 // multiplier of the adaptive supertrend rsqCentre = 0.25 // r-squared value where the adaptive length equals rsqPeriod exitStFactor = 3 // multiplier of the standard supertrend used in exits exitStPeriod = 5 // length of the standard supertrend used in exits minGapPoints = 7 // trend lines must be at least this far apart to trade ONCE pctDirection = 1 // percentage supertrend starts in up mode ONCE prevStopLong = 0 // previous long stop of the percentage supertrend ONCE prevStopShort = 1000000000000 // previous short stop, seeded very high // --- Indicators --- // Line one: ATR trend line, the channel extreme minus or plus a weighted ATR band. weightedAtr = WeightedAverage[lookbackPeriod](AverageTrueRange[1](close)) recentHigh = Highest[lookbackPeriod](high) recentLow = Lowest[lookbackPeriod](low) upperLimit = recentHigh[1]-(weightedAtr[1]*atrMultiplier) lowerLimit = recentLow[1]+(weightedAtr[1]*atrMultiplier) IF (close > upperLimit AND close > lowerLimit) THEN atrTrendLine = upperLimit ELSIF (close < lowerLimit AND close < upperLimit) THEN atrTrendLine = lowerLimit ELSE atrTrendLine = atrTrendLine[1] ENDIF // Line two: simplified percentage supertrend around the median price. pctDistance = close * pctStopFactor pctStopLong = MedianPrice - pctDistance pctStopShort = MedianPrice + pctDistance IF pctDirection = 1 AND pctStopLong < prevStopLong THEN pctStopLong = prevStopLong ENDIF IF pctDirection = -1 AND pctStopShort > prevStopShort THEN pctStopShort = prevStopShort ENDIF IF pctDirection = 1 AND close < pctStopLong THEN pctDirection = -1 ENDIF IF pctDirection = -1 AND close > pctStopShort THEN pctDirection = 1 ENDIF prevStopLong = pctStopLong prevStopShort = pctStopShort IF pctDirection = 1 THEN pctTrendLine = pctStopLong ELSE pctTrendLine = pctStopShort ENDIF // Line three: supertrend whose length adapts to the r-squared of recent closes. sourcePrice = CustomClose sumX = 0 sumXX = 0 sumXY = 0 sumYY = 0 sumY = 0 IF BarIndex > rsqPeriod THEN FOR k = 0 TO rsqPeriod-1 DO barPrice = sourcePrice[k] sumX = sumX+(k+1) sumXX = sumXX+((k+1)*(k+1)) sumXY = sumXY+((k+1)*barPrice) sumYY = sumYY+(barPrice*barPrice) sumY = sumY+barPrice NEXT covarianceXY = sumXY - sumX*sumY/rsqPeriod varianceX = sumXX - sumX*sumX/rsqPeriod varianceY = sumYY - sumY*sumY/rsqPeriod rSquared = ((covarianceXY*covarianceXY)/(varianceX*varianceY)) adaptiveSt = Supertrend[rsqMultiplier,round(rsqPeriod+rsqPeriod*(rSquared-rsqCentre))] ENDIF exitSt = Supertrend[exitStFactor,exitStPeriod] gapMargin = minGapPoints*PointSize
Nog 28 regels: de instap- en uitstapregels.
Opzet
Vragen
De code draait automatisch in ProOrder. Hij heeft geen stop loss, dus voeg bescherming op accountniveau toe als je hem trade.
USD/JPY Dagelijks maakte 1,613,780 JPY over 53 trades, EUR/USD Dagelijks 83,943 USD over 25 trades, en GBP/USD Dagelijks 12,846.80 USD over 44 trades, alles bij 1 contract.
Bij 1 contract zakte de USD/JPY-run 1,041,500 JPY vanaf de piek en GBP/USD zakte 11,278.40 USD. Verklein je positie als die cijfers te groot zijn voor je account.
De kloof van 7 punten tussen de lijnen en de ATR-lijn van 21 bars zijn afgestemd op langzame bewegingen. Op dagcharts trade het systeem maar een paar keer per jaar.
Gerelateerd
De ProRealAlgos community krijgt de volledige regels, de complete code en de geautomatiseerde portefeuille.