Machine Learning in ProOrder ProRealTime
Forums › ProRealTime English forum › ProOrder support › Machine Learning in ProOrder ProRealTime
- This topic has 454 replies, 32 voices, and was last updated 2 years ago by Khaled.
Tagged: machine learning
-
-
04/26/2020 at 9:37 PM #128278
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!
1 user thanked author for this post.
04/26/2020 at 9:45 PM #128279I 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.
04/26/2020 at 9:49 PM #128280Did 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.
04/26/2020 at 10:20 PM #128281I 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.04/26/2020 at 10:34 PM #12828404/27/2020 at 12:03 AM #12828904/27/2020 at 12:06 AM #12829004/27/2020 at 12:19 AM #128293where’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 !
04/27/2020 at 12:56 AM #128294Paul, 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.
04/27/2020 at 1:24 AM #128297i’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.
1 user thanked author for this post.
04/27/2020 at 1:45 AM #12829804/27/2020 at 2:13 AM #12830004/27/2020 at 6:56 PM #128486I 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).
Renko 1M ML2 CycLimRes v4123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309//-------------------------------------------------------------------------//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 parametersdefparam cumulateorders = false // cumulating positions deactivateddefparam 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 / Closeheuristicscyclelimit = 2once heuristicscycle = 0once heuristicsalgo1 = 1once heuristicsalgo2 = 0if heuristicscycle >= heuristicscyclelimit thenif heuristicsalgo1 = 1 thenheuristicsalgo2 = 1heuristicsalgo1 = 0elsif heuristicsalgo2 = 1 thenheuristicsalgo1 = 1heuristicsalgo2 = 0endifheuristicscycle = 0elseonce valuex = startingvalueonce valuey = startingvalue2endifif heuristicsalgo1 = 1 then//heuristics algorithm 1 startif (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) thenoptimise = optimise + 1endif//Settings 1 & 2startingvalue = 40 //5, 100, 10 //LONG BOXSIZEResetPeriod = 3 //1, 0.5 Specify no of months after which to reset optimisationincrement = 10 //5, 20, 10maxincrement = 20 //5, 10 limit of no of increments either up or downreps = 3 //1 number of trades to use for analysis //2maxvalue = 50 //50, 20, 300, 150 //maximum allowed valueminvalue = increment //15, 5, minimum allowed valuestartingvalue2 = 40 //5, 100, 50 //SHORT BOXSIZEResetPeriod2 = 3 //1, 0.5 Specify no of months after which to reset optimisationincrement2 = 10 //5, 10maxincrement2 = 20 //1, 30 limit of no of increments either up/down //4reps2 = 3 //1, 2 nos of trades to use for analysis //3maxvalue2 = 50 //50, 20, 300, 200 maximum allowed valueminvalue2 = increment //15, 5, minimum allowed valueonce monthinit = monthonce yearinit = yearIf (year = yearinit and month = (monthinit + ResetPeriod)) or (year = (yearinit + 1) and ((12 - monthinit) + month = ResetPeriod)) ThenValueX = StartingValueWinCountB = 0StratAvgB = 0BestA = 0BestB = 0monthinit = monthyearinit = yearEndIfonce valuex = startingvalueonce pincpos = 1 //positive increment positiononce nincpos = 1 //negative increment positiononce 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 thenwincounta = 0 //initialize current win countstratavga = 0 //initialize current avg strategy profitheuristicscycle = heuristicscycle + 1for i = 1 to reps doif positionperf(i) > 0 thenwincounta = wincounta + 1 //increment current wincountendifstratavga = stratavga + (((positionperf(i)*countofposition[i]*close)*-1)*-1)nextstratavga = 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 thenstratavgb = stratavga //update best strategy profitbesta = valuexendif//once bestb = 300//graph bestb coloured (0,0,0) as "bestb"if wincounta >= wincountb thenwincountb = wincounta //update best win countbestb = valuexendifif wincounta > wincountb and stratavga > stratavgb thenmode1 = 0elsif wincounta < wincountb and stratavga < stratavgb and mode1 = 1 thenvaluex = valuex - (increment*nincpos)nincpos = nincpos + 1mode1 = 2elsif wincounta >= wincountb or stratavga >= stratavgb and mode1 = 1 thenvaluex = valuex + (increment*pincpos)pincpos = pincpos + 1mode1 = 1elsif wincounta < wincountb and stratavga < stratavgb and mode1 = 2 thenvaluex = valuex + (increment*pincpos)pincpos = pincpos + 1mode1 = 1elsif wincounta >= wincountb or stratavga >= stratavgb and mode1 = 2 thenvaluex = valuex - (increment*nincpos)nincpos = nincpos + 1mode1 = 2endifif nincpos > maxincrement or pincpos > maxincrement thenif besta = bestb thenvaluex = bestaelseif reps >= 10 thenweightedscore = 10elseweightedscore = round((reps/100)*100)endifvaluex = round(((besta*(20-weightedscore)) + (bestb*weightedscore))/20) //lower reps = less weight assigned to win%endifnincpos = 1pincpos = 1elsif valuex > maxvalue thenvaluex = maxvalueelsif valuex < minvalue thenvaluex = minvalueendifoptimise = 0endif// heuristics algorithm 1 endelsif heuristicsalgo2 = 1 then// heuristics algorithm 2 startif (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) thenoptimise2 = optimise2 + 1endif//Settings 2once monthinit2 = monthonce yearinit2 = yearIf (year = yearinit2 and month = (monthinit2 + ResetPeriod2)) or (year = (yearinit2 + 1) and ((12 - monthinit2) + month = ResetPeriod2)) ThenValueY = StartingValue2WinCountB2 = 0StratAvgB2 = 0BestA2 = 0BestB2 = 0monthinit2 = monthyearinit2 = yearEndIfonce valuey = startingvalue2once pincpos2 = 1 //positive increment positiononce nincpos2 = 1 //negative increment positiononce 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 thenwincounta2 = 0 //initialize current win countstratavga2 = 0 //initialize current avg strategy profitheuristicscycle = heuristicscycle + 1for i2 = 1 to reps2 doif positionperf(i2) > 0 thenwincounta2 = wincounta2 + 1 //increment current wincountendifstratavga2 = stratavga2 + (((positionperf(i2)*countofposition[i2]*close)*-1)*-1)nextstratavga2 = 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 thenstratavgb2 = stratavga2 //update best strategy profitbesta2 = valueyendif//once bestb2 = 300//graph bestb2 coloured (0,0,0) as "bestb2"if wincounta2 >= wincountb2 thenwincountb2 = wincounta2 //update best win countbestb2 = valueyendifif wincounta2 > wincountb2 and stratavga2 > stratavgb2 thenmode2 = 0elsif wincounta2 < wincountb2 and stratavga2 < stratavgb2 and mode2 = 1 thenvaluey = valuey - (increment2*nincpos2)nincpos2 = nincpos2 + 1mode2 = 2elsif wincounta2 >= wincountb2 or stratavga2 >= stratavgb2 and mode2 = 1 thenvaluey = valuey + (increment2*pincpos2)pincpos2 = pincpos2 + 1mode2 = 1elsif wincounta2 < wincountb2 and stratavga2 < stratavgb2 and mode2 = 2 thenvaluey = valuey + (increment2*pincpos2)pincpos2 = pincpos2 + 1mode2 = 1elsif wincounta2 >= wincountb2 or stratavga2 >= stratavgb2 and mode2 = 2 thenvaluey = valuey - (increment2*nincpos2)nincpos2 = nincpos2 + 1mode2 = 2endifif nincpos2 > maxincrement2 or pincpos2 > maxincrement2 thenif besta2 = bestb2 thenvaluey = besta2elseif reps2 >= 10 thenweightedscore2 = 10elseweightedscore2 = round((reps2/100)*100)endifvaluey = round(((besta2*(20-weightedscore2)) + (bestb2*weightedscore2))/20) //lower reps = less weight assigned to win%endifnincpos2 = 1pincpos2 = 1elsif valuey > maxvalue2 thenvaluey = maxvalue2elsif valuey < minvalue2 thenvaluey = minvalue2endifoptimise2 = 0endif// heuristics algorithm 2 endendif//boxsizel = ValueXboxsizes = ValueY//renkomaxl = round(close / boxsizel) * boxsizelrenkominl = renkomaxl - boxsizelrenkomaxs = round(close / boxsizes) * boxsizesrenkomins = renkomaxs - boxsizes//if high > renkomaxl + boxsizel thenrenkomaxl = renkomaxl + boxsizelrenkominl = renkominl + boxsizelendifif low < renkomins - boxsizes thenrenkomaxs = renkomaxs - boxsizesrenkomins = renkomins - boxsizesendif// Conditions to enter long positionsBuy N CONTRACT at renkoMaxL + boxSizeL stop// Conditions to enter short positionsSellshort N CONTRACT at renkoMinS - boxSizeS stop////if percentage then//set stop %loss 0.25 %trailing 0.5//set target %profit 2//elseset stop ptrailing 50 //50 + 100set 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.
04/27/2020 at 9:30 PM #128511Also 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
04/28/2020 at 8:44 AM #128548Hi everyone,
I discover this very interesting file ! Well done Coder Guys 🙂
But honestly it’s hard to understand how the initial heuristric code works (What it does…What conditions it use to implement or not the ValueX, ValueY) : Someone who has understand can explain the different step because I don’t see how it implement or not the Value
I try to apply to different strageies but seems to be very capricious. Sometimes it works sometimes not
When I will understand I think it will be interesting to add the “new” array to have as many values as you want and may be to auto-optimize the code for the parameters of incrementation notably
Thanks and bye
Zilliq
-
AuthorPosts
Find exclusive trading pro-tools on