This is a Multiday Strategy on FTSE 100 cfd of Ig Market- Time Frame 1 Hour
Signals are taken from QQE indicator and Universal indicator participates as filter.
The Seasonal optimization is Reiner’s Idea, that work well which we know.
The position are followed by a trailing stop.
Test result are made with FTSE 100 1 € mini Spread 2
Time Frame 1 Hour
Since 16.07.2004 to 01.11.2016
The strategy needs also 3 technical indicators that are also attached at the bottom of the post. These technical indicators are original ones found on the site and modified for the strategy.
// Definizione dei parametri del codice
DEFPARAM CumulateOrders = false // Posizioni cumulate disattivate
// define position and money management parameter
ONCE positionSize = 1
ONCE maxPositionSizeLong = 10
ONCE maxPositionSizeShort = 10
// define saisonal position multiplier >0 - long
ONCE Januaryl = 3
ONCE Februaryl = 1
ONCE Marchl = 3
ONCE Aprill = 3
ONCE Mayl = 1
ONCE Junel = 3
ONCE Julyl = 3
ONCE Augustl = 2
ONCE Septemberl = 1
ONCE Octoberl = 3
ONCE Novemberl = 3
ONCE Decemberl = 3
// saisonal pattern long position
IF CurrentMonth = 1 THEN
saisonalPatternMultiplierl = Januaryl
ELSIF CurrentMonth = 2 THEN
saisonalPatternMultiplierl = Februaryl
ELSIF CurrentMonth = 3 THEN
saisonalPatternMultiplierl = Marchl
ELSIF CurrentMonth = 4 THEN
saisonalPatternMultiplierl = Aprill
ELSIF CurrentMonth = 5 THEN
saisonalPatternMultiplierl = Mayl
ELSIF CurrentMonth = 6 THEN
saisonalPatternMultiplierl = Junel
ELSIF CurrentMonth = 7 THEN
saisonalPatternMultiplierl = Julyl
ELSIF CurrentMonth = 8 THEN
saisonalPatternMultiplierl = Augustl
ELSIF CurrentMonth = 9 THEN
saisonalPatternMultiplierl = Septemberl
ELSIF CurrentMonth = 10 THEN
saisonalPatternMultiplierl = Octoberl
ELSIF CurrentMonth = 11 THEN
saisonalPatternMultiplierl = Novemberl
ELSIF CurrentMonth = 12 THEN
saisonalPatternMultiplierl = Decemberl
ENDIF
// define saisonal position multiplier >0 short
ONCE Januarys = 3
ONCE Februarys = 1
ONCE Marchs = 3
ONCE Aprils = 1
ONCE Mays = 3
ONCE Junes = 3
ONCE Julys = 3
ONCE Augusts = 1
ONCE Septembers = 1
ONCE Octobers = 1
ONCE Novembers = 3
ONCE Decembers = 3
// saisonal pattern short position
IF CurrentMonth = 1 THEN
saisonalPatternMultipliers = Januarys
ELSIF CurrentMonth = 2 THEN
saisonalPatternMultipliers = Februarys
ELSIF CurrentMonth = 3 THEN
saisonalPatternMultipliers = Marchs
ELSIF CurrentMonth = 4 THEN
saisonalPatternMultipliers = Aprils
ELSIF CurrentMonth = 5 THEN
saisonalPatternMultipliers = Mays
ELSIF CurrentMonth = 6 THEN
saisonalPatternMultipliers = Junes
ELSIF CurrentMonth = 7 THEN
saisonalPatternMultipliers = Julys
ELSIF CurrentMonth = 8 THEN
saisonalPatternMultipliers = Augusts
ELSIF CurrentMonth = 9 THEN
saisonalPatternMultipliers = Septembers
ELSIF CurrentMonth = 10 THEN
saisonalPatternMultipliers = Octobers
ELSIF CurrentMonth = 11 THEN
saisonalPatternMultipliers = Novembers
ELSIF CurrentMonth = 12 THEN
saisonalPatternMultipliers = Decembers
ENDIF
// Condizioni per entrare su posizioni long
ignored, indicator1, ignored = CALL "QQE_QUFTSE1HBUY"
c1 = (indicator1 CROSSES OVER 50)
indicator2, ignored = CALL "UNIV_QUFTSE1H_LOW"
c2 = (indicator2 <= 0)
c3=(indicator1>66)
c4=(indicator1<35)
// Condizioni per entrare su posizioni short
ignored, indicator3, ignored = CALL "QQE_QUFTSE1HSELL"
c5 = (indicator3 CROSSES UNDER 50)
c6 = (indicator2 >= 0)
C7 = (INDICATOR3<35)
C8=(INDICATOR3>56)
IF c1 AND c2 THEN
IF saisonalPatternMultiplierl > 0 THEN // check saisonal booster setup and max position size
IF (COUNTOFPOSITION + (positionSize * saisonalPatternMultiplierl)) <= maxPositionSizeLong THEN
BUY positionSize * saisonalPatternMultiplierl CONTRACT AT MARKET
ENDIF
ELSIF saisonalPatternMultiplierl <> 0 THEN
IF (COUNTOFPOSITION + positionSize) <= maxPositionSizeLong THEN
BUY positionSize CONTRACT AT MARKET
ENDIF
endif
ENDIF
IF C3 OR C4 THEN
SELL AT MARKET
ENDIF
IF not shortonmarket and c5 AND c6 THEN
IF saisonalPatternMultipliers > 0 THEN // check saisonal booster setup and max position size
IF (COUNTOFPOSITION + (positionSize * ABS(saisonalPatternMultipliers))) <= maxPositionSizeShort THEN
SELLSHORT positionSize * ABS(saisonalPatternMultipliers) CONTRACT AT MARKET
ENDIF
ELSIF saisonalPatternMultipliers <> 0 THEN
IF (COUNTOFPOSITION + positionSize) <= maxPositionSizeLong THEN
SELLSHORT positionSize CONTRACT AT MARKET
ENDIF
ENDIF
ENDIF
IF C7 OR C8 THEN
EXITSHORT AT MARKET
ENDIF
// TRAILING STOP LOGIK
TGL =100
TGS= 100
if not onmarket then
MAXPRICE = 0
MINPRICE = close
PREZZOUSCITA = 0
ENDIF
if longonmarket then
MAXPRICE = MAX(MAXPRICE,close)
if MAXPRICE-tradeprice(1)>=TGL*pointsize then
PREZZOUSCITA = MAXPRICE-TGL*pointsize
ENDIF
ENDIF
if shortonmarket then
MINPRICE = MIN(MINPRICE,close)
if tradeprice(1)-MINPRICE>=TGS*pointsize then
PREZZOUSCITA = MINPRICE+TGS*pointsize
ENDIF
ENDIF
if onmarket and PREZZOUSCITA>0 then
EXITSHORT AT PREZZOUSCITA STOP
SELL AT PREZZOUSCITA STOP
ENDIF
ONCE maxCandlesShortWithoutProfit =85// limit short loss latest after 85 candles
// stop and profit management
posProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsize
ms = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithoutProfit
IF SHORTONMARKET AND ms THEN
EXITSHORT AT MARKET
ENDIF
set stop ploss 500
set target pprofit 250
You must be logged in to post a comment.
Hi Ale, Jan 2014 is around 2/3 of the history I have with IG, 200,000 units on spreadbet. I have just used that sample period and optimised C3, C4, C7, C8, TGL, TGS, Stop and Take Profit and the good news is that the optimised results for that period (although slightly different) makes barley any difference using those variables on the whole sample compared to your version. I will throw some more at it soon but looks good so far and in my opinion not curve fitted.
It will be interesting to see your DAX version and compare that to Pathfinder DAX as I have noticed some similarities of trades between Pathfinder FTSE version and this strategy. Would you optimise just until 2014 for example to avoid curve fitting? Confidence can then be a lot higher of success going forward. Good work Ale.
Grande ALE!
The first thing that I'd ask you is to test the strategy without optimization of the number of position x season, to define the real average gain point.
The variables optimized to run the strategy on FTSE 100 with 1h time frame are:
INDICATORS:
QQE - Rsi period - Exponential average period
UNIVERSAL - Bandedge - Whitenoise
SELL :
Overbought indicator position
EXITSHORT:
Oversold indicator position
TRAILING STOP:
Distance
STOP - TAKE PROFIT:
Distance
Hi Cosmic,
thanks for your attention, as I've mentionad above, there are a misprint in the code above, now I post the correct version.
// Definizione dei parametri del codice
DEFPARAM CumulateOrders = false // Posizioni cumulate disattivate
// define position and money management parameter
ONCE positionSize = 1
// define saisonal position multiplier >0 - long
ONCE Januaryl = 3
ONCE Februaryl = 1
ONCE Marchl = 3
ONCE Aprill = 3
ONCE Mayl = 1
ONCE Junel = 3
ONCE Julyl = 3
ONCE Augustl = 2
ONCE Septemberl = 1
ONCE Octoberl = 3
ONCE Novemberl = 3
ONCE Decemberl = 3
// saisonal pattern long position
IF CurrentMonth = 1 THEN
saisonalPatternMultiplierl = Januaryl
ELSIF CurrentMonth = 2 THEN
saisonalPatternMultiplierl = Februaryl
ELSIF CurrentMonth = 3 THEN
saisonalPatternMultiplierl = Marchl
ELSIF CurrentMonth = 4 THEN
saisonalPatternMultiplierl = Aprill
ELSIF CurrentMonth = 5 THEN
saisonalPatternMultiplierl = Mayl
ELSIF CurrentMonth = 6 THEN
saisonalPatternMultiplierl = Junel
ELSIF CurrentMonth = 7 THEN
saisonalPatternMultiplierl = Julyl
ELSIF CurrentMonth = 8 THEN
saisonalPatternMultiplierl = Augustl
ELSIF CurrentMonth = 9 THEN
saisonalPatternMultiplierl = Septemberl
ELSIF CurrentMonth = 10 THEN
saisonalPatternMultiplierl = Octoberl
ELSIF CurrentMonth = 11 THEN
saisonalPatternMultiplierl = Novemberl
ELSIF CurrentMonth = 12 THEN
saisonalPatternMultiplierl = Decemberl
ENDIF
// define saisonal position multiplier >0 short
ONCE Januarys = 3
ONCE Februarys = 1
ONCE Marchs = 3
ONCE Aprils = 1
ONCE Mays = 3
ONCE Junes = 3
ONCE Julys = 3
ONCE Augusts = 1
ONCE Septembers = 1
ONCE Octobers = 1
ONCE Novembers = 3
ONCE Decembers = 3
// saisonal pattern short position
IF CurrentMonth = 1 THEN
saisonalPatternMultipliers = Januarys
ELSIF CurrentMonth = 2 THEN
saisonalPatternMultipliers = Februarys
ELSIF CurrentMonth = 3 THEN
saisonalPatternMultipliers = Marchs
ELSIF CurrentMonth = 4 THEN
saisonalPatternMultipliers = Aprils
ELSIF CurrentMonth = 5 THEN
saisonalPatternMultipliers = Mays
ELSIF CurrentMonth = 6 THEN
saisonalPatternMultipliers = Junes
ELSIF CurrentMonth = 7 THEN
saisonalPatternMultipliers = Julys
ELSIF CurrentMonth = 8 THEN
saisonalPatternMultipliers = Augusts
ELSIF CurrentMonth = 9 THEN
saisonalPatternMultipliers = Septembers
ELSIF CurrentMonth = 10 THEN
saisonalPatternMultipliers = Octobers
ELSIF CurrentMonth = 11 THEN
saisonalPatternMultipliers = Novembers
ELSIF CurrentMonth = 12 THEN
saisonalPatternMultipliers = Decembers
ENDIF
// Condizioni per entrare su posizioni long
ignored, indicator1, ignored = CALL "QQE_QUFTSE1HBUY"
ignored, indicator3, ignored = CALL "QQE_QUFTSE1HSELL"
indicator2, ignored = CALL "UNIV_QUFTSE1H_LOW"
c1 = (indicator1 CROSSES OVER 50)
c2 = (indicator2 <= 0)
c3=(indicator1>66)
c4=(indicator1<35)
// Condizioni per entrare su posizioni short
c5 = (indicator3 CROSSES UNDER 50)
c6 = (indicator2 >= 0)
C7 = (INDICATOR3<35)
C8=(INDICATOR3>56)
IF c1 AND c2 THEN
IF saisonalPatternMultiplierl > 0 THEN // check saisonal booster setup and max position size
BUY positionSize * saisonalPatternMultiplierl CONTRACT AT MARKET
ENDIF
IF C3 OR C4 THEN
SELL AT MARKET
ENDIF
ELSIF c5 AND c6 THEN
IF saisonalPatternMultipliers > 0 THEN // check saisonal booster setup and max position size
SELLSHORT positionSize * saisonalPatternMultipliers CONTRACT AT MARKET
ENDIF
ENDIF
IF C7 OR C8 THEN
EXITSHORT AT MARKET
ENDIF
// TRAILING STOP LOGIK
TGL =100
TGS= 100
if not onmarket then
MAXPRICE = 0
MINPRICE = close
PREZZOUSCITA = 0
ENDIF
if longonmarket then
MAXPRICE = MAX(MAXPRICE,close)
if MAXPRICE-tradeprice(1)>=TGL*pointsize then
PREZZOUSCITA = MAXPRICE-TGL*pointsize
ENDIF
ENDIF
if shortonmarket then
MINPRICE = MIN(MINPRICE,close)
if tradeprice(1)-MINPRICE>=TGS*pointsize then
PREZZOUSCITA = MINPRICE+TGS*pointsize
ENDIF
ENDIF
if onmarket and PREZZOUSCITA>0 then
EXITSHORT AT PREZZOUSCITA STOP
SELL AT PREZZOUSCITA STOP
ENDIF
ONCE maxCandlesShortWithoutProfit =85// limit short loss latest after 85 candles
// stop and profit management
posProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsize
ms = posProfit < 0 AND (BarIndex - TradeIndex) >= maxCandlesShortWithoutProfit
IF SHORTONMARKET AND ms THEN
EXITSHORT AT MARKET
ENDIF
set stop ploss 500
set target pprofit 250
Thanks for sharing Ale. Can I clarify something. You have:
ONCE maxPositionSizeLong = 10 ONCE maxPositionSizeShort = 10
Surely, the max position variable can not come in to play with DEFPARAM CumulateOrders = false
It will only take a maximum position size of 3, or 6 for reversing, based on the seasonal multiplier.
Unless I am missing something, you don't need this bit of code unless DEFPARAM CumulateOrders = true
Could you also let us know what variables are optimised?
Good work, cheers.
//-------------------------------------------------------------------------
// UNIVERSAL POSTED BY NICOLAS
//-------------------------------------------------------------------------
//UNIV_QUFTSE1H_LOW
bandedge=70
whitenoise= (Close - Close[65])
if barindex>bandedge then
// super smoother filter
a1= Exp(-1.414 * 3.14159 / bandedge)
b1= 2*a1 * Cos(1.414*180 /bandedge)
c2= b1
c3= -a1 * a1
c1= 1 - c2 - c3
filt= c1 * (whitenoise + whitenoise[1])/2+ c2*filt[1] + c3*filt[1]
filt1 = filt
if ABS(filt1)>pk[1] then
pk = ABS(filt1)
else
pk = 0.991* pk[1]
endif
if pk=0 then
denom = -1
else
denom = pk
endif
if denom = -1 then
result = result[1]
else
result = filt1/pk
endif
endif
RETURN result COLOURED(200,0,255) as "PRICE ACTION", 0 as "0"
//PRC_QQE | indicator
//11.10.2016
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
// QQE_QUFTSE1HSEE
//--- parameters
RSIPeriod = 50
SF = 50
QQE=4.236
//---
WildersPeriod = RSIPeriod * 2 - 1
if barindex>WildersPeriod then
MyRsi = rsi[RSIPeriod](close)
RsiMa = exponentialaverage[SF](MyRsi)
AtrRsi = abs(RsiMa[1] - RsiMa)
MaAtrRsi = exponentialaverage[WildersPeriod](AtrRsi)
dar = exponentialaverage[WildersPeriod](MaAtrRsi) * QQE
trr=TrLevelSlow[1]
dv = trr
if RsiMA[0]<trr then
trr = RsiMA[0] + dar
if(RsiMA[1]<dv) then
if(trr>dv) then
trr=dv
endif
endif
elsif RsiMA[0]>trr then
trr = RsiMA[0] - dar
if(RsiMA[1]>dv) then
if(trr<dv) then
trr=dv
endif
endif
endif
TrLevelSlow=trr
endif
RETURN trr coloured(0,0,0) as "QQE" , RsiMA coloured(200,10,0) as "RsiSA", 50 as "level 50"
//PRC_QQE | indicator
//11.10.2016
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
// QQE_QUFTSE1HBUY
//--- parameters
RSIPeriod = 40
SF = 40
QQE=4.236
//---
WildersPeriod = RSIPeriod * 2 - 1
if barindex>WildersPeriod then
MyRsi = rsi[RSIPeriod](close)
RsiMa = exponentialaverage[SF](MyRsi)
AtrRsi = abs(RsiMa[1] - RsiMa)
MaAtrRsi = exponentialaverage[WildersPeriod](AtrRsi)
dar = exponentialaverage[WildersPeriod](MaAtrRsi) * QQE
trr=TrLevelSlow[1]
dv = trr
if RsiMA[0]<trr then
trr = RsiMA[0] + dar
if(RsiMA[1]<dv) then
if(trr>dv) then
trr=dv
endif
endif
elsif RsiMA[0]>trr then
trr = RsiMA[0] - dar
if(RsiMA[1]>dv) then
if(trr<dv) then
trr=dv
endif
endif
endif
TrLevelSlow=trr
endif
RETURN trr coloured(0,0,0) as "QQE" , RsiMA coloured(0,10,0) as "RsiSA", 50 as "level 50"
I'm new to PRT, and yet I know I need to take away the 'human emotion' from my trading - so PRT is going to be an interesting option. Although I feel that 'working' the charts and taking the max profits may prove optimal (as I have enjoyed good profits since April), I know that the human in me holds on to losses too - hence checking out PRT. I've used this strategy (thanks ALE) - and tweaked the following (time = 2 mins, TGL & TGS = 10, pprofit = 20) and this backtested looks unreal! I'm going to run my variation now for a few days on demo account, but if this gives any sign of profitable outcome, I'll definitely spend more time tweaking further... ALE, salutations to you!