The following code looks for a close position 6 points or more below the low Bollinger line, as a secondary check it also then assesses if the current close is lower than the current day open position (US time) alongside making sure the averages 50 and 20 are positioned right for a long trade.
The stops and take profits are sized to the US Tech 100 (DFB) so I would advise caution if you decide to use this on other instruments. I’ve also experimented with different time periods and it’s safe to say that it runs best on 10 minute intervals.
As you can see from the image, the back testing has produced some very positive results and the strategy seems to be getting stronger over time as the index grows.
Naturally past results are not indictive of future results, so please use responsibly at your own risk.
//-------------------------------------------------------------------------
// Main code : Bol Bands v6
//-------------------------------------------------------------------------
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
indicator1 = BollingerDown[20](close)
c1 = (close < (indicator1)-6) //6
c3 = average[50](close) > average[20](close)
c5 = (close < dopen(0))
IF c1 and c3 and c5 THEN
BUY 1 PERPOINT AT MARKET
ENDIF
// Conditions to exit long positions
indicator2 = BollingerUp[20](close)
c2 = (close > (indicator2)+17) //16
indicator2 = AccumDistr(close)
c4 = (indicator2 < indicator2[435]) //435
IF c2 and c4 THEN
SELL AT MARKET
ENDIF
set stop ptrailing 475
set target profit 300
Looks interesting, thanks for sharing.
First thought: stoploss at 475 points? Wow, that’s a long long way to carry a bad trade – more than 3% … hmmm 🤔
Sorry, I need to get my eyes checked – there’s no stoploss at all, just the exit code.
That’s fine, but “set stop ptrailing 475″ doesn’t make sense. The trail can’t start at 475 if the target is 300
P.s. a trailing stop loss is still a stop loss, it just decreases with profit.
Yeah, got it, it’s not a type of stop I ever use and I confused it for something else. When I think of trailing stop, I want something that locks in profit once it’s moved in my favour, rather than just reducing the max loss. But it seems to work, so go for it – best of luck.
475 is the most optimal starting position. Any less and the overall gains take a hit because trades close too early, making profit but not at the maximum potential.
Hi
Thanks very much for posting, looks interesting. As this is a long only strategy, trading an index that has been in a long up trend, please could anyone with a Premium account run it on 1M bars to see how it fairs during a down turn?
I like how it performs through the volatile months (Oct – US Election, Feb – Bond rally, Mar – Hedge Fund blow). The DD in Oct was relative, but not significant in terms of performance.
Hi Thanks,
I’ve provided a more detailed view by month covering the events you mention above, naturally it’s not impervious to these events but it handles them well and there’s always a nice kickback to be had following a bad month.
thanked this post
Here with 1 Million …. not bad except the Drawdown.
Hi Sorry,
Screenshot above were from a slightly modified version. Here is a 24 month view using the code above.
thanked this post
Thanks,
Currently working on a version to handle drawdown better, would be good to get a test on that too if possible?
If you publish the new version I can always do it with 1 million bars.
Hello
The above version with 1 million bars was mistakenly done with Dow J. ….. so if it performs well with another market it is a great start to trading system.
this is with US Tech 100.
Hello