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/28/2020 at 5:30 PM #12870504/29/2020 at 12:56 AM #128741
That’s a bunch of time wasted. Knew there was something off but not exactly what. At least v4 ts had this covered.
I never look at this as wasted effort, because all the time I’m working on these systems (even with an unrealistic trailing stop), I’m constantly still thinking of new ideas to try out and develop.
Re: Renko ML2 1Month v4 ts (Trailing Stop). That was a such a great idea on coming up with the ML2 Boxsize L/S concept. Really smart, because I’ve been testing/experimenting Boxsize L/S v4 ts against ML1’s for Long and Short boxsizes governed by just ValueX, against ML1’s just for either boxsize or ML1’s on the take profit number and your ML2 Boxsize L/S performs far better.
I wondered though, how does it know if it should use percentage or points for stops, what determines that switch?
I did play around with the sophisticated ts settings, doing optimisations and manually changing figures. I tried different percentages for ts1, 2 and 3 but couldn’t get profit to vary. My thought is that the system maybe needs to be really allowed to “breath“ and make out like a bandit whenever possible rather than being restricted with a smart plan to tighten the ts when the profits climb to squeeze more profit out of the position. I then replaced the ts code with the standard TP at 500 and the new pLoss at 50 (now that we know trailing stops are pointless with tbt tests) and it performs even better. About another £10k better on the Nikkei Ap2018-2020. Please see image.
Can we trust “pLOSS 50” being respected properly by tbt test though? Seems to be throwing up far less tbt warnings, most of those being triggered by edits to settings 1 & 2.
Tomorrow I am going to see if I can get an ML3 working, so far not, maybe because of the wrong cycle heuristic code. But I noticed with the Ehlers Oscillators with an attempted ML3 system (2 correctly working ML’s and the third not being factored into the profit performance), that it produced better profits when the 3rd albeit not fully working ML3 was added compared to the ML2 version (x for long entry threshold and y for short entry).
04/29/2020 at 4:15 AM #128759I wondered though, how does it know if it should use percentage or points for stops, what determines that switch?
I wasn’t sure what I preferred best, so I added them both to compare quickly. Tend to prefer %.
The v4 ts version came to a loss of 50 points yesterday but before it het +220 points gain. Candles are read when they are done so if using daily timeframe it looks this ts isn’t a good solution to take profit in the same day/candle. A profit target should work though as you said.
now again it tipped +150 for this day.
Can we trust “pLOSS 50” being respected properly by tbt test though?
yes I think so but it can be bigger when there are gaps.
04/29/2020 at 1:31 PM #12881804/29/2020 at 2:26 PM #128839Hi @paul
Not sure to understand
You ask if I did a change in the ML code ? If so, the answer is no
I use the simple/stupid strategy and add the ML with 3 trials (With the version of Grahal, yours et the one of Brad)
And as you see, I see no improvement
I reply to your question ?
1 user thanked author for this post.
04/29/2020 at 3:39 PM #128846Here’s try on 1 ML engine, choosing from in this case 5 best optimisation results (from without ML). So it means 1 ML engine can have many parameters. On short timeframe, run optimisation a few days later and add that the first 5 and build a database.
Makes it sense? No! Still fun to try.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114startingvalue = 1 //5, 100, 10 boxsizeincrement = 1 //5, 20, 10maxincrement = 5 //5, 10 limit of no of increments either up or downreps = 5 //1 number of trades to use for analysis //2maxvalue = 5 //20, 300, 150 //maximum allowed valueminvalue = 1 //5, minimum allowed value//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 + 1endifonce 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 endif valuex=1 thenboxsizeL=5boxsizeS=50elsif valuex=2 thenboxsizeL=15boxsizeS=40elsif valuex=3 thenboxsizeL=40boxsizeS=30elsif valuex=4 thenboxsizeL=5boxsizeS=25elsif valuex=5 thenboxsizeL=10boxsizeS=45endifgraph valuex//graph boxsizel//graph boxsizes1 user thanked author for this post.
04/29/2020 at 3:47 PM #128847So it means 1 ML engine can have many parameters
Hahah great idea … you’ve leveraged the ML engine!
Thank You for sharing Paul
04/29/2020 at 5:50 PM #128861I reply to your question ?
Yes fully thanks!
@Bard About the ts on a daily tf. If using mtf, but daily without updateonclose for the % trailingstop, would it be correctly done if onmarket & exited on the same daily bar? Or need the ts to be modified for that? Anyway todays result +500! Who thought a target 500 points would make sense lol! Can take a few losses of 50 points now 🙂
04/30/2020 at 12:56 AM #128899Excellent idea, re leveraging the ML engine! How would the code be written for Renko ML1 to actually self optimise and try out and step through those 5 values in lines 95 to 110? I can’t picture it.If using mtf, but daily without updateonclose for the % trailingstop, would it be correctly done if onmarket & exited on the same daily bar? Or need the ts to be modified for that?
Sorry not following, could you explain more please about what you want to try and achieve with the Multi TF and “without updateonclose” and “would it be correctly done if onmarket & exited on the same daily bar?”
If you’re using MTF, which other TF apart from Daily are you referring to?Kerchinnngggg! €337! Take the ts off and let the system rip!
(It’s the sound of a shop cash register machine when you open it to put money in it, ha ha)And on the subject of where to turn the ML algo to next: It has to be Money Management and Trade Size!
04/30/2020 at 2:16 AM #128905Hi @Paul, or anyone with better coding skills than me, can anyone figure out if this HeuristicsCycle code looks right for an ML3 version?
I cannot get an ML3 version (using algo 3 for £/tick N) to work properly when coded. It’s like the ML2’s v4 without the trailing stop, but with one more part added, i.e., number 3 algo and using the line: elsif heuristicsalgo3 = 1 then… When I use it it does not take any trades?
12345678910111213141516171819202122232425262728HeuristicsCycleLimit = 3once HeuristicsCycle = 0once HeuristicsAlgo1 = 1once HeuristicsAlgo2 = 0once HeuristicsAlgo3 = 0If HeuristicsCycle >= HeuristicsCycleLimit ThenIf HeuristicsAlgo1 = 1 ThenHeuristicsAlgo1 = 0HeuristicsAlgo2 = 1HeuristicsAlgo3 = 0ElsIf HeuristicsAlgo2 = 1 ThenHeuristicsAlgo1 = 1HeuristicsAlgo2 = 0HeuristicsAlgo3 = 0ElsIf HeuristicsAlgo3 = 1 ThenHeuristicsAlgo1 = 0HeuristicsAlgo2 = 0HeuristicsAlgo3 = 1EndIfHeuristicsCycle = 0EndIfIf HeuristicsAlgo1 = 1 ThenThe only way I can get the Value Z Money Mgt algo = “N” to work (pls see screens and GraphZ blue line) is to use the “HeuristicsCycleLimit = 2” version and then // out the “elsif heuristicsalgo3 = 1 then” line of code. I have had that blue line work to the end to other tests.
I have tried ValueZ replacing the N’s in the buy code but get an error from PRT asking me to report. Maybe N cannot be ValueZ? I really think though if N can be replaced with ValueZ and we can get the money management ML3 algo coded right the performance will increase. I’ve seen it do £25k in two months using N in the buy code before a tbt warning came on. I’ve attached the “work in progress” Renko ML3 V4 below.04/30/2020 at 9:20 AM #128942can anyone figure out if this HeuristicsCycle code looks right for an ML3 version?
Try below …
12345678910111213141516171819202122232425262728HeuristicsCycleLimit = 3once HeuristicsCycle = 0once HeuristicsAlgo1 = 1once HeuristicsAlgo2 = 0once HeuristicsAlgo3 = 0If HeuristicsCycle >= HeuristicsCycleLimit ThenIf HeuristicsAlgo1 = 1 ThenHeuristicsAlgo1 = 0HeuristicsAlgo2 = 1HeuristicsAlgo3 = 0ElsIf HeuristicsAlgo2 = 1 ThenHeuristicsAlgo1 = 0HeuristicsAlgo2 = 0HeuristicsAlgo3 = 1ElsIf HeuristicsAlgo3 = 1 ThenHeuristicsAlgo1 = 1HeuristicsAlgo2 = 0HeuristicsAlgo3 = 0EndIfHeuristicsCycle = 0EndIfIf HeuristicsAlgo1 = 1 Then04/30/2020 at 11:32 AM #128979If you’re using MTF, which other TF apart from Daily are you referring to?
it’s daily with updateonclose and daily without updateonclose as a test. The question is how do we get a trailingstop working in 1 daily candle, where then entry & exit are in that same bar? (and without going to lower timeframes).
How would the code be written for Renko ML1 to actually self optimise and try out and step through those 5 values in lines 95 to 110? I can’t picture it.
So those values in those lines 95-110 you put in manually you found in the optimisation sheet. On a 5s timeframe you could daily add 1 or 2. The engine start which valuex which uses that specific boxsize for l&s. If results are good it should stick to it, if not it should take another valuex which has 2 other boxsizes assigned, so it cycles to those 5 or more numbers from valuex. 2ML is better obviously but still I find above interesting.
Good to see work started on ML3. We got ML working in a backtest as graph showed, have you seen a difference trying live with and without 2 ML engines?
04/30/2020 at 11:44 AM #128981because using ML and a long & short strategy at the same time, how does the engine know which direction is preforming poorly? There is no reference too long or short win% or average gain, it takes all results into account to change all parameters (ml1 or ml1-2)
Does that mean focussing a strategy on long specifically and another on short is better?
04/30/2020 at 12:23 PM #128994and last one, using 1 ML engine with increments of 5, code of juanj on p1 or p2.
it start out at correct 15 up to 50, but when there’s a drop it ends op with 23 which is not with factor 5 and after that everything is off.
1234567startingvalue = 20 //5, 100, 10 boxsizeResetPeriod = 1 //Specify no of months after which to reset optimizationincrement = 5 //5, 20, 10maxincrement = 5 //5, 10 limit of no of increments either up or downreps = 2 //1 number of trades to use for analysis //2maxvalue = 50 //20, 300, 150 //maximum allowed valueminvalue = 15 //5, minimum allowed value04/30/2020 at 1:01 PM #129001The question is how do we get a trailing stop working in 1 daily candle, where then entry & exit are in that same bar?
Do we want to try and “fix” the issue with trailing stops and tbt tests though? I’m seeing better results with the pLoss=50 and TP=500. Just inadvertently tried a ML3 v4 on a 4 hour timeframe when I was testing something else but the old equity backtest was up from last nights work using incomplete functioning ML3 code:
“ML3 kind of works but it’s not optimising with ML1 and ML2.”123456789101112optimise2 = 0endif// heuristics algorithm 2 endendif//elsif heuristicsalgo3 = 1 then// Heuristics Algorithm 3 Start /////////////////////////////////If HeuristicsAlgo3 = 1 ThenIf (onmarket[1] = 1 and onmarket = 0) etc etcand look at the performance before the PRT engine finds issue with a candle and throws a “warning spanner into the works,” fortunately late into the test. I hit “close” instead of relaunch because it preserves the test up to the point of failure. The blue GraphZ (because ValueZ has replaced N in the Buy line) is working on its own. Independent of profit from the ML1 and ML2 performance comparisons. 17% Ddown.
I wonder what would happen with your great idea to have value 1 to 5 classifiers of the best box sizes? Maybe post you results? There is definitely and edge here with position sizing ML algos.
have you seen a difference trying live with and without 2 ML engines?
No Paul because I can’t launch the ML systems on my Demo. Did you get this “can’t go live” warning with your v4 ts? (pls see image 2). How can I launch it on the Demo? It doesn’t like ValueX/Y?
Does that mean focussing a strategy on long specifically and another on short is better?
That would make sense! Run the two systems together… The number of permutations for this ML code is mind boggling! 😃
-
AuthorPosts
Find exclusive trading pro-tools on