juanj

Bollinger200 TrendCatcher 15min

Category: Strategies By: juanj Created: January 31, 2018, 10:14 AM
January 31, 2018, 10:14 AM
Strategies
3 Comments
Bollinger200 TrendCatcher 15min

So I recently got the idea of using Bollinger Bands in conjunction with the 200MA to identify a trend. I found that during choppy periods on when a market is consolidating the 200MA tends to stay within the Bollinger Bands. Once the Bollinger Bands clear the 200MA I enter a position on the first pullback to the 20MA.

Exits are triggered on the first pullback to the 20MA once a close beyond the 50MA is registered.

I also added a plain SL and TP, this can be optimized along with the Deviations variable

The included example is based on EURUSD 15min with a spread of 0.8

Defparam cumulateorders = False
Defparam preloadbars = 300

CurvePeriod = 250
Type = 0
 
Capital = 10000
Equity = Capital + StrategyProfit
EquityCurve = Average[CurvePeriod,Type](Equity)

possize = 1

MA20 = Average[20](close)
MA50 = Average[50](close)
MA200 = Average[200](close)

Deviations = 2.4
PER = 42//Periods

PRICE  = LOG(customclose)
alpha  = 2/(PER+1)

if barindex < PER then
 EWMA = AVERAGE[3](PRICE)
else
 EWMA = alpha * PRICE + (1-alpha)*EWMA
endif

error = PRICE - EWMA
dev   = SQUARE(error)
if barindex < PER+1 then
 var  = dev
else
 var   = alpha * dev + (1-alpha) * var
endif
ESD   = SQRT(var)

BollU = EXP(EWMA + (DEVIATIONS*ESD))
BollL = EXP(EWMA - (DEVIATIONS*ESD))

once LT = 0
once ST = 0

If LT = 1 and BollL < MA200 Then
 LT = 0
ElsIf ST = 1 and BollU > MA200 Then
 ST = 0
EndIf

If countofposition = 0 and (barindex < curveperiod or (barindex > curveperiod and equity >= equitycurve)) and LT = 0 and BollL > MA200 and close <= MA20 Then
 Buy possize contract at market
 LT = 1
 LE = 0
ElsIf countofposition = 0 and (barindex < curveperiod or (barindex > curveperiod and equity >= equitycurve)) and ST = 0 and BollU < MA200 and close >= MA20 Then
 Sellshort possize contract at market
 ST = 1
 SE = 0
EndIf

If longonmarket and LE = 0 and close > MA20 Then
 LE = 1
ElsIf shortonmarket and SE = 0 and close < MA20 Then
 SE = 1
EndIf

If longonmarket and LE = 2 and close > MA20 Then
 Sell at market
ElsIf shortonmarket and SE = 2 and close < MA20 Then
 Exitshort at market
ElsIf longonmarket and LE = 1 and close < MA50 Then
 LE = 2
ElsIf shortonmarket and SE = 1 and close > MA50 Then
 SE = 2
EndIf

SET STOP $Loss 40*possize
SET TARGET $PROFIT 130*possize

Download
Filename: Bolll200-TrendCatcher-15min.itf
Downloads: 645
Download
Filename: Boll200-TrendCatcher-15m.png
Downloads: 326
juanj
juanj Master
My name is Juan Jacobs and I am an algorithmic trader and trading coach. After 7 years of corporate work as a Systems Analyst, I have decided to pursue my passion of trading on a full-time basis. My current focus area is that of 'smart' strategies based on 'Machine Learning'. You can find me at www.FXautomate.com or visit my PRC Marketplace Store here: https://market.prorealcode.com/store/fxautomate/
Author’s Profile

Comments

GraHal
9 years ago
#

I noted above does okay on DAX 10 min with even a reduction to 30 of the Stop Loss. I've set it going, I'll let you know how it goes. Thank You GraHal

Kris75
8 years ago
#

Hi Grahal, What about making the same great work you did with the snipet on google doc but with strategies performance on different asset? Wouldn't it be a great way to discard some strategies ? Best, Chris

juanj
9 years ago
#

This gets me thinking about creating a strategy on the 5min timeframe that only takes trades in the direction of the trend when the 200MA is clear of the Bollinger on the 1 hour (or above) timeframe. This should drastically improve your odds of trading into the direction of a strong trend. Still eagerly waiting for multi timeframe support

ProRealCode ProRealCode
Loading...