Un'operazione richiede che SuperTrend(3, 5) cambi direzione dopo una corsa limitata, il Parabolic SAR dal lato corretto del prezzo e un movimento dell'istogramma MACD superiore a una dimensione stabilita. Una lettura smussata della pressione di acquisto e vendita deve concordare. Questa strategia non è ancora stata sottoposta a backtest.
| positionSize Size per punto | 1 |
| stMultiplier Moltiplicatore ATR del SuperTrend | 3 |
| stPeriod Lunghezza ATR del SuperTrend | 5 |
| sarStart Fattore iniziale del Parabolic SAR | 0.02 |
| sarStep Passo del Parabolic SAR | 0.02 |
| sarMax Fattore massimo del Parabolic SAR | 0.03 |
| macdFast Lunghezza MACD veloce | 12 |
| macdSlow Lunghezza MACD lenta | 26 |
| macdLineArg Terzo argomento di MACDline, come pubblicato | 150 |
| macdSignalPeriod EMA della linea MACD usata come segnale | 9 |
| lookbackPeriod Finestra per il calcolo della pressione | 100 |
| pressurePeriod Lunghezza EMA che smussa la pressione di acquisto e vendita | 500 |
| minTrendBars Il SuperTrend deve aver mantenuto il suo lato più a lungo di questo valore | 15 |
| longMacdSlope Salita minima dell'istogramma MACD per i long (punti) | 0.045 |
| shortMacdSlope Calo minimo dell'istogramma MACD per gli short (punti) | 0.186 |
| minRangePips Il range della bar precedente deve superare questo valore (pip) | 2 |
| takeProfitPoints Target di profitto (punti) | 10 |
| stopLossPoints Stop protettivo (punti) | 10 |
Il codice
// ============================================================ // SuperTrend SAR MACD // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long & short // Timeframe tested: Not yet tested // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false // --- Parameters --- positionSize = 1 // size per point stMultiplier = 3 // SuperTrend ATR multiplier stPeriod = 5 // SuperTrend ATR length sarStart = 0.02 // Parabolic SAR start factor sarStep = 0.02 // Parabolic SAR step sarMax = 0.03 // Parabolic SAR maximum factor macdFast = 12 // MACD fast length macdSlow = 26 // MACD slow length macdLineArg = 150 // third MACDline argument, as published macdSignalPeriod = 9 // EMA of the MACD line used as signal lookbackPeriod = 100 // window for the pressure calculation pressurePeriod = 500 // EMA length that smooths buy and sell pressure minTrendBars = 15 // SuperTrend must have held its side longer than this longMacdSlope = 0.045 // minimum rise of the MACD histogram for longs (points) shortMacdSlope = 0.186 // minimum fall of the MACD histogram for shorts (points) minRangePips = 2 // previous bar range must exceed this (pips) takeProfitPoints = 10 // profit target (points) stopLossPoints = 10 // protective stop (points) ONCE stNotRisingBars = 0 // bars in a row the SuperTrend has not risen ONCE stNotFallingBars = 0 // bars in a row the SuperTrend has not fallen // --- Indicators --- stValue = SuperTrend[stMultiplier, stPeriod] sarValue = SAR[sarStart, sarStep, sarMax] macdMain = MACDline[macdFast, macdSlow, macdLineArg](close) macdTrigger = ExponentialAverage[macdSignalPeriod](MACDline[macdFast, macdSlow, macdLineArg](close)) macdHistogram = macdMain - macdTrigger barRange = Range // Buying versus selling pressure over the lookback window, smoothed. channelLow = Lowest[lookbackPeriod](low) channelHigh = Highest[lookbackPeriod](high) buyPressure = 100 * (3 * close - 2 * channelLow - open[lookbackPeriod - 1]) / CustomClose sellPressure = 100 * (open[lookbackPeriod - 1] + 2 * channelHigh - 3 * close) / CustomClose pressureSpread = ExponentialAverage[pressurePeriod](buyPressure) - ExponentialAverage[pressurePeriod](sellPressure) IF stValue[2] >= stValue[1] THEN stNotRisingBars = stNotRisingBars + 1 ELSE stNotRisingBars = 0 ENDIF IF stValue[1] >= stValue[2] THEN stNotFallingBars = stNotFallingBars + 1 ELSE stNotFallingBars = 0 ENDIF
Altre 17 righe: le regole di ingresso e di uscita.
Configurazione
Domande
Il codice è scritto per ProOrder, ma non è ancora stato verificato in compilazione né sottoposto a backtest. Consideralo un punto di partenza per i tuoi test.
Nessuno ancora. I risultati saranno aggiunti una volta superata la batteria di test.
Opera con una dimensione di 1 per punto. Senza backtest non esiste ancora un valore di drawdown, quindi inizia in piccolo in demo.
Correlati
La community ProRealAlgos ottiene le regole complete, il codice completo e il portafoglio automatizzato.