https://bitcointalksearch.org/topic/m.9379308
which seems like it would fit your purposes. Since then there's been a minor API change, so here's the adapted version:
var cashout;
var mult;
// set one of mult or cashout, and the other will be calculated for you:
// mult = 1.12;
cashout = 1.5;
// what percentage to increase the net profit by each time we lose a bet; 0 for pure martingale
greed_percent = 5;
if (!mult)
mult = cashout / (cashout - 1) * (1 + greed_percent/100);
else if (!cashout)
cashout = mult / (mult - 1) * (1 + greed_percent/100);
var satoshis = baseBet * 100;
var crash = Math.floor(cashout*100 + 1e-6);
var currentBet = false;
engine.on('game_starting', function () {
if (currentBet && engine.lastGamePlay() === 'LOST')
currentBet *= mult;
else
currentBet = satoshis;
if (currentBet < engine.getBalance()) {
console.log('place bet of', Math.round(currentBet/100), 'at', crash/100);
engine.placeBet(Math.round(currentBet/100)*100, crash, false);
}
else {
engine.stop();
console.log('You ran out of bits :(');
}
});
Give that a go, and let me know if it fits your needs