This strategy uses the “TrendNoTrend indicator” (see in the library).
Once the “No Trend” phase has been identified (beta = 0), swing trading will take place: BUY MIN and SELL MAX. To do this you can use, for example, a SmoothedStochastic.
A simple SuperTrend [3,10] follows the position.
It seems to have positive results on different indices and different time frames, after optimization of the observation period.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
//optimization period: //period = 20 to 300 (default = 10) // Definizione dei parametri del codice DEFPARAM CumulateOrders = False TimeStart = time >= 000000 TimeStop = time <= 240000 // Le giornate come 1 maggio, 24, 25, 26, 30 e 31 dicembre, i sabati e le domeniche sono esclusi GiornoTrading= NOT((Month = 5 AND Day = 1) OR (Month = 12 AND (Day = 24 OR Day = 25 OR Day = 26 OR Day = 30 OR Day = 31) OR OpenDayOfWeek = 6 OR OpenDayOfWeek = 0)) ONCE SIZE = 2 // nr. contratti ONCE NDBARLIMIT = 3 // NR. OF BARS ON WHICH THE ORDER STOP REMAINS VALID ONCE PXT = Pointsize // es. per EURUSD = 0.00001; per EURJPY = 0.001 per DAX = 1 AA = period // PERIOD OF LINEAR REGRESSION AND 1° PERIOD OF STOCHASTIC --> OTTIMIZZARE FROM 20 TO 300 STEP 10 SSTOC = SmoothedStochastic[AA,AA/4](Close) SUT = SuperTrend[3,10] // TREND - NO TREND t=(LinearRegressionSlope[AA](close)-0)*SQRT(AA-2)/(STE[AA](close)/STD[AA](Barindex)) if t<1.96 then beta=0 else beta=1 endif // Condizioni per entrare long C1 = SSTOC[1] <= 30 AND SSTOC[0] > SSTOC[1] AND beta = 0 // No Trend = SWING IF C1 then OPENBUY = HIGH[0]+ 2*PXT MYINDEX = Barindex ENDIF IF Barindex >= MYINDEX + NDBARLIMIT THEN OPENBUY = 0 ENDIF IF OPENBUY > 0 AND NOT LONGONMARKET AND GiornoTrading and TimeStart and TimeStop THEN BUY SIZE CONTRACTS AT OPENBUY STOP // si fissano stoploss e targetprofit ST=((LOWEST[10](LOW))-OPENBUY)/PXT IF ST > 150 OR ST <=0 THEN // Max stoploss in point ST = 150 ENDIF SET STOP pLOSS ST ENDIF // Condizioni per uscire da posizioni Long IF LongOnMarket AND (Close[1]>SUT[1] AND Close<SUT) then // change color of supertrend = close position SELL at Market ENDIF // Condizioni per entrare short C21 = SSTOC[1] >= 70 AND SSTOC[0] < SSTOC[1] AND beta = 0 // No Trend = SWING IF C21 then OPENSELL = LOW[0]- 2*PXT MYINDEX = Barindex ENDIF IF Barindex >= MYINDEX + NDBARLIMIT THEN OPENSELL = 0 ENDIF IF OPENSELL > 0 AND NOT SHORTONMARKET AND GiornoTrading and TimeStart and TimeStop THEN SELLSHORT SIZE CONTRACTS AT OPENSELL STOP // si fissano stoploss e targetprofit ST=(OPENSELL-(HIGHEST[10](HIGH)))/PXT IF ST > 150 OR ST <= 0 THEN ST = 150 ENDIF SET STOP pLOSS ST ENDIF //Condizioni per uscire da posizioni Short IF ShortOnMarket AND (Close[1]<SUT[1] AND Close>SUT) then // change color of supertrend = close position EXITSHORT at Market ENDIF |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Thank you for sharing this strategy. Although I think the optimization should be done with Walk Forward to test its robustness, I salute the work and the idea. This strategy deserves to attract more attention than in a topic “lost” in the forum, it has its place in the library 🙂
PS: I changed your illustration picture with another one (it was too small 🙂 )
Merci pour cette stratégie. comment remplacez les variables par les valeurs fixes ?
à quel endroit dois je remplacer ? c’est le pro order qui me le demande.
At line 15 establish the value of “period”. For example: AA = 180
Sorry for lines 39 and 62 we need to set the ABS value:
39 ST = ABS ((LOWEST [10] (LOW)) – OPENBUY) / PXT
62 ST = ABS (OPENSELL- (HIGHEST [10] (HIGH))) / PXT
Bonjour merci BEAUCOUP !!!
cela fonctionne!!!
Good piece of work. I’ve tried trading in live but always falls over suggesting I haven’t loaded enough bars. I changed code to set DEFPARAM to 2000 and still suggests not enough bars on the 10 minute time frame. Any ideas as to what might be wrong? The period of linear regression is set to 240.
I ran the strategy on differents instruments and timeframes and I never encountered problems. Sorry but I have no idea how to solve your problem.
ciao Fulvio continua a dirmi di sostituire le variabili. Come posso risolvere?
scusa ma sono ignorante in materia
Con il file notrendstrategy.itf che hai scaricato puoi eseguire un probacktest sullo strumento finanziario e timeframe che preferisci e trovare il valore della variabile “period” che ti dà la migliore performance.
Se vuoi avviare l’autotrading proorder sullo strumento e time frame prescelto devi fissare alla linea 15 il valore di period (ad es. AA = 180) e cliccare sull’icona a forma di chiave inglese in alto a destra “ottimizzazione variabili” cancellare le variabili da ottimizzare (clicca sulla x rossa).
FULVIO09 • 25 days ago #
At line 15 establish the value of “period”. For example: AA = 180
avatar
FULVIO09 • 25 days ago #
Sorry for lines 39 and 62 we need to set the ABS value:
39 ST = ABS ((LOWEST [10] (LOW)) – OPENBUY) / PXT
62 ST = ABS (OPENSELL- (HIGHEST [10] (HIGH))) / PXT
Même après cette manipulation , ça ne fonctionne pas pour moi .
Pouvez vous expliquer en détail ?
Avec le file notrendstrategy.itf, vous pouvez exécuter un probacktest sur l’instrument financier et la période que vous préférez et trouver la valeur de la variable “period” qui vous offre les meilleures performances.
Si vous souhaitez démarrer le processus de négociation automatique sur l’instrument et la période choisie, vous devez fixer la valeur de period à la ligne 15 (par exemple AA = 180) et cliquer sur l’icône en forme de clé en haut à droite “optimisation variables” effacer la variable “period” à optimiser (cliquez sur la x rouge).
Hi @FULVI09,
I understand the instructions however I’m not too sure how to determine the “period” that generate the best performance, you mentioned 180 in the previous post, could you kindly explain where you got it from and what method you use to determine the “period” that generate the best performance.
Thanks for your contribution and looking forward to read your response.
Regards,
Johann.
Parfait , merci beaucoup .
Hi FULVIO09,
Nice piece of work. It seems to work very well. Does only work for INDEXES?? Have you tried it on commodities or FOREX???
Many thanks,
Hello,
It doesn’t work with me either.
However, I changed AA to 180 on line 15, added the abs functions to the 2 lines indicated 39 and 62, preloaded 2000 bars and deleted the variable to be optimized.
Has anyone found the fault since?
Thank you.