Combined Supertrend entra nella direzione del trend quando la chiusura giornaliera è sopra (o sotto) tre diverse linee di trend contemporaneamente. Richiede inoltre che la linea ATR e la linea percentuale siano distanti più di 7 punti per due bar. Le operazioni si chiudono quando quelle due linee si riavvicinano o il prezzo riattraversa tutte le linee.
Miglior esecuzione su 3. USD/JPY, Giornaliero, spread 1, dall'esecuzione sweeps:2026-09-16-USDJPY-D-opt.tsv:2.
| Periodo | Fino al 2026-09-16 |
| Strumento | USD/JPY, Giornaliero |
| Spread | 1 punti |
| Contratti | 1 |
| Capitale iniziale | 1,000,000 |
| Costi | Solo spread. Commissioni e finanziamento overnight non sono inclusi. |
| Barre | Fino a 200,000 barre, meno dove lo strumento ha meno storico |
| Ultimo test | 2026-09-16 |
| positionSize Contratti per operazione | 1 |
| lookbackPeriod Finestra per la linea di trend ATR | 21 |
| atrMultiplier Multiplo dell'ATR per la linea di trend ATR | 3 |
| pctStopFactor Distanza del supertrend percentuale, come frazione della chiusura | 0.005 |
| rsqPeriod Finestra R-squared per il supertrend adattivo | 10 |
| rsqMultiplier Moltiplicatore del supertrend adattivo | 2 |
| rsqCentre Valore R-squared in cui la lunghezza adattiva è uguale a rsqPeriod | 0.25 |
| exitStFactor Moltiplicatore del supertrend standard usato nelle uscite | 3 |
| exitStPeriod Lunghezza del supertrend standard usato nelle uscite | 5 |
| minGapPoints Le linee di trend devono essere distanti almeno così per operare | 7 |
| pctDirection Il supertrend percentuale parte in modalità rialzista | 1 |
| prevStopLong Stop long precedente del supertrend percentuale | 0 |
| prevStopShort Stop short precedente, inizializzato molto alto | 1000000000000 |
Ogni esecuzione
| Mercato | Timeframe | PF | Operazioni | % successo | Netto | Max DD |
|---|---|---|---|---|---|---|
| USD/JPYMiglior esecuzione | Giornaliero | n/a | 53 | 52.83 | 1,613,780 JPY | -1,041,500 |
| EUR/USD | Giornaliero | n/a | 25 | 60.00 | 83,943 USD | -82,640 |
| GBP/USD | Giornaliero | n/a | 44 | 43.18 | 12,847 USD | -11,278 |
Grafici
Il codice
// ============================================================ // 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
Altre 28 righe: le regole di ingresso e di uscita.
Configurazione
Domande
Il codice funziona automaticamente in ProOrder. Non ha stop loss, quindi aggiungi una protezione a livello di conto se la utilizzi.
USD/JPY Giornaliero ha prodotto 1,613,780 JPY su 53 operazioni, EUR/USD Giornaliero 83,943 USD su 25 operazioni e GBP/USD Giornaliero 12,846.80 USD su 44 operazioni, tutti con 1 contratto.
Con 1 contratto l'esecuzione su USD/JPY è scesa di 1,041,500 JPY dal picco e GBP/USD è scesa di 11,278.40 USD. Riduci la size se questi numeri sono troppo grandi per il tuo conto.
Il divario di 7 punti tra le linee e la linea ATR a 21 bar sono tarati per movimenti lenti. Sui grafici giornalieri il sistema opera solo poche volte all'anno.
Correlati
La community ProRealAlgos ottiene le regole complete, il codice completo e il portafoglio automatizzato.