TempusFugit

Breakout Failures DAX 5m

Category: Strategies By: TempusFugit Created: October 30, 2017, 8:50 AM
October 30, 2017, 8:50 AM
Strategies
7 Comments
Breakout Failures DAX 5m

This is a simple strategy, just an idea that seems to work. No MoneyManagement or Position Size. Optimized for DAX 5 minutes.

It looks for breakouts in Donchian Channel for going in the opposite direction, trying to catch breaout failures so kind of mean reversion system. There is no Stop, when the losses reach 10xATR it changes (“flip”) direction to catch the trend that seems to be forming. Also finish tradings at 20:30, kind of time stop with no overnight.

// System parameters
DEFPARAM CumulateOrders = False
DEFPARAM PRELOADBARS = 20
//DEFPARAM FLATBEFORE = 000000
DEFPARAM FLATAFTER = 203000

// Condiciones de entrada
myUpperband, myLowerband, ignored = CALL "Donchian (canal)"[8]
c1 = close < myLowerband
c2 = close > myUpperband


// Conditions for Entry of Long Positions
IF c1 AND NOT ONMARKET THEN
 BUY 1 CONTRACTS AT MARKET
ELSIF SHORTONMARKET AND (CLOSE-TRADEPRICE) > FlipPosition THEN
 BUY 1 CONTRACTS AT MARKET
ENDIF

// Conditions for Entry of Short Positions
IF c2 AND NOT ONMARKET THEN
 SELLSHORT 1 CONTRACTS AT MARKET
ELSIF LONGONMARKET AND (CLOSE-TRADEPRICE) < -FlipPosition THEN
 SELLSHORT 1 CONTRACTS AT MARKET
ENDIF


// Loss, Profit
//SET STOP LOSS 15*AverageTrueRange[10](close)
SET TARGET PROFIT 15*AverageTrueRange[12](close)
FlipPosition = 10*AverageTrueRange[12](close)

// END

Donchian channel indicator (should be set as a new indicator)

//N=10 //variable to add as an external one

IF BarIndex > N THEN
 upperBand = Highest[N](High)
 lowerBand = Lowest[N](Low)
 middleBand = (upperBand + lowerBand)/2
ELSE
 upperBand = Undefined
 lowerBand = Undefined
 middleBand = Undefined
ENDIF

RETURN upperBand[1] AS "Upper band" , lowerBand[1] AS "Lower band" , middleBand[1] COLOURED(0,255,0) AS "Middle band"

 

Download
Filename: Donchian-canal.itf
Downloads: 437
Download
Filename: DonchianReverse-DAX-5m.itf
Downloads: 544
TempusFugit
TempusFugit Veteran
Operating in the shadows, I hack problems one by one. My bio is currently encrypted by a complex algorithm. Decryption underway...
Author’s Profile

Comments

Uveus
9 years ago
#

Tempus, me da un error al validar el codigo, sobre la variable N. Al crear el indicador me pide darle valor, y luego en el codigo me dice que debe ir sin valor. gracias

TempusFugit
9 years ago
#

Hi Uveus, I am guessing you inserted the code of the indicator into the system code, is that right? If so, don´t need to, just import both the indicator and the system and run the system, it takes itself the code from the indicator. If this is not your problem I dont understand your question. --------------------------------------------------------- Te contesto en inglés porque tenemos que escribir en el mismo idioma que el foro para que todo el mundo lo entienda, si no nos dan un toque. Si no entiendes la respuesta en inglés escríbeme un correo, creo que puedes desde mi perfil y ya te contesto en español.

TempusFugit
9 years ago
#

Masala, thanks for your contribution. I don´t like the offmarket spreads neither ;) I understand your waryness of non hard stops but in this case seems to hurt the profit quite a bit. Be aware that in your code the c1 lack of ">" symbol and the c2 is missing completely ("c2=close<myLowerband")

masala
9 years ago
#

Thanks for the idea. Personally I don't like to enter trades without a hard stop and also I don't like to trade the DAX outside the official kassa times - because the spread is then wider than 1p. So my modified code looks like this: // System parameters DEFPARAM CumulateOrders = False DEFPARAM PRELOADBARS = 20 DEFPARAM FLATBEFORE = 090000 DEFPARAM FLATAFTER = 180000 STOPPER = 100 // Condiciones de entrada myUpperband, myLowerband, ignored = CALL "Donchian (canal)"[8] c1 = close myUpperband // Conditions for Entry of Long Positions IF c1 AND NOT ONMARKET THEN BUY 1 CONTRACTS AT MARKET SET STOP $LOSS STOPPER ELSIF SHORTONMARKET AND (CLOSE-TRADEPRICE) > FlipPosition THEN BUY 1 CONTRACTS AT MARKET SET STOP $LOSS STOPPER ENDIF // Conditions for Entry of Short Positions IF c2 AND NOT ONMARKET THEN SELLSHORT 1 CONTRACTS AT MARKET SET STOP $LOSS STOPPER ELSIF LONGONMARKET AND (CLOSE-TRADEPRICE) < -FlipPosition THEN SELLSHORT 1 CONTRACTS AT MARKET SET STOP $LOSS STOPPER ENDIF // Loss, Profit //SET STOP LOSS 15*AverageTrueRange[10](close) //SET TARGET PROFIT 15*AverageTrueRange[12](close) FlipPosition = 10*AverageTrueRange[14](close) // END If you see room for improvements, feel free to post here. Ah, I switched to 1min timeframe :-)

TempusFugit
9 years ago
#

My timezone is UTC+00:00... and I think that´s the backtest timezone

TempusFugit
9 years ago
#

Thanks Nicolas for adding the indicator, I somehow thougt it was one of the default indicators :)

Nicolas
9 years ago
#

The one you used is not, that's why I added it. What is the timezone for your DAX instrument please? While testing it, I did not get exactly the same results even if it was not bad at all.

ProRealCode ProRealCode
Loading...