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
Iber0 Asi quedaria con el spread de IG [IMG]http://i65.tinypic.com/2418ism.jpg[/IMG]
avatar
bjoern Seems to work nice on BUND - M15 with SL 70 and TP 120
hvluthy@sunrise.ch I tried to backtest this code but don't get any restults. Can any body help me?
Nicolas Well done supertiti, nicely coded and very accurate.
Dimi.A Beautiful.
Nicolas Thank you for contribution. Please consider that advertising is tolerate as long as you cont...
triss1965@gmail.com  Hi, I cant make it work. And if you doing so much money. Why do you have to sell it? It don...
T-rader Eva... He dosen´t sell anything. He is just a nice guy that want to share on of his strategy...
Pelle Nævestad Thanks Nicolas, this is a keeper!
Chicane23 Hi, when uploaded the WAE isnt showing histogram; only line. Is there a way to modify?
Nicolas Change the way the lines are displayed in the indicator settings window : histogram, lines, ...
DerPat Like your zero lag indicators.
xel @DerPat - I don't see any question regarding the indicator.  Anyway, I think I give enough l...
diegofe_2000 Xel, tu eres el creador de este indicador? Bueno te  cuento que es muy bueno para hacer est...
xel Buen día @diegofe_2000 -  Claro, mandalo y por aquí lo probamos en otros instrumentos y si g...
CKW  Thanks Doctrading for sharing Is this Daily Time frame?  
Doctrading Hello, Yes, it is daily timeframe.
air Good job. 
verdi55 At least there should be some moving average that has also reverted into the opposite direct...
verdi55 In addition to the moving average, wait until at least one bar is completely back inside the...
rama This works excellent on range bound I tried , give 90% win rates on dax , 3 min chart. can s...
cepamoi Unfortunately, this still does not work: ONCE haOpen = medianprice haOpen = ((Open[1]+High...
Nicolas Force calculation to wait 1 bar of history already loaded: ONCE haOpen = medianprice if b...
cepamoi Now it works. Thanks a lot Nicolas! Here is the full code: // variables : // period ...

Top