Universal XBody Strategy on CAC (1Day)

Universal XBody Strategy on CAC (1Day)

Hello everyone,

I have the pleasure to share with you this simple but practical, universal daily strategy (for Forex, Indices, and Stocks), optimized on the CAC from 1992 to today. I hope that this opensource contribution can bring more developments in the field of automatic trading strategies on prorealtime, and demonstrate once and for all that a strategy to work does not necessarily have to be complicated, indeed (as I see it) the simpler it is, the more likely it is to work in the future as in the past.

  • Brief explanation

The strategy has 3 fundamental parameters to optimize primarily which are: Period, Mode, and invertsignal. Once these have been chosen, we move on to the optimization of the two filters: filter1 and filter2. Finally, if you want you can add, a stop loss based on the average true average.

Here is the code

Share this

Risk disclosure:

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 : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. Lavallette • 08/14/2023 #

    Hello David, thanks for sharing this strategy that gives good results for many different instrument types.

    A couple of questions if you don’t mind.
    The range of Filter2 is from 1-100 but the value is 0.
    Are you trading this strategy live? I’m asking as it is always on the market, the number of trades is important. With the slippage in real trading, I wonder if the results are close from the backtests.

    Talking backtests, I tried various trailing strategies but have not found a good one yet. Have you?

    If you are trading it live, are you using the parameters optimized on the whole time? I’m asking because when I try various walk-forward optimizations the results are not as good.

  2. davidelaferla • 08/14/2023 #

    Hello Lavalette! The filter interval starts from 0, and not from 1, in fact when period and mode are optimized, it must remain 0. I trade with this strategy in real and I’m not finding substantial differences with the backtest at least in this or higher timeframes of the daily . I mostly don’t use trailing, as I wrote in the post it is better to use a simple stop loss. I always use the optimized parameters especially when they work in many years of backtesting at least 10-15 years, and return a graphically constant equity.

  3. davidelaferla • 08/14/2023 #

    The most interesting finding about this strategy is that natural selection of the best parameters is observed over time, so that after a sufficiently long time the best parameter stabilizes.

  4. Ciccarelli Franco • 08/14/2023 #

    Ciao David, sto provando il tuo ottimo codice sulla coppia EUR/USD TF un giorno test esteso a 10 anni e i risultati sembrano buoni (allego foto), ma nell’ottimizzare facendo come dici tu , il valore del filtro 2 che dovrebbe essere 0 , mi da invece 28. Non ho cambiato nulla, ho solo aggiunto un SL e TP che lavorano sull’ATR.

    • davidelaferla • 08/14/2023 #

      Ciao Franco! Non riesco a vedere la foto allegata (è meglio se me la mandi tramite link) . Il valore del filtro 1 e del filtro 2 , devono rimanere a 0 solo durante l’ottimizzazione del period e del mode, infatti sono solo un perfezionamento della strategia e quindi vanno ottimizzati dopo. E’ normale che il valore del filtro 2 ottimizzato dia un valore diverso da zero, nel tuo caso 28.

  5. Ciccarelli Franco • 08/14/2023 #

    Grazie per la risposta, non riesco (o non sono capace) a mandarti il link , comunque farò come dici tu per l’ottimizzazione. Sto continuando a provare in demo, da dei buoni risultati, ma se l’entrata è sbagliata, il loss funziona solo a fine giornata ed è un guaio, si può ovviare?
    Grazie

    • davidelaferla • 08/14/2023 #

      Lo Stop loss, come anche il target profit, essendo funzioni native di prorealtime, funzionano in tempo reale e non solo a fine giornata. Chiaramente lo stop loss, può essere eseguito una sola volta a candela , e non deve interferire con il target profit, quindi controlla bene che la modalità tick per tick ti risulti 0, o comunque un numero molto basso in confronto al numero totale dei trade. Ti saluto e ti auguro profitti costanti.

  6. Ciccarelli Franco • 08/14/2023 #

    Hai ragione, mi dava valori alti perchè usavo questo loss “SET STP LOSS 1xAverageTrueRange{10} (close)”, ho provato a mettere un un semplice loss in punti e le cose sono diventate ragionevoli. Almeno questo è quello che è successo e non so il motivo, forse tu capirai.
    Grazie
    Grazie

  7. YvesRobert • 08/14/2023 #

    Hello davidelaferla, how do you put a stop loss and where exactly ? the moment you enter on the market I suppose ? how many distance with the tradeprice ?.
    I tried to find optimized parameters in low time units 1mn 5mn, 15mn, to do daytrading, but I suppose they dont remain the same from one day to another, or one week to another ?
    Thank you and have a good day

  8. Hypersimo • 08/14/2023 #

    Buongiorno Davide
    a quale distanza inserire stop loss e tp nella strategia?
    grazie

  9. beanpole • 30 days ago #

    Thank you for sharing the code. I applied it to the “CAC40 Index” on Euronext market on a daily basis from 1992, but I got slightly different results. I’m curious about what causes these differences. Please take a look at the screenshot attached and advise. screenshot –> https://ibb.co/2sfQcYV

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
YvesRobert Hello David, can you explain to me this strategy ? You calculate the difference between t...
davidelaferla The strategy calculates the variation between the body and the previous body (however in pro...
KumoNoJuzza Thanks David it looks great. I am playing with it to get familiar. Do you think it would b...
BaderBader Good day davidelaferla, Thank you for making your strategy available to the community, I do...
pdrh Bonjour WE ARE SOCIETY,Vous optimisez toujours votre Algo chaque
WE ARE SOCIETY Bonjour, je l'optimise et l'améliore chaque semaine en évitant au maximum les interdictions ...
dammon c'est un bien beau code que tu nous sors là. il m'a fallu du temps pour bien tout comprendre...
Germano77 hello, thx for sharing, but wich broker do you use? At IG I got the notification "automatic...
Musiar Hi Davide, You have done a great job: I modified a bit your strategy for Nasdaq, and now I ...
Maik2404 Musiar können sie den code des automatischen systems teilen.
Stanko Ciao Crusoe, grazie per il commento: confermo che il trailing stop non funziona bene. Provo ...
taklause I was wondering, you said it works on the 1 min Chart, but you never use it in the code as t...
Stanko Ciao taklause. Utilizzando il grafico a 1 minuto e fino al grafico a 15 minuti il codice fun...
ProRealAlgos.com Hi JohnScher. Yes I think you refer to the strategy called "Turnaround tuesday". This strate...
JohnScher I am not alluding to the turnaround tuesday. The general opinion is that Turnaroundtuesday ...
ProRealAlgos.com Yeah that's maybe not of importance. Anyway. Enjoy! :)
luxrun Hi Josè I can't load the itf calculated tool. The platform gives me an error "incorrect form...
Stanley
2 years ago
Amazon / Alibaba
Amazon / Alibaba
0
Calculated instruments
Meta Signals Pro great feature ^^
Meta Signals Pro can you detail how you did that or refer to a link ? thanks
Patrice210 bonjour STANKO, effectivement la première ligne apparait en anomalie et je ne comprend pas v...
KumoNoJuzza Hi guys, Thanks @Stanko and everyone for your contributions. I have been playing around ...
Stanko Hi KumoNoJuzza, thanks for the post. I also tried your code with Dax and the performance is ...
emism12 Looks great, personally I don't use automated trading for single stocks, but is definitely o...
adconsulting Ciao, I look that the strategy (backtest 50 k), works very good wiht US 500 CASH 1 EURO in...
Kev Monaghan The equity curve looks to follow the stock price almost perfectly, Have you tested on stock ...
woktrade Superbe !
Vonasi An updated version with a bug fix can be found here: https://www.prorealcode.com/topic/dis...
snucke hey Vonasi is it possible you can help me get this indicator to show how much a market mo...
Dom Hello, hello....je commence le trading et découvre par la même occasion le codage....et ce n...
Nicolas Merci, ça fait plaisir !
Be-n Bonjour tout le monde ! Dans l'indicateur de tendance, j'ai du mal à saisir la nuance entre ...
Giogio hello dear Vonasi, thank you for your indicator, can I ask you for some help in order to let...
Pottar24 HI Vonasi I would like to know how can this algorithm give me the value of the last max e mi...
parthapersonal Hello Vonasi, Great work. Is it possible to replicate this to get values of "Price Line" (1...
tobytarczy Hi Vonasi, Sounds lovely, I race yachts around europe myself. Most regattas cancelled unfor...
mlouys Hello Vonasi thank for your work ! A question how can we do it for minutes ( or 15 min or x ...
Vonasi I think that would be possible but probably in a whole new indicator as detecting when a new...

Top