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 • 209 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
DEIO Hi sublime06, I tank you for the compliments, but first of all I STRONGLY want to warn yo...
bertrandpinoy Bonjour Deio excusez moi je ne comprend pas le principe du SL et du TP sur votre strategie.....
bertrandpinoy bonjour avez vous un TP et SL pour cette strategie? merci
Lyam Pareil ne marche pas dommage
ahmedbouaziz89 Bonjour, quand j'ajoute le code ou le fichier dans l'outils screeners de Prorealtime je ne v...
tyvix Bonjour le code marche bien c est juste qu'il n y a pas d opportunité au moment ou vous le...
julien1978 The ADR value that is plotted intraday does not match the value of the regular ATR indicator...
Fab666 I've tried to get a fix for this also but no luck, it doesn't print the correct data as far ...
Seabiscuit Hi! With the new PRT update, this indicator does not work anymore
Nicolas Thanks for contributing to the "ichimoku section" of the prorealtime code library Don't he...
sourberry Thank you , this is a great indicator works beautifully. Could you kindly modify to scr...
pp_playaflamenca Excuse me,... reading your code about spanB: [ SenkouSpanBFutureW = (Highest[SenkouSpanPerio...
Julio Hi Doctrading, Is it possible to flip this to a "going bearish" by simply switching the cod...
Doctrading Hello, Yes, you can do it very simply...
Tarek Laaroussi Hi doctrading i am the one who sent you the email first thanks for the code . It really wo...
Fabio Anthony Terrenzio this strategy works only in a well defined trend
brosly Good afternoon I am trying to get the complete code of lex strategy made by adolfo since I s...
dreif123 hi Adolfo, is Alex Auto Trading Botindex working on DAX as well ? if so , can you post the...
Doctrading I forgot to write at the beginning :  a = 50 b = 50 These are intermediate levels Sorry
DerPat Thank you. This one could be an aid in my current research on stochastics.
Pelayo it is possible that in line 12 we should put seuilinf=-b, thaks for all
Doctrading Yes, nice idea.
noisette I tried some backtests with "9:30 MACD" with "Breakout strategy" but results are much better...
Doctrading Hello, can you send us your code ?
pata_tony Hi, i'm not able to see the indicator. Could you please help me? Thanks
Nicolas This is not an indicator but a screener, to be used with the ProScreener module.
JOKAMAURICE Le programme ne se charge pas dans PRT
Nicolas Ahah, I'm not the author of this one :) I know you are a great coder Wilko, why don't you p...
Wilko Thanks for the flattery! I will, I promise.  /F
Nicolas Still don't have seen anything from your own :) You promised me! Ahaha 
Adolfo Onrubia Ups! Sorry. Variable "S" is to set an specific Spread if needed. Could be "0", or the distan...
GraHal Hi Adolfo, big thank you for your code, but I am a bit confused. Spread is the difference b...
Meta Signals Pro Hi, For me there is a mistake here L32 maxriesgo = round(equity*riesgo) => round(equ...
Doctrading Thanks, man !
rajiwas How is it possible to add currentWeekHigh and currentWeekLow, currentWeekOpen and currentWee...
Takeshi Totally don't match the PRT basic pivots on weekly
TradSuz C'est étrange, je note donc à nouveau les deux horaires achat et vente =9H/17H, le iRSI de l...
TradSuz Merci à Doctrading pour cette trame de code super et qui marche sur d'autres supports aussi....
Bibi83 Bonsoir à tous Juste pour vous informer que j'ai enlever les conditions short et que cela ...
RobHansson Thanks for this screener. I would like the tool removed the shares that have been on the lis...
davidspain hello doctor!! amazing job. I would like to ask u if it is possible to create an indicator ...
GABRIELE1976 bonjour, je voudrais utiliser ce screener pour trouver les titres qui, à l’ouverture de la j...
Doctrading
9 years ago
Gaps screener
Gaps screener
14
Screeners
jbox Bonjour,   Je souhaite affiché affiché les gap sur le graph des prix directement J'a...
owes29 Hi what do you find are the best settings for intraday trading regards Lee  
rille66 Hi doctrading. If you wan't to change the screener to register the gap open in realtime so y...
EAxelsson Hi, shouldn´t it be or instead of and? if FiftyTwoWeekHigh = FiftyTwoWeekHigh[1] OR FiftyTwo...
qigley Line 4 has a redundant term "Close>EMA2." is not necessary as EMA2 will always be less t...
Mike.44 Thanks It a good job !
Wisko But the BUY-trigger is below the High of the first two 15min-candels?
Nicolas That's right, because what we want is to enter the market quickly and not wait for the next ...
Wisko Then I don't understand the backtest data. Yesterday (28.9.) range was from ~ 4410,5 - 4450,...

Top