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/21/2020 at 11:35 AM #127227
Sorry for the Mission Drift – I actually thought we were in the Pure Renko strategy thread…
04/21/2020 at 11:50 AM #127232It is selected in the screenshot. If you’re seeing that unselected somewhere else, it was probably 2am…
Maybe you did a lot of tests and posting of results at 2 am (?) because to reproduce your results on coffee I have to disable tick by tick mode.
However, the Daily TF on DJI (I think?) that I posted was with tick by tick enabled.
We need to get the bottom of this anyway … I’m glad a few of us are now looking at it!? 🙂
Vonasi’s keeping quiet, now I know why … he’s already bought his new yacht complete with onboard tropical island!!!! 🙂
04/21/2020 at 11:59 AM #12723504/21/2020 at 12:15 PM #12724004/21/2020 at 12:24 PM #127244Thanks for clarifying @Nonetheless. In your opinion, because I have not read through all of that forum thread, was that a mistake using version 1 because v2 performed better than the very first Renko algo?
I actually couldn’t get v1 to work on the 1 minute TF, hence me thinking maybe it was meant to be 1 month (which I never usually backtest on) and then discovering it worked really well with that TF, I decided to add the ML code to see what would happen… the rest, as they say is a “happy accident.”04/21/2020 at 12:28 PM #127245I’ve been going back through Juanj’s original code carefully: https://www.prorealcode.com/topic/machine-learning-in-proorder/page/3/#post-121130
Is line 166 and 169 (now lines 2 and 5) correct?
Original coding123456For i2 = 1 to Reps2 DoIf positionperf(i) > 0 ThenWinCountA2 = WinCountA2 + 1 //Increment Current WinCountEndIfStratAvgA2 = StratAvgA2 + (((PositionPerf(i)*countofposition[i]*100000)*-1)*-1)NextPerhaps a little mistake, because surely it should read “(i2)” not (i), right? :
12345For i2 = 1 to Reps2 DoIf positionperf(i2) > 0 ThenWinCountA2 = WinCountA2 + 1 //Increment Current WinCountEndIfStratAvgA2 = StratAvgA2 + (((PositionPerf(i2)*countofposition[i]*100000)*-1)*-1)04/21/2020 at 12:40 PM #12724704/21/2020 at 12:46 PM #127249was that a mistake using version 1
The subsequent versions were far more sophisticated, for sure, and some have ML applied, for example #126632
1m in the original was def 1 minute but I never kept it on forward testing for that long. @Grahal had a lot of success with it
1 user thanked author for this post.
04/21/2020 at 12:53 PM #127250then discovering it worked really well
Glad you did!
I’ve often found new and better ways through life by doing something wrong in the first place! 🙂
Perhaps a little mistake, because surely it should read “(i2)” not (i), right? :
I agree! well spotted!
Also the 100000 should read Close or a value related to the Price of instrument under test.
1 user thanked author for this post.
04/21/2020 at 1:32 PM #127259Thanks very much for the clarification @Nonetheless. Do you know what the “ha” stands for in front of the high in Renko3?
So that’s 2 more different versions to test and apply ML1 and ML2 too. I’m going to be here for years…04/21/2020 at 1:34 PM #12726004/21/2020 at 1:42 PM #127261** and should countofposition also be “(i2)?”
Yes I would say so.
It’s a pity @Juanj hasn’t dropped by for a while? He also may be working with these errors.
One way I noticed errors early on in my trialling the HAlgos is … I used Halgo2 as stand alone / on it’s own in a System. When I tried to backtest it told me about 3 or 4 variables were not defined. I then realised that HAlgo2 had been using values from HAlgo1.
You could try above as a check on your HAlgo2 and also HAlgo3.
1 user thanked author for this post.
04/21/2020 at 1:58 PM #127265what the “ha” stands for
HA = heikin ashi, an alternative Japanese candle-type
1 user thanked author for this post.
04/21/2020 at 2:08 PM #127268It’s giving me the same kind of results (in the millions with 30x capital). In fact it seems to have picked up a “spare £13 million”… Not sure @GraHal, is anyone else able to replicate these results?
Maybe there is a caching issue and even though it shows tick by tick it’s not doing tick by tick, although I have started a fresh session in PRT this morning and get the same high results.
Maybe the other day I had other backtests running in the same chart and when I changed the TF of coffee it would show me a warning saying that tick by tick wasn’t available for the date range for another system (and I did click for it to test the new TF without tick by tick, but perhaps it was also unticking my Renko ML1 StpLoss system, (although it’s not visually removing my tick in the tick by tick backtest box)?Here’s the code instead of the itf: The only change is with:
1StratAvgA = StratAvgA + (((PositionPerf(i)*countofposition[i]*100000)*-1)*-1)where I replaced 100,000 with Close. Oddly no difference in profit on Coffee although it did make a big difference when I made that change for the Ehlers’ Univ Osc ML2 system with coffee?
Renko 1M ML1 StpLoss123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175//-------------------------------------------------------------------------// Main code : Nneless Renko DJI 1M v1 ML1 Cycle Limit Reset -// Orig a 1 Min system (no ML), then 1 Month (no ML) and then 1 Month with ML and now Daily with ML// The 30 x capital was a test to break the system.//-------------------------------------------------------------------------//https://www.prorealcode.com/topic/why-is-backtesting-so-unreliable/#post-110889// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated// The system will cancel all pending orders and close all positions at 0:00. No new ones will be allowed until after the "FLATBEFORE" time.//DEFPARAM FLATBEFORE = 143000// Cancel all pending orders and close all positions at the "FLATAFTER" time//DEFPARAM FLATAFTER = 210000Capital = 10000 + strategyprofit //Current profit made by the closed trades of the running strategy.N = 30*Capital / Close //30//ValueX for the Renko Stop Loss.//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 1StartingValue = 10 //10 Stop LossResetPeriod = 0.5 //0.5 Specify no of months after which to reset optimisationIncrement = 5 //20MaxIncrement = 10 //10 Limit of no of increments either up or downReps = 2 //Number of trades to use for analysis //2MaxValue = 150 //150 //Maximum allowed valueMinValue = increment //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 End//Renko DefinitionsboxSize = 100 // Orig 110//StartingValue = 10 //10 Stop Loss//ResetPeriod = 0.5 //0.5 Specify no of months after which to reset optimisation//Increment = 5 //20//MaxIncrement = 10 //10 Limit of no of increments either up or down//Reps = 2 //Number of trades to use for analysis //2//MaxValue = 150 //150 //Maximum allowed value//MinValue = increment //Minimum allowed valueonce renkoMax = ROUND(close / boxSize) * boxSizeonce renkoMin = renkoMax - boxSizeIF high > renkoMax + boxSize THENWHILE high > renkoMax + boxSizerenkoMax = renkoMax + boxSizerenkoMin = renkoMin + boxSizeWENDELSIF low < renkoMin - boxSize THENWHILE low < renkoMin - boxSizerenkoMax = renkoMax - boxSizerenkoMin = renkoMin - boxSizeWENDENDIFc1 = renkoMax + boxSizec2 = renkoMin - boxSize// Conditions to enter long positionsIf c1 thenBuy N CONTRACT at renkoMax + boxSize stopEndIf// Conditions to enter short positionsIf c2 thenSellshort N CONTRACT at renkoMin - boxSize stopEndIf// Stops and targets//SET STOP PLOSS ValueX //Orig 75Set stop trailing ValueX//100SET TARGET PPROFIT 500 //Orig 150GRAPH ValueX coloured(0,255,0)04/21/2020 at 2:21 PM #127273 -
AuthorPosts
Find exclusive trading pro-tools on