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
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 |
// Definition of code parameters DEFPARAM CumulateOrders = False // Cumulating positions deactivated //optimized parameters bbperiod = 30 averageperiod = 180 bollup = BollingerUp[bbperiod](close) bolldown = BollingerDown[bbperiod](close) cl = (close >= bollup) cl = cl AND (open >= bollup) cs = (close <= bolldown) cs = cs AND (open <= bolldown) IF cs THEN buy 5 PERPOINT AT MARKET ENDIF if cl then sellshort 5 perpoint at market endif // Conditions to exit short positions aver = Average[averageperiod](close) c1 = (close CROSSES under aver) c2 = (close CROSSES over aver) IF c1 and longonmarket THEN sell AT MARKET ENDIF if c2 and shortonmarket then 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 :
Filename : download the ITF files
How to import ITF files into ProRealTime platform?
PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
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
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
Do you test it on a Demo or Real account?
real. I never used a demo account.
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?
on backtest since 2007, i don’t have very good results.
(i could’nt attach a file here)
you have the same?
thanks
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
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
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
Thanks Francesco, interesting.
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?
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.
Nice analysis, with the proposed tweak I’m seeing great performance since 2008/QE on the CAC40 Daily; not so good prior to that.
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
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.
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
Hi Francesco, nice algorithme, works with me on other markets as well !
thank you Janwd. Do you mind sharing where it works? happy new year!