Advertisement
Ypleitez

Untitled

Oct 21st, 2023
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.29 KB | None | 0 0
  1. initialBetSize =0.000001 ;
  2. initialChance =98 ;
  3. bethigh = true;
  4.  
  5. -- browser console command : JSON.parse(localStorage.getItem('strategies_saved')).find(strategy => strategy.label == 'Martingale')
  6. -- copy object
  7. -- replace (all) (regex mode) "(.*)": with $1=
  8. -- replace (all) do with Do
  9. strategy ={
  10. label = "experiment pc",
  11. blocks = { {
  12. id = "kJwkIXzb",
  13. type = "bets",
  14. on = {
  15. type = "every",
  16. value = 1,
  17. betType = "lose",
  18. profitType = "profit"
  19. },
  20. Do = {
  21. type = "increaseByPercentage",
  22. value = 90
  23. }
  24. }, {
  25. id = "q8OrkzFw",
  26. type = "bets",
  27. on = {
  28. type = "every",
  29. value = 1,
  30. betType = "win",
  31. profitType = "profit"
  32. },
  33. Do = {
  34. type = "resetAmount",
  35. value = 0
  36. }
  37. }, {
  38. id = "Sdh6iDI1",
  39. type = "bets",
  40. on = {
  41. type = "every",
  42. value = 5,
  43. betType = "lose",
  44. profitType = "profit"
  45. },
  46. Do = {
  47. type = "setWinChance",
  48. value = 49.5
  49. }
  50. }, {
  51. id = "agMsYbFd",
  52. type = "profit",
  53. on = {
  54. type = "greaterThan",
  55. value = 0,
  56. betType = "bet",
  57. profitType = "profit"
  58. },
  59. Do = {
  60. type = "setWinChance",
  61. value = 98
  62. }
  63. }, {
  64. id = "GdH6xeRg",
  65. type = "bets",
  66. on = {
  67. type = "every",
  68. value = 25,
  69. betType = "win",
  70. profitType = "profit"
  71. },
  72. Do = {
  73. type = "switchOverUnder",
  74. value = 0
  75. }
  76. } },
  77. isDefault = false
  78. } ;
  79.  
  80. -- resetstats(); -- you may want to enable this
  81.  
  82. -- end of edition area
  83.  
  84. MIN_CHANCE = 0.01;
  85. MAX_CHANCE = 98.00;
  86.  
  87. nextbet = initialBetSize;
  88. chance = initialChance;
  89.  
  90. printf = function(s,...) return print(string.format(s,...)) end
  91. printf( 'Launching strategy "%s"', strategy.label );
  92.  
  93. function isMatching(conditionType, conditionsOn)
  94. variableToUse = 0;
  95. if( conditionType == 'bets' ) then
  96. if( conditionsOn.betType == 'bet' ) then
  97. variableToUse = bets;
  98. elseif( conditionsOn.betType == 'win' ) then
  99. if( not win ) then
  100. return false;
  101. end
  102. if( conditionsOn.type == 'every' ) then
  103. variableToUse = wins;
  104. else
  105. variableToUse = currentstreak;
  106. end
  107. elseif( conditionsOn.betType == 'lose' ) then
  108. if( win ) then
  109. return false;
  110. end
  111. if( conditionsOn.type == 'every' ) then
  112. variableToUse = wins;
  113. else
  114. variableToUse = -currentstreak;
  115. end
  116. else
  117. printf('error in conditions, not recognized condition bet type "%s"', conditionsOn.betType);
  118. stop();
  119. end
  120.  
  121. if( conditionsOn.type == 'every' or conditionsOn.type == 'everyStreakOf' ) then
  122. return (variableToUse % conditionsOn.value == 0);
  123. elseif( conditionsOn.type == 'firstStreakOf' ) then
  124. return (variableToUse == conditionsOn.value);
  125. elseif( conditionsOn.type == 'streakGreaterThan' ) then
  126. return (variableToUse > conditionsOn.value);
  127. elseif( conditionsOn.type == 'streakLowerThan' ) then
  128. return (variableToUse < conditionsOn.value);
  129. else
  130. printf('error in conditions, not recognized condition on type "%s"', conditionsOn.type);
  131. stop();
  132. end
  133.  
  134. else -- 'profit'
  135. if( conditionsOn.profitType == 'balance' ) then
  136. variableToUse = balance;
  137. elseif( conditionsOn.profitType == 'loss' ) then
  138. variableToUse = -profit;
  139. elseif( conditionsOn.profitType == 'profit' ) then
  140. variableToUse = profit;
  141. else
  142. printf('error in conditions, not recognized condition on profitType "%s"', conditionsOn.profitType);
  143. stop();
  144. end
  145.  
  146. if( conditionsOn.type == 'greaterThan' ) then
  147. return (variableToUse > conditionsOn.value);
  148. elseif( conditionsOn.type == 'greaterThanOrEqualTo' ) then
  149. return (variableToUse >= conditionsOn.value);
  150. elseif( conditionsOn.type == 'lowerThan' ) then
  151. return (variableToUse < conditionsOn.value);
  152. elseif( conditionsOn.type == 'lowerThanOrEqualTo' ) then
  153. return (variableToUse <= conditionsOn.value);
  154. else
  155. printf('error in conditions, not recognized condition on type "%s"', conditionsOn.type);
  156. stop();
  157. end
  158. end
  159. end
  160.  
  161. function execute(doAction)
  162. if( doAction.type == 'increaseByPercentage' ) then
  163. nextbet *= 1 + doAction.value / 100;
  164. elseif( doAction.type == 'decreaseByPercentage' ) then
  165. nextbet *= 1 - doAction.value / 100;
  166. elseif( doAction.type == 'increaseWinChanceBy' ) then
  167. chance *= 1 + doAction.value / 100;
  168. elseif( doAction.type == 'decreaseWinChanceBy' ) then
  169. chance *= 1 - doAction.value / 100;
  170. elseif( doAction.type == 'addToAmount' ) then
  171. nextbet += doAction.value;
  172. elseif( doAction.type == 'subtractFromAmount' ) then
  173. nextbet -= doAction.value;
  174. elseif( doAction.type == 'addToWinChance' ) then
  175. chance += doAction.value;
  176. elseif( doAction.type == 'subtractFromWinChance' ) then
  177. chance -= doAction.value;
  178. elseif( doAction.type == 'setAmount' ) then
  179. nextbet = doAction.value;
  180. elseif( doAction.type == 'setWinChance' ) then
  181. chance = doAction.value;
  182. elseif( doAction.type == 'switchOverUnder' ) then
  183. bethigh = !bethigh;
  184. elseif( doAction.type == 'resetAmount' ) then
  185. nextbet = initialBetSize;
  186. elseif( doAction.type == 'resetWinChance' ) then
  187. chance = initialChance;
  188. elseif( doAction.type == 'stop' ) then
  189. stop();
  190. else
  191. log('error in conditions, not recognized action type "%s"', doAction.type);
  192. stop();
  193. end
  194. end
  195.  
  196. function dobet()
  197.  
  198. for i, condition in ipairs(strategy.blocks) do
  199. if( isMatching(condition.type, condition.on) ) then
  200. execute(condition.Do);
  201. end
  202. end
  203.  
  204. chance = math.min(math.max(chance, MIN_CHANCE), MAX_CHANCE);
  205. end
  206.  
  207.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement