-
-
Save dsetzer/ce5ac47b815992a593ff0bced38735e1 to your computer and use it in GitHub Desktop.
Martingale script which stops after winning.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var config = { | |
baseBet: { value: 100, type: 'balance', label: 'base bet' }, | |
payout: { value: 2, type: 'multiplier' }, | |
stop: { value: 1e8, type: 'balance', label: 'stop if bet >' }, | |
stopAfterWin: { value: false, type: 'checkbox', label: 'Stop after win' }, | |
loss: { | |
value: 'increase', type: 'radio', label: 'On Loss', | |
options: { | |
base: { type: 'noop', label: 'Return to base bet' }, | |
increase: { value: 2, type: 'multiplier', label: 'Increase bet by' }, | |
} | |
}, | |
win: { | |
value: 'base', type: 'radio', label: 'On Win', | |
options: { | |
base: { type: 'noop', label: 'Return to base bet' }, | |
increase: { value: 2, type: 'multiplier', label: 'Increase bet by' }, | |
} | |
}, | |
delay: { value: 100, type: 'number', label: 'Bet Speed' } | |
}; | |
this.log('Script is running..'); | |
var currentBet = config.baseBet.value; | |
for(;;){ | |
const result = await this.bet(roundBit(currentBet), config.payout.value); | |
if (result.multiplier >= result.target) { | |
if (config.win.value === 'base') { | |
currentBet = config.baseBet.value; | |
} else { | |
console.assert(config.win.value === 'increase'); | |
currentBet *= config.win.options.increase.value; | |
} | |
this.log('We won, so next bet will be', currentBet/100, 'bits'); | |
if (config.stopAfterWin.value) { | |
this.log('Stop after win is enabled, so stopping the script'); | |
break; | |
} | |
} else { | |
// damn, looks like we lost :( | |
if (config.loss.value === 'base') { | |
currentBet = config.baseBet.value; | |
} else { | |
console.assert(config.loss.value === 'increase'); | |
currentBet *= config.loss.options.increase.value; | |
} | |
this.log('We lost, so next bet will be', currentBet/100, 'bits') | |
} | |
if (currentBet > config.stop.value) { | |
this.log('Was about to bet', currentBet, 'which triggers the stop'); | |
break; | |
} | |
await sleep(config.delay.value); | |
} | |
function roundBit(bet) { | |
return Math.round(bet / 100) * 100; | |
} | |
function sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Daniel, I required a bustadice martingale script which stops at certain bet amount and resets the vet
STOP AND RESET AT - SAY 64 in case of 2x martingale with x2 multiplier