@volpiemanuele
Thanks you for the file🙏.
I will try it this afternoon.👍
PaulParticipant
Master
which parameters would you then optimise?
There are many parameters, but with walk forward I focussed on the rsi stochastic, only 2 parameters, 10-50k bars, unlinked with 3 repeats. Whatever you try, likely the last week will be neutral to very bad.
@ichimoku18 yes your right that was the intend, changing it would make it worse, so I leave it at current & previous bar and removed the last part. It could be better written too.
Great, in particular which are these two parameters to optimize?
Thank you
PaulParticipant
Master
Hi,
only the first 2. Having said that i’am just a bit experimenting.
lengthrsi = 2 // rsi period
lengthstoch = 6 // stochastic period
smoothk = 4 // smooth signal of stochastic a
smoothd = 8 // smooth signal of smoothed stochastic
dax 10s today. I know it’s not realistic with the stops etc and a lot would needs to be changed, but still.
@Paul, juste for fun i launch the v5b on Dax in 10s timeframe, but il crashed.
I use Stoch/RSI a lot, it’s one of my favourite indicators, but I find that you really have to optimise all the variables as each one reacts to other changes. With most indicators you usually have a reasonable expectation that if a value of 14 is good, then 12 or 16 will be a bit better or a bit worse. With Stoch/RSI values of 12, 14, 8, 2 could look good one minute then suddenly something like 8,6,8,4 is miles better – impossible to predict the optimal result. Default values are 14,14,10,3 as a theoretical starting point.
I usually run it with variations of 4 to 16 by 2 for the first 3, and 2 to 5 by 1 for smoothd (must be >1). Unfortunately that makes +1000 permutations so it’s time consuming, but almost always worth it – can massively improve almost any algo if you get it right.
@Volpiemanuele, I tried to implement it on DJ 3 minutes and no orders showed up… Any ideas why?
@tanou: The last entry was this morning at 5am and still in progress … my live account
You simply implement it / Backtest it on Dow Jones 3 minutes or Dax ? Which UT?
Here what appears when I backtest it in 200k candles / DJ / 3min, nothing…
Restart the platform because it works, I just made a BT
It’s working now, it was coming from the positionsize
Do not hesitate to give me your feedback. I’ve worked on this, I haven’t fully optimize it for now, just had a look at the mistakes it was doing and try to eliminate them with a simple Ichimoku.
@Nonetheless & @Paul, hope you see something interesting, I think it is
// VECTORIAL MM - DJ 3m - Tanou v10
DEFPARAM CumulateOrders = false
DEFPARAM Preloadbars = 50000
//--------------------------------------------------------------------------------------------------------------------------------------------------
//Money Management
positionsize=1
//--------------------------------------------------------------------------------------------------------------------------------------------------
//HORAIRES DE TRADING
Ctime = time >= 153000 and time < 210000
//--------------------------------------------------------------------------------------------------------------------------------------------------
//STRATEGIE
//VECTEUR = CALCUL DE L'ANGLE
i1 = HistoricVolatility[10](close)
c1 = (i1 >= 0.06)
ONCE PeriodeA = 4
ONCE nbChandelierA= 30
MMA = Exponentialaverage[PeriodeA](close)
ADJASUROPPO = (MMA-MMA[nbchandelierA]) / nbChandelierA
ANGLE = (ATAN(ADJASUROPPO)) //FONCTION ARC TANGENTE
CB1 = ANGLE >= 34
CS1 = ANGLE <= - 48
//VECTEUR = CALCUL DE LA PENTE ET SA MOYENNE MOBILE
ONCE PeriodeB = 30
ONCE nbChandelierB= 35
lag = 0
MMB = Exponentialaverage[PeriodeB](close)
pente = (MMB-MMB[nbchandelierB]) / nbchandelierB
trigger = Exponentialaverage[PeriodeB+lag](pente)
CB2 = (pente > trigger) AND (pente < 0)
CS2 = (pente CROSSES UNDER trigger) AND (pente > - 0.5)
mx = average[67,0](close)
CB3 = mx > mx[1]
mx2 = average[21,0](close)
CS3 = mx2 < mx2[1]
// ichimoku
Tenkan = (highest[9](high)+lowest[9](low))/2
Kijun = (highest[26](high)+lowest[26](low))/2
SSpanA = (tenkan[26]+kijun[26])/2
SSpanB = (highest[52](high[26])+lowest[52](low[26]))/2
////chikou=close
//If SSpanA>SSpanB then
//IntervalS=SSpanA-SSpanB
//Elsif SSpanB>SSpanA then
//IntervalS=SSpanB-SSpanA
//endif
If SSpanA>SSpanB then
if open<SSpanA and open>SSpanB or close<SSpanA and close>SSpanB then
CondIchi = 0
Else
CondIchi = 1
endif
endif
If SSpanB>SSpanA then
if open>SSpanA and open<SSpanB or close>SSpanA and close<SSpanB then
CondIchi = 0
Else
CondIchi = 1
endif
endif
//--------------------------------------------------------------------------------------------------------------------------------------------------
//ENTREES EN POSITION
CONDBUY = CB1 and CB2 and CB3 and CTime and c1 and CondIchi
CONDSELL = CS1 and CS2 and CS3 and Ctime and c1 and CondIchi
VarDistIchiBuy = 6
VarDistIchiSell = 21
If CONDBUY then
DistIchiSSA = Open - SSpanA
DistIchiSSB = Open - SSpanB
CondDistIchi = DistIchiSSA >= VarDistIchiBuy AND DistIchiSSB >= VarDistIchiBuy
Endif
If CONDSELL then
DistIchiSSA = SSpanA - Open
DistIchiSSB = SSpanB - Open
CondDistIchi = DistIchiSSA >= VarDistIchiSell AND DistIchiSSB >= VarDistIchiSell
Endif
CONDBUY = CONDBUY and CondDistIchi
CONDSELL = CONDSELL and CondDistIchi
//--------------------------------------------------------------------------------------------------------------------------------------------------
//Entrée en position
//POSITION LONGUE
IF CONDBUY THEN
buy positionsize contract at market
SET STOP %LOSS 2.6
ENDIF
//POSITION COURTE
IF CONDSELL THEN
Sellshort positionsize contract at market
SET STOP %LOSS 0.6
ENDIF
//--------------------------------------------------------------------------------------------------------------------------------------------------
//SET TARGET %PROFIT 2
//Break even
breakevenPercent = 0.13
PointsToKeep = 1
startBreakeven = tradeprice(1)*(breakevenpercent/100)
once breakeven = 1//1 on - 0 off
//reset the breakevenLevel when no trade are on market
if breakeven>0 then
IF NOT ONMARKET THEN
breakevenLevel=0
ENDIF
// --- BUY SIDE ---
//test if the price have moved favourably of "startBreakeven" points already
IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven THEN
//calculate the breakevenLevel
breakevenLevel = tradeprice(1)+PointsToKeep
ENDIF
//place the new stop orders on market at breakevenLevel
IF breakevenLevel>0 THEN
SELL AT breakevenLevel STOP
ENDIF
// --- end of BUY SIDE ---
IF SHORTONMARKET AND tradeprice(1)-close>startBreakeven THEN
//calculate the breakevenLevel
breakevenLevel = tradeprice(1)-PointsToKeep
ENDIF
//place the new stop orders on market at breakevenLevel
IF breakevenLevel>0 THEN
EXITSHORT AT breakevenLevel STOP
ENDIF
endif
//--------------------------------------------------------------------------------------------------------------------------------------------------
//SL above 0 if more than X hours and positive
//if longonmarket and barindex-tradeindex>60 then
//if close-tradeprice(1)>=2 then
//sell at tradeprice(1) STOP
//endif
//endif
//
//if shortonmarket and barindex-tradeindex>40 then
//if tradeprice(1)-close>=2 then
//EXITSHORT at tradeprice(1) STOP
//endif
//endif
//--------------------------------------------------------------------------------------------------------------------------------------------------
// trailing atr stop
once trailingstoptype = 1 // trailing stop - 0 off, 1 on
once tsincrements = 0.19 // set to 0 to ignore tsincrements
once tsminatrdist = 5
once tsatrperiod = 14 // ts atr parameter
once tsminstop = 12 // ts minimum stop distance
once tssensitivity = 1 // [0]close;[1]high/low
if trailingstoptype then
if barindex=tradeindex then
trailingstoplong = 6 // ts atr distance
trailingstopshort = 3 // ts atr distance
else
if longonmarket then
if tsnewsl>0 then
if trailingstoplong>tsminatrdist then
if tsnewsl>tsnewsl[1] then
trailingstoplong=trailingstoplong
else
trailingstoplong=trailingstoplong-tsincrements
endif
else
trailingstoplong=tsminatrdist
endif
endif
endif
if shortonmarket then
if tsnewsl>0 then
if trailingstopshort>tsminatrdist then
if tsnewsl<tsnewsl[1] then
trailingstopshort=trailingstopshort
else
trailingstopshort=trailingstopshort-tsincrements
endif
else
trailingstopshort=tsminatrdist
endif
endif
endif
endif
tsatr=averagetruerange[tsatrperiod]((close/10))/1000
//tsatr=averagetruerange[tsatrperiod]((close/1)) // (forex)
tgl=round(tsatr*trailingstoplong)
tgs=round(tsatr*trailingstopshort)
if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) then
tsmaxprice=0
tsminprice=close
tsnewsl=0
endif
if tssensitivity then
tssensitivitylong=high
tssensitivityshort=low
else
tssensitivitylong=close
tssensitivityshort=close
endif
if longonmarket then
tsmaxprice=max(tsmaxprice,tssensitivitylong)
if tsmaxprice-tradeprice(1)>=tgl*pointsize then
if tsmaxprice-tradeprice(1)>=tsminstop then
tsnewsl=tsmaxprice-tgl*pointsize
else
tsnewsl=tsmaxprice-tsminstop*pointsize
endif
endif
endif
if shortonmarket then
tsminprice=min(tsminprice,tssensitivityshort)
if tradeprice(1)-tsminprice>=tgs*pointsize then
if tradeprice(1)-tsminprice>=tsminstop then
tsnewsl=tsminprice+tgs*pointsize
else
tsnewsl=tsminprice+tsminstop*pointsize
endif
endif
endif
if longonmarket then
if tsnewsl>0 then
sell at tsnewsl stop
endif
if tsnewsl>0 then
if low crosses under tsnewsl then
sell at market // when stop is rejected
endif
endif
endif
if shortonmarket then
if tsnewsl>0 then
exitshort at tsnewsl stop
endif
if tsnewsl>0 then
if high crosses over tsnewsl then
exitshort at market // when stop is rejected
endif
endif
endif
endif
if onmarket then
if dayofweek=0 and (hour=0 and minute>=57) and abs(dopen(0)-dclose(1))>50 and positionperf(0)>0 then
if shortonmarket and close>dopen(0) then
exitshort at market
endif
if longonmarket and close<dopen(0) then
sell at market
endif
endif
endif
going live for me
Nice. But the profit is in direct comparison to the V5 very low.
PaulParticipant
Master
nice work Tanou and to see another approach!
PaulParticipant
Master
I’ve worked on the entry on p5 version, it was copy & past to see what cumulative orders would do in your strategy. What’s strange is that for the short no cumulative orders happen, only for long. I haven’t put in a limit on them. (ts 0.5% for both long & short)
edit; to make it work, I removed the breakeven & atr trailingstop and put in the % trailingstop for cumulative positions.