Hi guys,
I want to share one of my DAX trading ideas based on simple daily, weekly and monthly high/low crossings. I observed that simple cross over and cross under of daily/weekly/monthly high/lows in combination with a multiple smoothed average and some simple filters could be a profitable approach. On the long side the cumulation of orders could be a performance booster for this system.
Comments and suggestions for improvement are welcome.
Have fun
Reiner
// Pathfinder DAX 4H, 9-22, 2 points spread
// DAX breakout system triggered by previous daily, weekly and monthly high/low crossings
// Version 3
// ProOrder code parameter
DEFPARAM CUMULATEORDERS = true // cumulate orders if not turned off
DEFPARAM PRELOADBARS = 10000
// trading window 8-22
ONCE startTime = 80000
ONCE endTime = 220000
// smoothed average parameter (signalline)
ONCE periodFirstMA = 5
ONCE periodSecondMA = 10
ONCE periodThirdMA = 3
// filter parameter
ONCE periodLongMA = 250
ONCE periodShortMA = 50
// trading paramter
ONCE PositionSize = 1
// money and position management parameter
ONCE stoppLoss = 5 // in %
ONCE takeProfitLong = 2 // in %
ONCE takeProfitShort = 1.75 // in %
ONCE maxCandlesLongWithProfit = 18 // take long profit latest after 18 candles
ONCE maxCandlesShortWithProfit = 13 // take short profit latest after 13 candles
ONCE maxCandlesLongWithoutProfit = 30 // limit long loss latest after 30 candles
ONCE maxCandlesShortWithoutProfit = 25 // limit short loss latest after 25 candles
ONCE startShortPattern = 4 // April
ONCE endShortPattern = 9 // September
ONCE longPositionMultiplier = 2 // multiplier for long position size in case of higher saisonal probability
ONCE shortPositionMultiplier = 2 // multiplier for short position size in case of higher saisonal probability
// calculate daily high/low
dailyHigh = DHigh(1)
dailyLow = DLow(1)
// calculate weekly high/low
If DayOfWeek < DayOfWeek[1] then
weeklyHigh = Highest[BarIndex - lastWeekBarIndex](dailyHigh)
lastWeekBarIndex = BarIndex
ENDIF
// calculate monthly high/low
If Month <> Month[1] then
monthlyHigh = Highest[BarIndex - lastMonthBarIndex](dailyHigh)
monthlyLow = Lowest[BarIndex - lastMonthBarIndex](dailyLow)
lastMonthBarIndex = BarIndex
ENDIF
// calculate signalline with multiple smoothed averages
firstMA = WilderAverage[periodFirstMA](close)
secondMA = TimeSeriesAverage[periodSecondMA](firstMA)
signalline = TimeSeriesAverage[periodThirdMA](secondMA)
// trade only in trading window 8-22
IF Time >= startTime AND Time <= endTime THEN
// filter criteria because not every breakout is profitable
c1 = close > Average[periodLongMA](close)
c2 = close < Average[periodLongMA](close)
c3 = close > Average[periodShortMA](close)
c4 = close < Average[periodShortMA](close)
// saisonal pattern
saisonalShortPattern = CurrentMonth >= startShortPattern AND CurrentMonth <= endShortPattern
// long position conditions
l1 = signalline CROSSES OVER monthlyHigh
l2 = signalline CROSSES OVER weeklyHigh
l3 = signalline CROSSES OVER dailyHigh
l4 = signalline CROSSES OVER monthlyLow
// short position conditions
s1 = signalline CROSSES UNDER monthlyHigh
s2 = signalline CROSSES UNDER monthlyLow
s3 = signalline CROSSES UNDER dailyLow
// long entry
IF ( l1 OR l4 OR l2 OR (l3 AND c2) ) THEN // cumulate orders for long trades
IF not saisonalShortPattern THEN
BUY PositionSize * longPositionMultiplier CONTRACT AT MARKET
ELSE
BUY PositionSize CONTRACT AT MARKET
ENDIF
takeProfit = takeProfitLong
ENDIF
// short entry
IF NOT SHORTONMARKET AND ( (s1 AND c3) OR (s2 AND c4) OR (s3 AND c1) ) THEN // no cumulation for short trades
IF saisonalShortPattern THEN
SELLSHORT positionSize * shortPositionMultiplier CONTRACT AT MARKET
ELSE
SELLSHORT positionSize CONTRACT AT MARKET
ENDIF
takeProfit = takeProfitShort
ENDIF
// stop and profit management
posProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsize
m1 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithProfit
m2 = posProfit > 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithProfit
m3 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesLongWithoutProfit
m4 = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithoutProfit
IF LONGONMARKET AND (m1 OR m3) THEN
SELL AT MARKET
ENDIF
IF SHORTONMARKET AND (m2 OR m4) THEN
EXITSHORT AT MARKET
ENDIF
SET STOP %LOSS stoppLoss
SET TARGET %PROFIT takeProfit
ENDIF
Many other instruments and continuously updated versions are available in the dedicated forum topic of this automated trading strategy, everyone can read and participate here: Pathfinder trading strategy forum topic