ProRealCode - Trading & Coding with ProRealTime™
I also get the tbt warning on v4. I was reading through previous comments and found a comment by fifi that the tbt earning has to do with the “stop” within the buy and sellshort code. I’ll continue to do my research on this but my coding skills are not as sophisticated as yours!
I am completely convinced that results like the v3 Dow 47k in my 3rd screenshot here: https://www.prorealcode.com/topic/machine-learning-in-proorder/page/20/#post-128205
are being achieved ONLY by PRT failing to do a tick by tick (tbt) test and without actually INFORMING you that it is not being done. That’s why when I came back after lunch and re-tested with the same v3 code the results were far worse and I started to get tbt warnings (even though I had no tbt warnings before I posted my great results before I stopped for lunch).
PRT is really not doing a tbt test like you think it is. But worse it’s also not informing you that it’s not doing a tbt test! So it gives you “great results” as if you had done a tbt test but there’s not always a warning that it’s relaunching in the background without doing a tbt test.
Does this sound possible/familiar @Nicolas? I ask because I have no other way of describing the erratic results. And I take screenshots of every result precisely because of these discrepancies I’ve experienced with PRT results. And btw, for the record, I am not putting PRT down: I think the s/ware is absolutely amazing. The sheer range of markets, the layout and the attention to detail, it’s just that I wish it was more consistent.
Did it give you a tbt warning during that 47k Dow backtest?
I don’t know anymore! I’ve seen plenty and deleted that version meanwhile. But you should have the same results as I do and you had. Seems like it stored something in a cache? More important, do you get the same results on v4 as I do?
With v4 2000 daily units I get the message, but not with 1500 (from june 2015) . That’s oke and loadingtimes are long enough.
I get a tbt warning even from 30/06/2015 Dow (2000 units). I then get unrealistic results without tbt.
I think going forward if you see results like 71% Win and 19.5 Gain/Loss with perfect equity curves then it’s fake. The system didn’t warn you that it turned off tbt testing or that something stopped it doing a tbt test. Alternatively… which I have been doing, is only testing over the last 1 or 2yrs and even just this year. As long as the trade number is over 30 that should give statistically significant results.
mmm, I tried again, 2000k units daily
there’s a link to mode setting. At zero I don’t get a message and it goes back to nov 2013 no problem.
setting mode to 1 I do get a message
there’s a link to mode setting.
Mode? There’s mode used in the ML code but you’re talking about a link, where’s that setting? Cheers.
How can you set the Renko ML systems on Demo if it gives a warning about variables? I assume it means the variable ValueX for the stop loss at the bottom of the code? Pls see image:
where’s that setting?
In v4 near the top. Got me worried a moment the same variable is used in the ml engine. It uses mode1 en mode2 fortunately!
warning about variables
Close the strategy & reload.
Interesting, let us now how that version goes if its rejected or not !
Paul, it’s fine with Mode = 0 (no 20 point min stop) 2 yrs daily Dow and no tbt relaunch warning. I mentioned yesterday that I was finding this too, that small values were causing a tbt relaunch without tbt testing: https://www.prorealcode.com/topic/machine-learning-in-proorder/page/19/#post-128108
No, I still can’t launch the rebooted Renko ML1 StpLoss system because of that trailing stop ValueX in the image above. Why do you think that is? I assume you’ve put some of these ML systems on demo with no probs?
I have also had tbt warnings and relaunches without tbt just from deleting out the optimisation variables in the top of a system. Nothing else was changed but the backtest threw up a warning that tbt was now not possible…
Sorry to tag you twice @Nicolas, just wondering how to stop these fantasy equity curves (pls see image) with these Machine Learning backtests? The results are too good. Therefore it is not backtesting with tick by tick data (tbt) is it? I get no relaunch warning saying it’s going to now do the backtest without tbt data either. So… how can you trust these results? It would be greatly appreciated if you can get to the bottom of this and figure out what is happening!? System itf attached.
i’ve loaded that strategy on 2000k units daily.
This is what’s happening, tick by tick is activated and you have checked keep window open.
you press test and get the message about 1 or more candles could no be examined with tick data etc.
you press restart without tick, however the window with the code is still open and it has still that check that it’s tested with tick by tick and have this fantasy chart but it’s not
do it another way, remove the check to keep window open
check probacktest in tick by tick and to the test.
You get the same warning & fantasy chart, open the code via the equitychart and you see there was no check with tick by tick mode.
No, I still can’t launch the rebooted Renko ML1 StpLoss system
Indeed, didn’t expect that.No variables, reloaded but still the message. Create a new blanco strategy and copy the code in there. That fixed it for me.
this combination of stoploss & trailing stop doesn’t work in proorder.
can’t put them in separate rows. So it’s back to the old fashioned trailing stops!
added a % trailingstop, but results are not so nice anymore without the built-in ts.
I played around with settings Paul and simplified the entry and exit and re-added Reset Period for better performance. I’ll check out your latest v4 TS tonight or tomorrow. Cheers for posting it!
Is Once ValueX and Once ValueY doing anything?
I also wonder with the fact that starting value =40 and max value = 50 how can the green graph show a ValueX and ValueY Boxsize to be smaller than that, at 20 and 10 respectively in this screenshot 1 below:? The gap between that starting value and max value is the basis of the ML stepping through values to find the right ones.. unless from optimisations and experience you can narrow it down to 40 to 50 boxsize from the get go. (It seems, based on optimisations to be 10 and 20 for both the BoxSize and the Trailing Stop).
//-------------------------------------------------------------------------
//main code : Paul/Bard Renko 1M ML2 v4b machine learning (ml2)
MLx2 applied to Long and Short Boxsize
//https://www.prorealcode.com/topic/machine-learning-in-proorder/page/3/#post-121130
//-------------------------------------------------------------------------
//https://www.prorealcode.com/topic/why-is-backtesting-so-unreliable/#post-110889
//definition of code parameters
defparam cumulateorders = false // cumulating positions deactivated
defparam preloadbars = 1000
//once mode = 0//1 // [0] with minimum distance stop; [1] without
//once minstopdistance = 20
//once percentage = 0 // [1] percentage; [0] points
//Money Management
//Capital = 10000 + strategyprofit //Current profit made by the closed trades of the running strategy.
N = 1//30*Capital / Close
heuristicscyclelimit = 2
once heuristicscycle = 0
once heuristicsalgo1 = 1
once heuristicsalgo2 = 0
if heuristicscycle >= heuristicscyclelimit then
if heuristicsalgo1 = 1 then
heuristicsalgo2 = 1
heuristicsalgo1 = 0
elsif heuristicsalgo2 = 1 then
heuristicsalgo1 = 1
heuristicsalgo2 = 0
endif
heuristicscycle = 0
else
once valuex = startingvalue
once valuey = startingvalue2
endif
if heuristicsalgo1 = 1 then
//heuristics algorithm 1 start
if (onmarket[1] = 1 and onmarket = 0) or (longonmarket[1] = 1 and longonmarket and countoflongshares < countoflongshares[1]) or (longonmarket[1] = 1 and longonmarket and countoflongshares > countoflongshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares < countofshortshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares > countofshortshares[1]) or (longonmarket[1] and shortonmarket) or (shortonmarket[1] and longonmarket) then
optimise = optimise + 1
endif
//Settings 1 & 2
startingvalue = 40 //5, 100, 10 //LONG BOXSIZE
ResetPeriod = 3 //1, 0.5 Specify no of months after which to reset optimisation
increment = 10 //5, 20, 10
maxincrement = 20 //5, 10 limit of no of increments either up or down
reps = 3 //1 number of trades to use for analysis //2
maxvalue = 50 //50, 20, 300, 150 //maximum allowed value
minvalue = increment //15, 5, minimum allowed value
startingvalue2 = 40 //5, 100, 50 //SHORT BOXSIZE
ResetPeriod2 = 3 //1, 0.5 Specify no of months after which to reset optimisation
increment2 = 10 //5, 10
maxincrement2 = 20 //1, 30 limit of no of increments either up/down //4
reps2 = 3 //1, 2 nos of trades to use for analysis //3
maxvalue2 = 50 //50, 20, 300, 200 maximum allowed value
minvalue2 = increment //15, 5, minimum allowed value
once monthinit = month
once yearinit = year
If (year = yearinit and month = (monthinit + ResetPeriod)) or (year = (yearinit + 1) and ((12 - monthinit) + month = ResetPeriod)) Then
ValueX = StartingValue
WinCountB = 0
StratAvgB = 0
BestA = 0
BestB = 0
monthinit = month
yearinit = year
EndIf
once valuex = startingvalue
once pincpos = 1 //positive increment position
once nincpos = 1 //negative increment position
once optimise = 0 //initialize heuristicks engine counter (must be incremented at position start or exit)
once mode1 = 1 //switches between negative and positive increments
//once wincountb = 3 //initialize best win count
//graph wincountb coloured (0,0,0) as "wincountb"
//once stratavgb = 4353 //initialize best avg strategy profit
//graph stratavgb coloured (0,0,0) as "stratavgb"
if optimise = reps then
wincounta = 0 //initialize current win count
stratavga = 0 //initialize current avg strategy profit
heuristicscycle = heuristicscycle + 1
for i = 1 to reps do
if positionperf(i) > 0 then
wincounta = wincounta + 1 //increment current wincount
endif
stratavga = stratavga + (((positionperf(i)*countofposition[i]*close)*-1)*-1)
next
stratavga = stratavga/reps //calculate current avg strategy profit
//graph (positionperf(1)*countofposition[1]*100000)*-1 as "posperf1"
//graph (positionperf(2)*countofposition[2]*100000)*-1 as "posperf2"
//graph stratavga*-1 as "stratavga"
//once besta = 300
//graph besta coloured (0,0,0) as "besta"
if stratavga >= stratavgb then
stratavgb = stratavga //update best strategy profit
besta = valuex
endif
//once bestb = 300
//graph bestb coloured (0,0,0) as "bestb"
if wincounta >= wincountb then
wincountb = wincounta //update best win count
bestb = valuex
endif
if wincounta > wincountb and stratavga > stratavgb then
mode1 = 0
elsif wincounta < wincountb and stratavga < stratavgb and mode1 = 1 then
valuex = valuex - (increment*nincpos)
nincpos = nincpos + 1
mode1 = 2
elsif wincounta >= wincountb or stratavga >= stratavgb and mode1 = 1 then
valuex = valuex + (increment*pincpos)
pincpos = pincpos + 1
mode1 = 1
elsif wincounta < wincountb and stratavga < stratavgb and mode1 = 2 then
valuex = valuex + (increment*pincpos)
pincpos = pincpos + 1
mode1 = 1
elsif wincounta >= wincountb or stratavga >= stratavgb and mode1 = 2 then
valuex = valuex - (increment*nincpos)
nincpos = nincpos + 1
mode1 = 2
endif
if nincpos > maxincrement or pincpos > maxincrement then
if besta = bestb then
valuex = besta
else
if reps >= 10 then
weightedscore = 10
else
weightedscore = round((reps/100)*100)
endif
valuex = round(((besta*(20-weightedscore)) + (bestb*weightedscore))/20) //lower reps = less weight assigned to win%
endif
nincpos = 1
pincpos = 1
elsif valuex > maxvalue then
valuex = maxvalue
elsif valuex < minvalue then
valuex = minvalue
endif
optimise = 0
endif
// heuristics algorithm 1 end
elsif heuristicsalgo2 = 1 then
// heuristics algorithm 2 start
if (onmarket[1] = 1 and onmarket = 0) or (longonmarket[1] = 1 and longonmarket and countoflongshares < countoflongshares[1]) or (longonmarket[1] = 1 and longonmarket and countoflongshares > countoflongshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares < countofshortshares[1]) or (shortonmarket[1] = 1 and shortonmarket and countofshortshares > countofshortshares[1]) or (longonmarket[1] and shortonmarket) or (shortonmarket[1] and longonmarket) then
optimise2 = optimise2 + 1
endif
//Settings 2
once monthinit2 = month
once yearinit2 = year
If (year = yearinit2 and month = (monthinit2 + ResetPeriod2)) or (year = (yearinit2 + 1) and ((12 - monthinit2) + month = ResetPeriod2)) Then
ValueY = StartingValue2
WinCountB2 = 0
StratAvgB2 = 0
BestA2 = 0
BestB2 = 0
monthinit2 = month
yearinit2 = year
EndIf
once valuey = startingvalue2
once pincpos2 = 1 //positive increment position
once nincpos2 = 1 //negative increment position
once optimise2 = 0 //initialize heuristicks engine counter (must be incremented at position start or exit)
once mode2 = 1 //switches between negative and positive increments
//once wincountb2 = 3 //initialize best win count
//graph wincountb2 coloured (0,0,0) as "wincountb2"
//once stratavgb2 = 4353 //initialize best avg strategy profit
//graph stratavgb2 coloured (0,0,0) as "stratavgb2"
if optimise2 = reps2 then
wincounta2 = 0 //initialize current win count
stratavga2 = 0 //initialize current avg strategy profit
heuristicscycle = heuristicscycle + 1
for i2 = 1 to reps2 do
if positionperf(i2) > 0 then
wincounta2 = wincounta2 + 1 //increment current wincount
endif
stratavga2 = stratavga2 + (((positionperf(i2)*countofposition[i2]*close)*-1)*-1)
next
stratavga2 = stratavga2/reps2 //calculate current avg strategy profit
//graph (positionperf(1)*countofposition[1]*100000)*-1 as "posperf1-2"
//graph (positionperf(2)*countofposition[2]*100000)*-1 as "posperf2-2"
//graph stratavga2*-1 as "stratavga2"
//once besta2 = 300
//graph besta2 coloured (0,0,0) as "besta2"
if stratavga2 >= stratavgb2 then
stratavgb2 = stratavga2 //update best strategy profit
besta2 = valuey
endif
//once bestb2 = 300
//graph bestb2 coloured (0,0,0) as "bestb2"
if wincounta2 >= wincountb2 then
wincountb2 = wincounta2 //update best win count
bestb2 = valuey
endif
if wincounta2 > wincountb2 and stratavga2 > stratavgb2 then
mode2 = 0
elsif wincounta2 < wincountb2 and stratavga2 < stratavgb2 and mode2 = 1 then
valuey = valuey - (increment2*nincpos2)
nincpos2 = nincpos2 + 1
mode2 = 2
elsif wincounta2 >= wincountb2 or stratavga2 >= stratavgb2 and mode2 = 1 then
valuey = valuey + (increment2*pincpos2)
pincpos2 = pincpos2 + 1
mode2 = 1
elsif wincounta2 < wincountb2 and stratavga2 < stratavgb2 and mode2 = 2 then
valuey = valuey + (increment2*pincpos2)
pincpos2 = pincpos2 + 1
mode2 = 1
elsif wincounta2 >= wincountb2 or stratavga2 >= stratavgb2 and mode2 = 2 then
valuey = valuey - (increment2*nincpos2)
nincpos2 = nincpos2 + 1
mode2 = 2
endif
if nincpos2 > maxincrement2 or pincpos2 > maxincrement2 then
if besta2 = bestb2 then
valuey = besta2
else
if reps2 >= 10 then
weightedscore2 = 10
else
weightedscore2 = round((reps2/100)*100)
endif
valuey = round(((besta2*(20-weightedscore2)) + (bestb2*weightedscore2))/20) //lower reps = less weight assigned to win%
endif
nincpos2 = 1
pincpos2 = 1
elsif valuey > maxvalue2 then
valuey = maxvalue2
elsif valuey < minvalue2 then
valuey = minvalue2
endif
optimise2 = 0
endif
// heuristics algorithm 2 end
endif
//
boxsizel = ValueX
boxsizes = ValueY
//
renkomaxl = round(close / boxsizel) * boxsizel
renkominl = renkomaxl - boxsizel
renkomaxs = round(close / boxsizes) * boxsizes
renkomins = renkomaxs - boxsizes
//
if high > renkomaxl + boxsizel then
renkomaxl = renkomaxl + boxsizel
renkominl = renkominl + boxsizel
endif
if low < renkomins - boxsizes then
renkomaxs = renkomaxs - boxsizes
renkomins = renkomins - boxsizes
endif
// Conditions to enter long positions
Buy N CONTRACT at renkoMaxL + boxSizeL stop
// Conditions to enter short positions
Sellshort N CONTRACT at renkoMinS - boxSizeS stop
//
//if percentage then
//set stop %loss 0.25 %trailing 0.5
//set target %profit 2
//else
set stop ptrailing 50 //50 + 100
set target pprofit 500
//endif
//
graphonprice renkomaxl + boxsizel coloured(0,200,0) as "renkomax"
graphonprice renkomins - boxsizes coloured(200,0,0) as "renkomin"
graph ValueX coloured(0,255,0)
graph ValueY coloured(255,0,0)
I wrote the above last night, didn’t get round to finishing more testing before commenting. Now I’ve spent the day testing and thinking about what are we really best suited to apply our ML code to?
Is 1 x ML better than 2 x ML? (Depends if it’s the Ehlers Univ Oscillator, in that case ML2 is better, but with Renko I think ML1 is better).
But, after tons of optimisations I keep seeing low Boxsizes of 10 or 20 and ditto for the Trailing Stop. Is that achievable in the Demo/Live environment?
If so what’s the point of setting the starting value at 100 and Max Value to 200 if the ML would do better at figuring out if it’s better to use 10 or 20 in increments of 5?
Hence Paul’s tight Settings values of 40 and 50 appear to perform better.
Note: testing with 100 for Boxsize and 100 for Trailing Stop and testing over very short Daily date ranges like Feb to April 2010, it doesn’t produce tbt warnings and the equity curves actually look more realistic: Renko TP ML1 ITF attached (set those values to Boxsize =10o and Trailing Stop =10o).
So… that just leaves the static “500” figure for Take Profit (TP) that I settled upon after lots of manual tests on different instruments like the Dow, £/$, Brent Crude etc.
Well what if you apply ML1 to the TP whilst fixing the Boxsize and Trailing Stop at 10 (or 20) each? Please see screenshot 2 – ignore bottom two equity curves.
Now obviously this was a fully intentioned tbt test, but judging by the smoothness of the equity curve just didn’t turn out to be a tbt test or give you a warning.
Sometimes, however, if you keep playing with the date ranges — and eventually get that tbt failure warning, and if you’re lucky the offending Renko box that caused the tbt test to fail is at the end of your test dates, and if you hit “close” instead of “launch non tbt” test — you’ll still get to see what the system can do.
The point is even with these fantasy results the win ratios, the gain/loss ratio and profits are far higher targeting ML1 on the TP value than anything else I’ve seen fantasy result of!
I also found that the Wend/While was better when ML1 was applied to the Stop Loss system but not always when using Wend/While on the TP system. Depends on the date ranges, if you set the dates to like £/$ Daily 02/03/ to present, the Wend While wins. If you set if to the last 5 months the without Wend/While system wins. So, is it worth applying ML to work out and switch between a system with Wend and While or without Wend and While, can that be done?
Right, that’s a lot to take in, but it’d be good to get peoples feedback and ideas. Cheers.
Also on the same topic as above of switching different types of Renko types:
Paul, I wondered if there was a conclusion as to whether it was worth trying different Renko types, and if some were greatly more profitable? Cheers. https://www.prorealcode.com/topic/machine-learning-in-proorder/page/12/#post-127225
Machine Learning in ProOrder ProRealTime
This topic contains 454 replies,
has 32 voices, and was last updated by Khaled
4 years ago.
| Forum: | ProOrder support |
| Language: | English |
| Started: | 08/06/2017 |
| Status: | Active |
| Attachments: | 207 files |
The information collected on this form is stored in a computer file by ProRealCode to create and access your ProRealCode profile. This data is kept in a secure database for the duration of the member's membership. They will be kept as long as you use our services and will be automatically deleted after 3 years of inactivity. Your personal data is used to create your private profile on ProRealCode. This data is maintained by SAS ProRealCode, 407 rue Freycinet, 59151 Arleux, France. If you subscribe to our newsletters, your email address is provided to our service provider "MailChimp" located in the United States, with whom we have signed a confidentiality agreement. This company is also compliant with the EU/Swiss Privacy Shield, and the GDPR. For any request for correction or deletion concerning your data, you can directly contact the ProRealCode team by email at privacy@prorealcode.com If you would like to lodge a complaint regarding the use of your personal data, you can contact your data protection supervisory authority.