S&P 500 mean reverting strategy

S&P 500 mean reverting strategy

Dear all,

pls enjoy this little code which gives very nice results on S&P 500.

There are only 2 variables optimized (the bollinger bands and the moving average periods) , can work with several underlying.

Best regards

Francesco

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. Giorgio Ravagnani • 09/13/2017 #

    Hi Francesco,
    I’m Giorgio nice to meet you, I’ve been following you and your work for some time and i think that are really interesting what you are doing, can you explane me how does it function? I’m little confused about the operation

    Thanks so much

  2. Francesco78 • 09/13/2017 #

    Hi Giorgio! thank you. Relatively to this last strategy, it simpli take long or short position if the candle is fully above or below the bolliger band defined by bperiod and it closes the position when the price touches the average defined by averageperiod. Hope this help

  3. Giorgio Ravagnani • 09/13/2017 #

    Do you test it on a Demo or Real account?

  4. Francesco78 • 09/13/2017 #

    real. I never used a demo account.

  5. Giorgio Ravagnani • 09/13/2017 #

    I prefer test a strategy for a while but i understand your point of you.. When you decide to stop the system? When it exceed the max drawdawn of the backtest?

  6. rejo007 • 09/13/2017 #

    on backtest since 2007, i don’t have very good results.
    (i could’nt attach a file here)
    you have the same?
    thanks

  7. Francesco78 • 09/13/2017 #

    hi Rejo007. I havent tested since 2007 but I am not surpised that this stratrgy doesnt perform well im 2007 2008 and 2009 as they were very trendy. As a general rule I think one should have in the portfolio a combination of strategies, some mean reverting and some breakout

  8. robdav • 09/13/2017 #

    Hi Francesco,

    Just out of interest, do you run this live?

    If so, what period of data do you back test/walk forward it over to optimise the settings?

    How often do you re-tune it?

    Many thanks

    Rob

  9. Francesco78 • 09/13/2017 #

    Hi robdav, yes Im running it live since I posted it. Backtest/WF was for the last 3 years. I havent re tune it, I think I will do so every 6 months

  10. robdav • 09/13/2017 #

    Thanks Francesco, interesting.

  11. stefou102 • 09/13/2017 #

    I came up with a pretty similar strategy, although in my experience the following test works better:

    GoShort= close[1] > BolUp and open > BolUp and close < Bolup
    GoLong=close[1] < BolDown and open Boldown

    Any other ideas of filters to improve this?

  12. Wilko • 09/13/2017 #

    The close at MA condition does’t make much sense as this strategy will stay in market until a position is opened in the opposite direction. Try changing the exit condition to for long positions CLOSE > BOLLup and for short positions CLOSE < BOLLdown. This will give similar results to the original strategy.

    In my opinion this is the typical kind of strategy that has benefitted from the combination of QE and increased algorithmic trading activity in markets. The latter provides added short-term liquidity to market while QE adds long-term liquidity, the combination contributing to a trend towards lower risk premia. I would not want to keep trading this strategy when global QE reverses, or when global economic growth stutters.

    Many thanks for an interesting contribution! It did challenge me to some exploratory work.

    • Aaron Bennett • 09/13/2017 #

      Nice analysis, with the proposed tweak I’m seeing great performance since 2008/QE on the CAC40 Daily; not so good prior to that.

  13. danibo • 09/13/2017 #

    Hi Francesco,
    please may you explain how to reproduce your test?

    I use IG markets. Where your data come from? Also you use US 500 DFB but I can find US 550 CFD standard only. Is you TS expected to behave the same way with that?
    Thank you

    Danibo

    • Francesco78 • 09/13/2017 #

      Hi Danibo, I am not sure I undesrtand your question, you simply need to run a backtest on PRT using US 500 CFD. I am using a uk version of IG but you will find the same index on every platform.

  14. danibo • 09/13/2017 #

    Hi Francesco, thank you for replying.

    I try to be crearer. My question is:
    – what is the spread you use in backtest?
    – why can you use US 500 DFB while I can see just US 500 CFD?

    Thank you

  15. JanWd • 09/13/2017 #

    Hi Francesco, nice algorithme, works with me on other markets as well !

  16. Francesco78 • 09/13/2017 #

    thank you Janwd. Do you mind sharing where it works? happy new year!

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar

+11 more likes

Related users ' posts
swapping Oups nicolas ! je pense que tu a oublié de mettre les variables "setting" accessible en exte...
Nicolas Je viens de vérifier, elles y sont pourtant?
swapping Mea culpa, j'ai fait un bête (copier/coller) et forcément cela ne pouvait pas y être puisqu'...
Francesco78 @snucke the results are not the same because the pictures refers to a few years ago. I am no...
snucke @Francesco78 i mean the results differ when i test on my own. so im curious of what the p...
sfl still working, using with filters like : trendFilterUp=close>average[190](close) tren...
Lydia1948 Hi I really like this indicator - is it easy to change the colour of the blue dots to say g...
Nicolas Lines 23 and 24 are the Red and Blue value between 0 to 255, you can change the color of the...
flodefacebook Merci Nicolas pour cet indicateur. Très utile dans une technique de retournement.
HeikinAshi thank you for this very interesting indicator Nicolas! did you define a tradable setup fo...
jens_kittner Since 2018 this strategy leads to bankruptcy)))))))
Jan Wind You do not HAVE to run it
Brisvegas As an exersize in writing code its fine but as a tool to make money not so much . If you hap...
EchnatonX Hallo Im Demomodus bei IG habe ich das Problem, dass oft keine Orders ausgeführt werden kön...
Jan EchnatonX, nice late answer of me: Make the stop loss a percentage of the close, like 100/...
guleny Hello I made some optimization to make it better. But there are 5 transacttion which incr...
redz bonjour, comment changer les paramettre de la BB en 20 , 2.2 ? hello, how to change BB sett...
Realtime82 Hi I was wondering if it would be possible to get an alert (by sound) when the signals shows...
besserwerden Hi, i like this bollinger moz arrwos. How can I use this indicator in an screener? I want to...
juanj To follow new developments or get the latest version of this strategy please visit the forum...
tahar Hello Juan, I wanted to test Universal Strategy via a demo account on PRT but nothing happen...
BravoDelta @juanj wondering if you may help me please. I am looking for a simply strategy to use on the...
Doctrading AH ok, I think the ca3 is the same : ca3 = pB[1] < 0.2 and pB < 0.2 Best regards,
chromosome21 Hello everybody, First, thank you so much for all your advices, I'm a begginer in trading a...
bertrandpinoy bonjour j ai un probleme avec ce code modifié, apparement PRT ne veut pas...avez vous une so...
Nicolas No sorry, please use this file instead into a prorealtime trading platform.
rdabbs I just installed this indicator. It opens in its own pane rather than overlaid on the chart ...
Nicolas Just apply it on your price chart instead and you're ok.
DANY overfit
fatlung Excuse me. I would like to the time zone applied to this strategy.
UkCoopDownUnder Hi, ProOrder does not recognise, "avfullnessthreshold" any ideas, thanks
gackeen Scusa Pier, scusate tutti, sono nuovo. Ho caricato il file e mi viene restituito il messaggi...
JR1976 HI Nicolas , I tried to copy paste but not import directly and the code works well I hav...
mcosta This code doesn't work on 10.3 platform(IG), neither with copy/paste nor with itf import, an...
Nicolas Thanks for sharing your automated trading strategy idea. Even if you accumulate loosing orde...
Maz Ok. Potential here to build onto this. Have opened a forum thread for further discussion: h...
Nicolas An answer to a query that has been posted in the squeeze indicator: https://www.prorealcode....
Jodal Bonjour Nicolas, Merci pour cet indicateur! Est-ce possible de configurer une alerte pou...
Nicolas Merci pour le post dans le forum en respectant les règles de publication énoncées dans le ca...
Dron De lo mejorcito
Nicolas Rien, il faut l'appliquer sur la charte. Soit le mettre sur le graphique du prix, à l'aide d...
signorini Merci pour votre réponse. Je l'applique sur la charte, j'utilise la petite clé pour effacer ...
signorini Je vous remercie, Nicolas. C'est fixé. Très bon week-end.
Abz  hi , you need to add the indicator from the "price" menu in chart
Francesco Thank you Abz!
phanz Hi Nicolas, this is an interesting strategy. For long position, I assume entry when prices ...
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...
diegofe_2000 vamos a probarlo

Top