//start var minValue = 0.00000001; var maxLoss = 0.00000512; var aimedProfit = 0.00000064; var maxOps = 300; var endResult = 0; var ops = 0; var bet = function(value, button, callback) { var buttonName = button ? 'lo' : 'hi'; $.get('?op=double_your_btc&m=' + buttonName + '&stake=' + value + '&multiplier=2&jackpot=0', function(result) { var splittedResult = result.split(':'); $('#balance').html(splittedResult[3]); callback(value, button, splittedResult[1] === 'w'); } ); }; var martingale = function(value, button, result) { if (result || (value >= maxLoss && maxLoss !== 0)) { button = !button; newValue = minValue; } else newValue = 2 * value; if (result) endResult += value; else endResult -= value; console.log((result ? '+' : '-') + value); ops++; if ((ops < maxOps || maxOps === 0) && (endResult < aimedProfit || aimedProfit === 0)) bet(newValue, button, martingale); else { console.log('Martingale finished in ' + ops + ' operations!'); console.log('Result: ' + endResult); } }; martingale(minValue, false, false); //end