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/30/2020 at 1:11 PM #129008
but when there’s a drop it ends op with 23 which is not with factor 5 and after that everything is off.
Grahal: So if I set increment = 2 then in any one bar, ValueX or Value Y should not change by more than ‘2’ (up or down)? https://www.prorealcode.com/topic/machine-learning-in-proorder/page/5/#post-12143
Junaj: Correct, unless the increment limit value has been reached, after which ValueX will revert to the new Average best performing value.
Is there an advantage to having minvalue set to = 15 and not set to = increment. So it starts at 20, goes to 50 but also it can go from 15 also? From 15 also?
04/30/2020 at 1:54 PM #129030Did 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?
past this in a new blanco strategy, it should run. I removed the ts, that’s a worry less 🙂 Daily tf
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275//-------------------------------------------------------------------------// Hoofd code : Renko D ML2 CycLimRes v4//-------------------------------------------------------------------------//-------------------------------------------------------------------------//main code : nneless renko dji 1month v3 machine learning (ml2)//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 = 1000once mode = 0 // [0] with minimum distance stop; [1] withoutonce minstopdistance = 20positionsize = 1startingvalue = 40 //5, 100, 10 boxsizeincrement = 10 //5, 20, 10maxincrement = 20 //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 valuestartingvalue2 = 40 //5, 100, 50 stop lossincrement2 = 10 //5, 10maxincrement2 = 20 //1, 30 limit of no of increments either up/down //4reps2 = 2 //1, 2 nos of trades to use for analysis //3maxvalue2 = 50 //20, 300, 200 maximum allowed valueminvalue2 = 15 //5, minimum allowed valueheuristicscyclelimit = 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 + 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 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 + 1endifonce 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//if mode thenbuy positionsize contract at renkomaxl + boxsizel stopsellshort positionsize contract at renkomins - boxsizes stopelseif high > renkomaxl + boxsizel thenbuy positionsize contract at renkomaxl + boxsizel + minstopdistance stopendifif low < renkomins - boxsizes thensellshort positionsize contract at renkomins - boxsizes - minstopdistance stopendifendifset stop ploss 50set target pprofit 500////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)1 user thanked author for this post.
04/30/2020 at 1:56 PM #129031Junaj: Correct, unless the increment limit value has been reached, after which ValueX will revert to the new Average best performing value.
Thanks didn’t now that. I want to stick to factor 5, so I will review the code if it can be changed.
04/30/2020 at 2:14 PM #1290381ValueX = round(((BestA*(20-WeightedScore)) + (BestB*WeightedScore))/20)That’s the cause. Now how you you get to to stick to the incremental value ratio, in this case 5? But at the same-time make it flexible so if increment is 2, is sticks also to that factor?
04/30/2020 at 4:48 PM #129085Cheers Paul, it was something in the ts code that stopped it launching. The “Hoof” and the rest of the “herd” are all good now for the live Demo, subject to VRT.
Why has Drawdown been halved by adding back in the Resetperiod code when all other figures look the same?
I was experimenting with trying to get ML3, for the N = trade size to work, but the drawdown was way too high at 93% in the non Resetperiod system (bottom chart/left results window), so I added the ResetPeriod code back in and now Ddown is back to typical trend following systems at 42%? Any ideas?
04/30/2020 at 7:38 PM #129120The first working ML3.
We also haven’t been using it to its full potential… Can anyone get the // BestA to work?
Juanj:
Also note that to set starting values to the algorithm all the commented out code which have a ‘once’ as well as a ‘Graph’ command on the line directly below it has to be activated. i.e. once BestA = 300 etc. I used it to graph and then set the final values generated by the algorithm as the starting values when using the strategy on a live system.
https://www.prorealcode.com/topic/machine-learning-in-proorder/page/24/#post-128685
Thanks for great code @Juanj, the Heuristic code @GraHal and help @Paul, @Nonetheless. It’s not been VRT’d yet, works on a few instruments like the Nikkei, the settings will need adjusting for others.
Also can we trust the ValueZ / ML3 on a setting like the pLoss after the trailing stop tbt debacle?
And would anyone like to try and get ValueZ / ML3 to work on N? (£/tick) instead of pLoss? I’ve tried! All I got “no trades” taken… I’m wondering if trade size can’t be governed by a ValueZ Machine Learning algo @Vonasi?
The itf and screenshot is attached below.
04/30/2020 at 7:39 PM #12912404/30/2020 at 8:00 PM #12912604/30/2020 at 8:20 PM #129129What are you trying to tell us @Noobywan? 🙂
I can see maybe why but how do we fix it??
Do we need to have our name after@ to be same as our username on this website?
Where is this website picking up my @investment account from?? investment account is not shown in my Profile on this website??
I have just turned to ON the option so Support on this website can view my email address.
Further than above I don’t what I can do??
04/30/2020 at 8:29 PM #129130Further than above I don’t what I can do??
I don’t even know what the problem is? Brad was a mistake and misspelling of Bard and I thought that was sorted by Nicolas years ago. 🤷♂️
Turns out, looking into this it wasn’t and a Bard beat me to my nickname (of the last 2o yrs) by a month… so now what because I’m not answering to “Brad” and Bard is already taken?04/30/2020 at 8:35 PM #129131Hi Grahal, I was replying to the “failed tag again” message #129124, unless Nicolas says otherwise, I don’t think the tag would work with a “modified along the way” user name, I think it works with whatever the account was originally created with, and this original address doesn’t change each time you change the user name. It can be seen in your profile address. If you both received my tags notifications, then this would be confirmed?
04/30/2020 at 8:41 PM #12913204/30/2020 at 8:55 PM #129138My God, I’ve been an imposter for years? 😀
Strange that I get so many email notifications though, but I am now wondering how many @ bard’s I might have missed here and which in fact went to a guy who hasn’t been posting here for 3 yrs and 8 months?
04/30/2020 at 9:13 PM #129141Don’t just settle for any name @Investment_Account. Be the best! This one’s free: “Axa Framlington Global Technology Z Incorporated.”
Catchy. 👌1 user thanked author for this post.
04/30/2020 at 10:10 PM #129147My God, I’ve been an imposter for years? 😀
Same here, ah well … an imposter I’ve been and an imposter I’ll stay!!! 🙂
Least the GraHal wrote link works now finally you’ve got the hang of it @Brad!!!! 🙂
Thank You @Noobywan for solving this 4 year old riddle!
Have a virtual beer on me @Noobywan @Vonasi and @Brad! 🙂
Goodnight Each
PS
There’s an oddity … I put Caps for the V in Vonasi and B in Brad but they came up lower case!?
Aha … I see why now … you have lower case on your Profile on the top line!
-
AuthorPosts
Find exclusive trading pro-tools on