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/15/2020 at 7:31 PM #12633204/15/2020 at 7:39 PM #126333
The link above is a link to use of the Heuristic Cycle Limit … is this what you meant to libk to?
That’s what I thought I’d posted but if you look carefully (and I totally get why things are easy to miss in this jungle of code!) you’ll see there’s no “ElsIf HeuristicsAlgo2 = 1 Then” or ElsIf HeuristicsAlgo3 = 1 Then. This is needed to switch algos.
Doesn’t above mean that HeuristicsAlgo2 and HeuristicsAlgo3 would work together at the same time??
Probably, as you can see I tried the more sensible initialisation code that you linked to (126009) but that didn’t work and so I’ve tagged Nicolas. If you read my last post directly above I might still have to go through the code with a tooth comb using the difference checker website and get rid of any other errors/spacing/errant returns.
1 user thanked author for this post.
04/15/2020 at 9:39 PM #126336WinCount Note: Re: Ehler’s Unic Osc ML systems on here, I would replace my WinCount codes order for this original order of WinCount strategy instructions below and with PIncPos + “1” instead of the older version within this thread, PIncPos + “increments.” I spotted an incorrect order on post: https://www.prorealcode.com/topic/machine-learning-in-proorder/page/8/#post-126009
I’ve pasted the correct ordered code below. (I originally altered the order for easier understanding). Note I’ve also labelled Mode as Mode 1. Be sure to include Mode “1” within the code where needed, or you can strip the “1” off of Mode.
@bertrandpinoyCorrect WinCount Order12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455//ValueXIf WinCountA > WinCountB and StratAvgA > StratAvgB ThenMode1 = 0 //Strategy is performing well with current variable, do not optimiseElsIf WinCountA < WinCountB and StratAvgA < StratAvgB and Mode1 = 1 ThenValueX = ValueX - (Increment*NIncPos)NIncPos = NIncPos + 1Mode1 = 2 //For strategy performing worse Next cycle optimise with negative incrementsElsIf WinCountA >= WinCountB or StratAvgA >= StratAvgB and Mode1 = 1 ThenValueX = ValueX + (Increment*PIncPos)PIncPos = PIncPos + 1Mode1 = 1 //For strategy performing better Next cycle again optimise with positive incrementsElsIf WinCountA < WinCountB and StratAvgA < StratAvgB and Mode1 = 2 ThenValueX = ValueX + (Increment*PIncPos)PIncPos = PIncPos + 1Mode1 = 1 //For strategy performing worse Next cycle optimise with positive incrementsElsIf WinCountA >= WinCountB or StratAvgA >= StratAvgB and Mode1 = 2 ThenValueX = ValueX - (Increment*NIncPos)NIncPos = NIncPos + 1Mode1 = 2 //For strategy performing better Next cycle again optimise with negative incrementsEndIf—————//ValueYIf WinCountA2 > WinCountB2 and StratAvgA2 > StratAvgB2 ThenMode2 = 0 //Strategy is performing well with current variable, do not optimiseElsIf WinCountA2 < WinCountB2 and StratAvgA2 < StratAvgB2 and Mode2 = 1 ThenValueX = ValueX - (Increment2*NIncPos2)NIncPos2 = NIncPos2 + 1Mode2 = 2 //For strategy performing worse Next cycle optimise with negative incrementsElsIf WinCountA2 >= WinCountB2 or StratAvgA2 >= StratAvgB2 and Mode2 = 1 ThenValueX = ValueX + (Increment2*PIncPos2)PIncPos2 = PIncPos2 + 1Mode2 = 1 //For strategy performing better Next cycle again optimise with positive incrementsElsIf WinCountA2 < WinCountB2 and StratAvgA2 < StratAvgB2 and Mode2 = 2 ThenValueX = ValueX + (Increment2*PIncPos2)PIncPos2 = PIncPos2 + 1Mode2 = 1 //For strategy performing worse Next cycle optimise with positive incrementsElsIf WinCountA2 >= WinCountB2 or StratAvgA2 >= StratAvgB2 and Mode2 = 2 ThenValueX = ValueX - (Increment2*NIncPos2)NIncPos2 = NIncPos2 + 1Mode2 = 2 //For strategy performing better Next cycle again optimise with negative incrementsEndIf04/16/2020 at 9:50 AM #126368So does above mean you are getting more consistent results now with the ML Systems?
Are you able to see / detect that the Heuristics Cycle Limit is working?
If as an experiment if you set the Heuristic Cycle Limit = 10 then you should see from GRAPH Valuex, ValueY and ValueZ that for 10 trades only ValueX changes for example (while ValueY and ValueZ do not change for 10 trades etc)?
You may be able to see above for Heuristic Cycle Limit = 3, but it may not be so obvious??
04/16/2020 at 4:24 PM #126419Machine learning implemented in a simple AUDCAD system, robustness test included.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205defparam cumulateorders = falseonce longtrading= 1once shorttrading= 1n = 1m = 3l = 90//Robustness Testeronce j = 0once flag = 1if flag = 1 thenj = j + 1if j > 1 thenflag = -1j = j - 1endifendifif flag = -1 thenj = j - 1if j = 0 thenj = j + 1flag = 1endifendiftradeon = 1if opendate >= 20000101 thenif barindex mod 1 = 0 or barindex mod 1 = j thentradeon = 1endifendif// Heuristics Algorithm StartIf onmarket[1] = 1 and onmarket = 0 Thenoptimize = optimize + 1EnDifStartingValue = 140ResetPeriod = 26 //Specify no of months after which to reset optimizationIncrement = 20MaxIncrement = 3 //Limit of no of increments either up or downReps = 22 //Number of trades to use for analysisMaxValue = 320 //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 //Neative Increment Positiononce Optimize = 0 ////Initialize Heuristicks Engine Counter (Must be Incremented at Position Start or Exit)once Mode = 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 Optimize = Reps ThenWinCountA = 0 //Initialize current Win CountStratAvgA = 0 //Initialize current Avg Strategy ProfitFor i = 1 to Reps DoIf positionperf(i) > 0 ThenWinCountA = WinCountA + 1 //Increment Current WinCountEndIfStratAvgA = StratAvgA + (((PositionPerf(i)*countofposition[i]*100000)*-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 ThenMode = 0ElsIf WinCountA < WinCountB and StratAvgA < StratAvgB and Mode = 1 ThenValueX = ValueX - (Increment*NIncPos)NIncPos = NIncPos + 1Mode = 2ElsIf WinCountA >= WinCountB or StratAvgA >= StratAvgB and Mode = 1 ThenValueX = ValueX + (Increment*PIncPos)PIncPos = PIncPos + 1Mode = 1ElsIf WinCountA < WinCountB and StratAvgA < StratAvgB and Mode = 2 ThenValueX = ValueX + (Increment*PIncPos)PIncPos = PIncPos + 1Mode = 1ElsIf WinCountA >= WinCountB or StratAvgA >= StratAvgB and Mode = 2 ThenValueX = ValueX - (Increment*NIncPos)NIncPos = NIncPos + 1Mode = 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 = MinValueEndIFOptimize = 0EndIf// Heuristics Algorithm Endcs= summation[n](close>open) = ncs = cs and close>bollingerup[valuex](close) and close>dlow(2)cl= summation[m](close<open) = mcl = cl and close<bollingerdown[valuex](close) and close<Dhigh(2)size = 2//entry conditionsif shorttrading thenif cs and tradeon thensellshort size contract at marketendifendifif longtrading thenif cl and tradeon thenbuy size contract at marketendifendif//exit conditionsif shortonmarket and close<average[l](close) thenexitshort at marketendifif longonmarket and close>average[l](close) thensell at marketendif// Stop and targetSET TARGET pPROFIT 50StartBreakeven = 30 // How much pips/points in gain to activate the Breakeven function?PointsToKeep = 0 // How much pips/points to keep in profit above of below our entry price when the Breakeven is activated (beware of spread)// Reset the BreakevenLevel when no trade are on marketIF NOT ONMARKET THENBreakevenLevel=0ENDIF// Test if the price have moved favourably of "startBreakeven" points alreadyIF LONGONMARKET AND close-tradeprice(1)>=startBreakeven*pipsize THEN//Calculate the BreakevenLevelBreakevenLevel = tradeprice(1)+PointsToKeep*pipsizeENDIF// Place the new stop orders on market at BreakevenLevelIF BreakevenLevel>0 THENSELL AT BreakevenLevel STOPENDIFIF SHORTONMARKET AND tradeprice(1)-close>startBreakeven*pipsize THEN//Calculate the BreakevenLevelBreakevenLevel = tradeprice(1)-PointsToKeep*pipsizeENDIF//Place the new stop orders on market at BreakevenLevelIF BreakevenLevel>0 THENEXITSHORT AT BreakevenLevel STOPENDIF04/16/2020 at 6:11 PM #126440Well done You!if barindex mod 1 = 0 or barindex mod 1 = j then
Anybody … do you know what mod is in the above code (at Line 32) and what is it used for?
I used the e-find and can’t find mod anywhere else in the code apart from the line above.
I inserted ‘modulo’ instead of mod but it gave a syntax error.
04/16/2020 at 6:31 PM #126441Well i don’t know Grahal, it’s part of the robustness tester you should ask Vonasi.
I just edited qty and random variables with “1” and deactivated the tester, so line 10 to 35 are useless in the code.1 user thanked author for this post.
04/17/2020 at 12:26 PM #126532Hi fifi743, thanks for the code modifications. Whilst I find it easy to understand using Value X and Y for an Oscillator’s threshold entries/exits, I’m not clear what this system is optimising? Could you please explain the Period 7 and Period 14 and how they’re being optimised in relation to the “once Value Y = 6”? Why is the Slow Period set to 6 but the Fast Period allowed to be optimised? Could you also please explain the buy and sell conditions: If c1 (the average of valuex) crosses over c2 (the average of valuex)? Thanks again, Bard.
04/17/2020 at 1:03 PM #126534Hi fifi743, thanks for the code modifications
Did you mean @Francesco? I can’t see Period 7 in his code?
If No … which code of FiFi’s are you referring to, I’ve looked back 3 pages and I can’t see any code posted by FiFi??
Maybe I need to look harder?? 🙂
1 user thanked author for this post.
04/17/2020 at 3:02 PM #126563I haven’t forgotten your question re: Machine Learning. I wasn’t testing yesterday and will be testing systems over the next few days to find out if it’s better with or without the cycle limit and reset feature. I seem to have a couple of systems that have flat/static graphs of X and Y that need sorting out… I don’t know why I didn’t think of that diff checker before as I used to use it for editing text many aeons ago. Great tip.
Be good, for comparison purposes, to see some of your ML system ideas, if you have anything you’d like to show?
My next task is to get that Pivot system working with ML and then add Vonasi’s Robustness tester to the Univ Osc and Pivot systems. Lot to learn. I feel like I’m back at school! Ha Ha.
04/17/2020 at 4:24 PM #126598Can anyone get this normally very effective (when not self optimising) Pivot System ML system to work? It’s based on the Pivot Support Resistance Zone indicator first referred to here: https://www.prorealcode.com/topic/machine-learning-in-proorder/page/7/#post-125498
It uses the 2 Algo ML code along with the Cycle Limit code taken from a working 2 algo optimising Ehler’s Universal Oscillator system (see earlier posts) and the codes have been compared side by side for any differences — of which I can see none – using this very useful free tool: https://text-compare.com/
I’ve tried for hours to get this system code working but it won’t take any trades at all. The system and two indicators that it uses are attached as itf’s below.
Ideas anyone?Thanks,
04/17/2020 at 10:26 PM #126658It’s this one called “Mon Systeme” by Fifi743 thanks GraHal, https://www.prorealcode.com/topic/machine-learning-in-proorder/page/5/#post-121417
Changed my opinion on the effectiveness of using the cycle limit now I’ve got it working consistently: I played around with the Reset Period/Reps/MaxIncrement figures so to that extent it is optimised, otherwise it’s the same Ehler’s Univ Oscillator algo code as I’ve posted before but including Juanj’s cycle limit code from page 3 of this thread. Bandedge was the usual 100, no Trailing Stop just exits on the 0.0 Oscillator value. The winning system is compared to a system below it that had no reset nor cycle limit added. Pls see image.
How are your systems looking @GraHal and are you getting better results now using the cycle limit?04/17/2020 at 10:26 PM #126660It’s this one called “Mon Systeme” by Fifi743 thanks, https://www.prorealcode.com/topic/machine-learning-in-proorder/page/5/#post-121417
Changed my opinion on the effectiveness of using the cycle limit now I’ve got it working consistently: I played around with the Reset Period/Reps/MaxIncrement figures so to that extent it is optimised, otherwise it’s the same Ehler’s Univ Oscillator algo code as I’ve posted before but including Juanj’s cycle limit code from page 3 of this thread. Bandedge was the usual 100, no Trailing Stop just exits on the 0.0 Oscillator value. The winning system is compared to a system below it that had no reset nor cycle limit added. Pls see image.
How are your systems looking @GraHal and are you getting better results now using the cycle limit?04/18/2020 at 11:04 AM #126711How are your systems looking @GraHal and are you getting better results now using the cycle limit?
I got back into Real Live last week (after nearly 2 years with Live disabled waiting for V11 !!) and I took a few early losses yesterday on Systems!! It puts me in a good mood to see a steady increase each day (bad mood re losses) so I put all my effort into getting back the losses with manual trades! We shouldn’t trade when in a bad mood! ( 🙂 ) but I’m pleased to say by late afternoon I made up the Auto-losses and a little bit more! Then at about half 8 ish a Renko fired up, went straight into profit and shot for the sky … a good end to the week and a satisfied sleep last night!
You should take a look at the Renko thread … particularly the v2.3p version that we seem to have resurrected yesterday … thanks to eckhaw posting his results. I was running it but had forgotten to optimise the renko box size (another good candidate for ML) and so my results were nowhere near as good as eckhaw’s … more bad moods ( 🙂 ) but it came good in the end as that was the Renko that made me money by the close!
I’ve never proved to myself that the Cycle Limit worked, but now you have done so without any changes to the Cycle Limit code … I can move forward with confidence that it should / does work.
04/18/2020 at 12:14 PM #126722Congratulations withe live auto trading! Do you use Monte Carlo or Vonasi’s Robustness Tester first and then monitor systems on the demo before going live? Yes, I’ve been watching Renko in one of my new charts. Looks good. Did you do a lot of backtesting using Renko? Is there a statistical edge and do you have a link to that thread please?
I never trade when angry. I stop and take a walk around the canal here where I live. I also don’t trade crazy markets like we saw in March despite huge possible gains from the immense volatility. History teaches me that I makes it slow and lose it fast. It’s a natural human trait to “stand your ground in adversity” but that spells disaster in these kind of markets without properly defined exits before a trade and with unprecedented movements due to an unknown issues (like how long and devastating will the spread of the C19 virus be, will the Fed “Plunge Protection Team” come to the rescue in an effective and long lasting way, — although I’m anti Fed, they have saved the day through every major disaster in recent decades — and billed the taxpayer for it Lol). It just sounds like a hiding to nothing to me. For me it’s easier to make money in predictable markets, and the research from FXMC would seem to bear that out looking at currency pairs, the £/$ being one f the more predictable pairs compared to say the Aus/$ or even the €/$.
It would make more sense that cycle limit should work better as it is self optimising using Reps. What I need to know is how to get a 3 Algo system properly working (entry thresholds for the oscillator plus optimising the bandedge) with that initialisation code I posted earlier. I might make a new post in the forums to see if anyone can code it, I expect Nicolas is very busy and hasn’t had a chance to see it/respond.
I look forward to seeing some of your ideas using this cycle limit algo coding. I love the way people who have posted on this thread have such diverse ways of using the algo optimising code, that’s always insightful. It’s why I asked about Fifi’s Period optimising “Mon Systeme,” I’d like to fully understand what its doing!
-
AuthorPosts
Find exclusive trading pro-tools on