Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- initialBetSize =0.000001 ;
- initialChance =98 ;
- bethigh = true;
- -- browser console command : JSON.parse(localStorage.getItem('strategies_saved')).find(strategy => strategy.label == 'Martingale')
- -- copy object
- -- replace (all) (regex mode) "(.*)": with $1=
- -- replace (all) do with Do
- strategy ={
- label = "experiment pc",
- blocks = { {
- id = "kJwkIXzb",
- type = "bets",
- on = {
- type = "every",
- value = 1,
- betType = "lose",
- profitType = "profit"
- },
- Do = {
- type = "increaseByPercentage",
- value = 90
- }
- }, {
- id = "q8OrkzFw",
- type = "bets",
- on = {
- type = "every",
- value = 1,
- betType = "win",
- profitType = "profit"
- },
- Do = {
- type = "resetAmount",
- value = 0
- }
- }, {
- id = "Sdh6iDI1",
- type = "bets",
- on = {
- type = "every",
- value = 5,
- betType = "lose",
- profitType = "profit"
- },
- Do = {
- type = "setWinChance",
- value = 49.5
- }
- }, {
- id = "agMsYbFd",
- type = "profit",
- on = {
- type = "greaterThan",
- value = 0,
- betType = "bet",
- profitType = "profit"
- },
- Do = {
- type = "setWinChance",
- value = 98
- }
- }, {
- id = "GdH6xeRg",
- type = "bets",
- on = {
- type = "every",
- value = 25,
- betType = "win",
- profitType = "profit"
- },
- Do = {
- type = "switchOverUnder",
- value = 0
- }
- } },
- isDefault = false
- } ;
- -- resetstats(); -- you may want to enable this
- -- end of edition area
- MIN_CHANCE = 0.01;
- MAX_CHANCE = 98.00;
- nextbet = initialBetSize;
- chance = initialChance;
- printf = function(s,...) return print(string.format(s,...)) end
- printf( 'Launching strategy "%s"', strategy.label );
- function isMatching(conditionType, conditionsOn)
- variableToUse = 0;
- if( conditionType == 'bets' ) then
- if( conditionsOn.betType == 'bet' ) then
- variableToUse = bets;
- elseif( conditionsOn.betType == 'win' ) then
- if( not win ) then
- return false;
- end
- if( conditionsOn.type == 'every' ) then
- variableToUse = wins;
- else
- variableToUse = currentstreak;
- end
- elseif( conditionsOn.betType == 'lose' ) then
- if( win ) then
- return false;
- end
- if( conditionsOn.type == 'every' ) then
- variableToUse = wins;
- else
- variableToUse = -currentstreak;
- end
- else
- printf('error in conditions, not recognized condition bet type "%s"', conditionsOn.betType);
- stop();
- end
- if( conditionsOn.type == 'every' or conditionsOn.type == 'everyStreakOf' ) then
- return (variableToUse % conditionsOn.value == 0);
- elseif( conditionsOn.type == 'firstStreakOf' ) then
- return (variableToUse == conditionsOn.value);
- elseif( conditionsOn.type == 'streakGreaterThan' ) then
- return (variableToUse > conditionsOn.value);
- elseif( conditionsOn.type == 'streakLowerThan' ) then
- return (variableToUse < conditionsOn.value);
- else
- printf('error in conditions, not recognized condition on type "%s"', conditionsOn.type);
- stop();
- end
- else -- 'profit'
- if( conditionsOn.profitType == 'balance' ) then
- variableToUse = balance;
- elseif( conditionsOn.profitType == 'loss' ) then
- variableToUse = -profit;
- elseif( conditionsOn.profitType == 'profit' ) then
- variableToUse = profit;
- else
- printf('error in conditions, not recognized condition on profitType "%s"', conditionsOn.profitType);
- stop();
- end
- if( conditionsOn.type == 'greaterThan' ) then
- return (variableToUse > conditionsOn.value);
- elseif( conditionsOn.type == 'greaterThanOrEqualTo' ) then
- return (variableToUse >= conditionsOn.value);
- elseif( conditionsOn.type == 'lowerThan' ) then
- return (variableToUse < conditionsOn.value);
- elseif( conditionsOn.type == 'lowerThanOrEqualTo' ) then
- return (variableToUse <= conditionsOn.value);
- else
- printf('error in conditions, not recognized condition on type "%s"', conditionsOn.type);
- stop();
- end
- end
- end
- function execute(doAction)
- if( doAction.type == 'increaseByPercentage' ) then
- nextbet *= 1 + doAction.value / 100;
- elseif( doAction.type == 'decreaseByPercentage' ) then
- nextbet *= 1 - doAction.value / 100;
- elseif( doAction.type == 'increaseWinChanceBy' ) then
- chance *= 1 + doAction.value / 100;
- elseif( doAction.type == 'decreaseWinChanceBy' ) then
- chance *= 1 - doAction.value / 100;
- elseif( doAction.type == 'addToAmount' ) then
- nextbet += doAction.value;
- elseif( doAction.type == 'subtractFromAmount' ) then
- nextbet -= doAction.value;
- elseif( doAction.type == 'addToWinChance' ) then
- chance += doAction.value;
- elseif( doAction.type == 'subtractFromWinChance' ) then
- chance -= doAction.value;
- elseif( doAction.type == 'setAmount' ) then
- nextbet = doAction.value;
- elseif( doAction.type == 'setWinChance' ) then
- chance = doAction.value;
- elseif( doAction.type == 'switchOverUnder' ) then
- bethigh = !bethigh;
- elseif( doAction.type == 'resetAmount' ) then
- nextbet = initialBetSize;
- elseif( doAction.type == 'resetWinChance' ) then
- chance = initialChance;
- elseif( doAction.type == 'stop' ) then
- stop();
- else
- log('error in conditions, not recognized action type "%s"', doAction.type);
- stop();
- end
- end
- function dobet()
- for i, condition in ipairs(strategy.blocks) do
- if( isMatching(condition.type, condition.on) ) then
- execute(condition.Do);
- end
- end
- chance = math.min(math.max(chance, MIN_CHANCE), MAX_CHANCE);
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement