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"