This version is DJI 1H and 24H.
The graph is good, but it can’t run in live.
The stop notice said negative or zero parameter and attached.
Anyone can help?
Thanks.
Line 241:
tsatr=averagetruerange[tsatrperiod]((close/4.8))/1000
tsatrperiod is equal to 0 at line 204:
once tsatrperiod = 0 // ts atr parameter
You should set a period of calculation for this indicator 🙂
I integrate the ML code and open this error… Paul
I integrate the ML code and open this error… Paul
It’s not an error, you just have to define those variables.
Yes, i see.
But, what define this variables??
PaulParticipant
Master
Fran55, better use the code posted in the Machine Learning topic on page one for one variable and see how that works.
https://www.prorealcode.com/topic/machine-learning-in-proorder/#post-121059
Hi, All
Recently the result is not good in DAX, DJI market 🙁
how about you?
Hi, All
Recently the result is not good in DAX, DJI market 🙁
how about you?
I’m still testing it in demo but the results in DJ are very good last 10 days
I think this is normal as the price is in full bullish divergence.
Hello guys,
Lets’ make this discussion active again! 😀
As I now have 1M candles available for the backtest I’ve optimised it and changes few settings and here is where I am currently.
I am trying to get the curve as clean as possible since mid-june 2016 as it is (in my opinion) enough to optimise and represents well enough the market conditions with the volumes that we have nowadays.
Here is the code where it stand at the moment, could you test it on your side and tell me what you think that could be change / improve / optimise? I ran out of idea and I’ve worked quite a long time on it so I need an exterior opinion I guess 😉
Feel free to tell what you think and what’s you have in mind! It could be a good path to explore! 😀
PS. I am working on another code that I’ll released when it’ll be ready in my opinion based on ichimoku quite only 😉
THANKS GUYS! 😀
//-------------------------------------------------------------------------
// Code principal : DJI Tanou V13
//-------------------------------------------------------------------------
DEFPARAM CumulateOrders = false
DEFPARAM Preloadbars = 50000
//--------------------------------------------------------------------------------------------------------------------------------------------------
//Money Management
positionsize=1
//--------------------------------------------------------------------------------------------------------------------------------------------------
//HORAIRES DE TRADING
Ctime = time >= 153000 and time < 220000
//--------------------------------------------------------------------------------------------------------------------------------------------------
//STRATEGIE
//VECTEUR = CALCUL DE L'ANGLE
//i1 = HistoricVolatility[10](close)
//c1 = (i1 >= 0.06)
ONCE PeriodeA = 3
ONCE nbChandelierA= 30
MMA = Exponentialaverage[PeriodeA](close)
ADJASUROPPO = (MMA-MMA[nbchandelierA]) / nbChandelierA
ANGLE = (ATAN(ADJASUROPPO)) //FONCTION ARC TANGENTE
CB1 = ANGLE >= 37
CS1 = ANGLE <= - 47
//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.4)
CS2 = (pente CROSSES UNDER trigger) AND (pente > -0.9)
mx = average[41,0](close)
CB3 = mx > mx[1]
mx2 = average[58,0](close)
CS3 = mx2 < mx2[1]
// ichimoku
//Tenkan = (highest[9](high)+lowest[9](low))/2
Kijun = (highest[26](high)+lowest[26](low))/2
SSpanB = (highest[52](high[26])+lowest[52](low[26]))/2
////chikou=close
If Kijun[1] = Kijun then
Condichi2 = 0
Else
Condichi2 = 1
Endif
//--------------------------------------------------------------------------------------------------------------------------------------------------
//ENTREES EN POSITION
VarDistIchiBuy = 14
VarDistIchiSell = 1
DistIchiSSB = Open - SSpanB
If DistIchiSSB >= VarDistIchiBuy then
CondDistIchil = 1
Else
CondDistIchil = 0
Endif
If DistIchiSSB <= VarDistIchiSell then
CondDistIchis = 1
Else
CondDistIchis = 0
Endif
//RSI Dynamic
//RSIDyna1 = RSI[14](close)
//RSIDyna2 = DynamicZoneRSIUp[14,20](close)
//RSIDyna3 = DynamicZoneRSIDown[14,20](close)
//RSIDL1 = RSIDyna1 <= 61.5
//RSIDL2 = RSIDyna2 <=58
//RSIDL3 = RSIDyna3 <= 53.8
//RSIDL4 = RSIDyna1>RSIDyna2
//RSIDL5 = RSIDyna2>RSIDyna3
//RSIDL = RSIDL3
//RSIDS1 = RSIDyna1 <= 30.15
//RSIDS2 = RSIDyna2 >=49
//RSIDS3 = RSIDyna3 >= 38
//RSIDS4 = RSIDyna2>RSIDyna3
//RSIDS5 = RSIDyna3>RSIDyna1
//RSIDS = RSIDS4 and RSIDS5
CONDBUY = CB1 and CB2 and CB3 and CTime and CondDistIchil and condichi2
CONDSELL = CS1 and CS2 and CS3 and Ctime and CondDistIchis and condichi2
//--------------------------------------------------------------------------------------------------------------------------------------------------
//Entrée en position
//POSITION LONGUE
IF CONDBUY THEN
buy positionsize contract at market
SET STOP %LOSS 2.4
ENDIF
//POSITION COURTE
IF CONDSELL THEN
Sellshort positionsize contract at market
SET STOP %LOSS 0.8
ENDIF
//--------------------------------------------------------------------------------------------------------------------------------------------------
//SET TARGET %PROFIT 2
//Break even
breakevenPercent = 0.19
PointsToKeep = 4
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 = 3 // 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
Is that with walk forward testing?
I feel having distance variables on top of angle and slope variables(which are already prone to cruve fitting) are too many entry variables.
Hello @mononochrome, it’s not forward testing, you can do it if you’d like to!
I don’t get what you mean the rest of your message sorry…
If you look at most of the trades they dont follow the immediate direction of the entries, esp since this is a short time frame.
Having a wide stoploss in an upward trending market you could potentially enter anywhere with the same exit strategy and seem profitable on a backtest.
Maybe using volume couldhelp to catch those short term direction movements?
I thank balmora for the angle code. I know its very useful but i just dont know yet how to use it!
I’ve worked quite a long time on it
Nice one Tanou, thank you for sharing!
I’ve set your version going on Demo Forward Test.
I will report back with any improvements.
Nice one re your Dashboard layout! 🙂
I’m going to try out your layout in place of mine as yours looks easier / quicker to adapt from the standard PRT PreDefined settings.
PaulParticipant
Master
hi Tanou thnx for sharing.
Maybe there is some gain to be made when the breakeven is never triggered. Because then, the market could reverse and hit a big stoploss. It’s something i’am testing. Maybe channels.
There’s an unbalance for long & short trades, as long is hit more that short.
I”ve mentioned it before somewhere,
CB2 = (pente > trigger) AND (pente < 0.4)
replaced with, similar as to short,
CB2 = (pente crosses over trigger) AND (pente < 0.4)
winratio goes over 90%(100k) but total results go down a bit, equitycurve looks sweet 500k bars.