random value
Forums › ProRealTime English forum › ProOrder support › random value
- This topic has 10 replies, 8 voices, and was last updated 3 years ago by Vonasi.
Tagged: generator, numbers, random, random numbers generator
-
-
08/16/2016 at 7:18 AM #1175108/17/2016 at 8:49 AM #11775
There is no built-in function that I know of. I tried making a ‘random’ number generator quickly:
1EDIT: wrong codeThis will return a pseudo-random integer between 0 and 9 for each bar. I checked the distribution of integers, and it will generate roughly the same amount of each integer. Since it is not truly random and a very simple algorithm, remember that it will return the same numbers every time unless you change CFD/timeframe/startdate. If you use it as an indicator, you will see the distribution is a bit affected by certain patterns. Using it for the purpose you describe is no problem though.
08/17/2016 at 9:00 AM #11776I have spent many hours thinking of ways to generate a pseudo random number in PRT.
My ideas were to “fool” my Auto strategy onto a Monte Carlo walk forward. However, haven’t had much luck as the PRT platform is fairly basic programming.
Ives tried using time , trigonometry (cosine, some) , RSI , but these all have a oscillating commonality that creates a pattern sooner or later.
Grizzly
08/17/2016 at 9:05 AM #1177708/17/2016 at 9:10 AM #11780Here is the code I meant to post:
12once MyNumber=5MyNumber=round(((((rsi[14]*rsi[8])*(high[mynumber]+medianprice))*((intradaybarindex/time))+days+(dayofweek+1)*month)-round((((rsi[14]*rsi[8])*(high[mynumber]+medianprice))*((intradaybarindex/time))+days+(dayofweek+1)*month)/10-0.49)*10)-0.4)return MyNumber as “PseudoRandom”
2 users thanked author for this post.
08/17/2016 at 7:57 PM #1179311/14/2018 at 9:34 PM #84887Base in your idea I made an indicator to show values from 1 to 0.
Cheers
Random Number12345678psuedorandom= round(rsi[7]*rsi[14]/rsi[21])IF psuedorandom >= 10 THENRandomNumber = round(psuedorandom/10)+ psuedorandom-round(psuedorandom/10)*10ENDIFRandomNumber=max(1,min(10, RandomNumber))smarandom=average[100](RandomNumber)return RandomNumber Style(point,4) as "RandomNumber" ,0 as "cero", 10 as "10", smarandom as "average of random"02/07/2021 at 11:45 AM #16056902/07/2021 at 3:44 PM #160585There is still no random number generation available in PRT although I do believe it is on the list of things to be added. At the moment PRT are still ironing out bugs in v11 so I imagine it is rather low priority right now.
1 user thanked author for this post.
02/08/2021 at 2:15 AM #160609Another one:
1234567// Random Number Generator//// MaxNumbers = 100 //100=0 to 99 or 1000=0 to 999 or 31=0 to 30, and so on....)//MaxNumbers = max(1,min(10000,MaxNumbers))RandomNumber = round(Rsi[8](Close) * Rsi[14](MedianPrice) * Rsi[20](TypicalPrice)) MOD MaxNumbersRETURN RandomNumber AS "RandomNumber"1 user thanked author for this post.
02/10/2021 at 3:48 PM #160944After a little bit of testing I have concluded that unfortunately none of these code examples are truly random number generators because they are based on other indicators that will always return the same values. So for example run the random number generator on the DJI daily chart and every single time you run it you will get the same sequence of numbers because the data for the other indicators is the same every single time.
So if you use them to add some sort of random element to strategy testing then you will just end up with a curve fit to the (not at all) random numbers generated.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on