deleted_account

True Range Breakout EUR/USD

Category: Strategies By: deleted_account Created: April 18, 2017, 12:59 PM
April 18, 2017, 12:59 PM
Strategies
15 Comments
True Range Breakout EUR/USD

Simple 1 hour intraday trading strategy on EUR/USD (mini).

This automated trading strategy takes orders if the current candlestick is wider than the 12 periods average true range. Trades direction are chosen with this breakout candlestick color. If the current candlestick is green, then the trend seems bullish and a long order is initiated. If the breakout candle is red, a new bearish trend is forming and a short trade is launched at market.

It is a simple and a quite effective strategy with 3/1 risk reward ratio.

// EUR/USD(mini) - IG MARKETS
// TIME FRAME 1H
// SPREAD 2.0 PIPS

DEFPARAM CumulateOrders = False
DEFPARAM FLATBEFORE = 080000
DEFPARAM FLATAFTER = 210000

atr = AverageTrueRange[12]

// LONG
IF (abs(open-close) > (atr*2) and close > open) THEN
 BUY 1 CONTRACTS AT MARKET
 SET STOP pLOSS 40
 SET TARGET pPROFIT 120
ENDIF

//SHORT
IF (abs(open-close) > (atr*2) and close < open) THEN
 SELLSHORT 1 CONTRACTS AT MARKET
 SET STOP pLOSS 40
 SET TARGET pPROFIT 120
ENDIF

 

Download
Filename: Bildschirmfoto-2017-04-21-um-21.15.19.png
Downloads: 177
Download
Filename: true-range-breakout-EURUSD.itf
Downloads: 441
deleted_account
deleted_account New
As an architect of digital worlds, my own description remains a mystery. Think of me as an undeclared variable, existing somewhere in the code.
Author’s Profile

Comments

poonsl2828
9 years ago
#

Hi! bjoern May i know what timing should i change for time zone (Singapore (GMT +8:00) DEFPARAM FLATBEFORE =080000 DEFPARAM FLATAFTER =210000

mckubik
9 years ago
#

Thanks. I will run a Test. 

victormork
9 years ago
#

Hi, I would just like to share my own take on this strategy. I'm using 30 min on EURUSD but it works on 1H as well.

//-------------------------------------------------------------------------
// Main code : ATR breakout EURUSD 30M
//-------------------------------------------------------------------------
// EUR/USD(mini) - IG MARKETS
// TIME FRAME 30M
// SPREAD 2.0 PIPS

DEFPARAM CumulateOrders = False
DEFPARAM Preloadbars = 100
DEFPARAM FLATBEFORE = 100000
DEFPARAM FLATAFTER = 230000

once optimization = 1
once stopandtarget = 2 // 1=dynamic, 2=fixed

// VALUES
If optimization = 1 then
atrtargetlong = 1      //2
atrsllong = 1          //1
atrtargetshort = 4     //2
atrslshort = 2         //1
atrperiod = 25
atrmulit1 = 3
atrmulit2 = 2
atrtrailingstop = 1.85

elsif optimization = 2 then
atrtargetlong = 1      //2
atrsllong = 1          //1
atrtargetshort = 4     //2
atrslshort = 2         //1
atrperiod = 25
atrmulit1 = 3
atrmulit2 = 2
atrtrailingstop = 0.5
endif

// INDICATOR
atr = AverageTrueRange[atrperiod]

// LONG ENTRY
b1 = (abs(open-close) > (atr*atrmulit1))
b2 = close > open
b3 = b1 AND b2

IF b3 THEN
BUY 1 CONTRACTS AT MARKET
ENDIF

//LONG STOP AND TARGET

//Dynamic stop and target
If stopandtarget = 1 then
SET TARGET pPROFIT (atr * atrtargetlong) / pointSize
SET STOP PLOSS (atr * atrsllong) / pointSize

//Fixed stop and target
elsif stopandtarget = 2 then
SET TARGET pPROFIT 120
SET STOP PLOSS 40
ENDIF

//SHORT ENTRY
s1 = (abs(open-close) > (atr*atrmulit2))
s2 = close < open
s3 = s1 AND s2

IF s3 THEN
SELLSHORT 1 CONTRACTS AT MARKET
ENDIF

// SHORT STOP AND TARGET

//Dynamic stop and target
If stopandtarget = 1 then
SET TARGET pPROFIT (atr * atrtargetshort) / pointSize
SET STOP PLOSS (atr * atrslshort) / pointSize

//Fixed stop and target
elsif stopandtarget = 2 then
SET TARGET pPROFIT 120
SET STOP PLOSS 40
ENDIF

//trailing stop
trailingstop = (atr * atrtrailingstop) / pointSize

//resetting variables when no trades are on market
if not onmarket then
MAXPRICE = 0
MINPRICE = close
priceexit = 0
endif

//case SHORT order
if shortonmarket then
MINPRICE = MIN(MINPRICE,close) //saving the MFE of the current trade
if tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then
priceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price level
endif
endif

//case LONG order
if longonmarket then
MAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current trade
if MAXPRICE-tradeprice(1)>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then
priceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE - trailing stop price level
endif
endif

//exit on trailing stop price levels
if onmarket and priceexit>0 then
EXITSHORT AT priceexit STOP
SELL AT priceexit STOP
endif

 

Francesco78
9 years ago
#

Hi Bjoern, I have created a strategy largely based on your nice and simple idea applied on Dax, and created a forum topic for it 

https://www.prorealcode.com/topic/dax-adaptable-strategy-breackoutmean-reversion/

Many thanks

Francesco 

Francesco78
9 years ago
#

Thank you!

Francesco78
9 years ago
#

Hi Bjoern

I have added a filter in your code to avoid "choppy market" by using an oscillator defined by the difference between the 50 and the 200 moving average, divided by the close and set the condition for the abs of this indicator to be greater than x%  and optimized again.

 

// EUR/USD(mini) - IG MARKETS
// TIME FRAME 1H
// SPREAD 2.0 PIPS

DEFPARAM CumulateOrders = False
DEFPARAM FLATBEFORE =080000
DEFPARAM FLATAFTER =210000

indicator1 = Average[200](close)
indicator2 = Average[50](close)
c1 = (indicator2-indicator1)/close
c2= abs(c1)<0.012


atr = AverageTrueRange[30]

if c2 then
m = 2
profits = 130
losses = 40
// LONG
IF (abs(open-close) > (atr*m) and close > open) THEN
buy 1 CONTRACTS AT MARKET
SET STOP pLOSS losses
SET TARGET pPROFIT profits
ENDIF

//SHORT
IF (abs(open-close) > (atr*m) and close < open) THEN
sellshort 1 CONTRACTS AT MARKET
SET STOP pLOSS losses
SET TARGET pPROFIT profits
ENDIF
endif

I could only do it for the last 3 years but I got nice results so I write the code here.

 

bjoern
9 years ago
#

bjoern
9 years ago
#

Thanks! Will take a look at it!

Francesco78
9 years ago
#

Very nice.

Would it be possilbe to see the test results on the bund?

I dont have enough data on my PRT I guess its because is not a premium account...

Thanks!

bjoern
9 years ago
#

Sure, please find attached the backtest for BUND tick-by-tick

victormork
9 years ago
#

Very nice! I like the look on BUND.

bjoern
9 years ago
#

Works also good on BUND - 2H - Multiplicator 1 - TP/SL 60 for each long and short

ALE
ALE
9 years ago
#

Very Nice!

Nicolas
9 years ago
#

So simple and nice strategy. Thanks a lot for our enlightening of this particular setup bjoern! It deserves to spend some time trying to find ways to improve!

bjoern
9 years ago
#

Thanks :-)

ProRealCode ProRealCode
Loading...