So I've found the right script for FreeBitCo.in Check it bellow. var minValue = 0.00000001; var maxLoss = 0.0000001; var aimedProfit = 0.000005; var maxOps = 50; // Don't touch anything after this var endResult = 0; var ops = 0; // Bets a given amount on a given button and returns the value ot the callback var bet = function(value, button, callback) { var buttonName = button ? 'lo' : 'hi'; // We use site's api $.get('?op=double_your_btc&m=' + buttonName + '&stake=' + value + '&multiplier=2&jackpot=0', function(result) { var splittedResult = result.split(':'); // We update the account balance, as we have it juste there $('#balance').html(splittedResult[3]); // We finally call the callback callback(value, button, splittedResult[1] === 'w'); } ); }; // Main Martingale's method var martingale = function(value, button, result) { // We apply Martingale algorithm if (result || (value >= maxLoss && maxLoss !== 0)) { button = !button; newValue = minValue; } else newValue = 2 * value; // We compute new final result if (result) endResult += value; else endResult -= value; // We start over (and log misc data) 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); } }; // Init operation martingale(minValue, false, false);