var config = {
baseBet: { label: "Base Bet", value: 0.05, type: "number" },
payout: { label: "Payout Target", value: 2, type: "number" },
redThreshold: { label: "Wait for X Reds Under 2x", value: 5, type: "number" },
lossMultiplier: { label: "Loss Multiplier (Martingale)", value: 2, type: "number" },
maxBet: { label: "Max Bet Limit", value: 100, type: "number" },
stop: { label: "Stop if next bet >", value: 1e8, type: "number" }
};
function main() {
var currentBet = config.baseBet.value;
var isWaitingMode = true; // Start in waiting mode
var consecutiveReds = 0;
var totalGames = 0;
var sessionWins = 0;
var sessionLosses = 0;
// Function to count consecutive reds from history (using correct 'odds' property)
function countConsecutiveReds() {
var redCount = 0;
for (var i = 0; i < game.history.length; i++) {
if (game.history[i].odds < 2.0) { // Use 'odds' property for actual multiplier
redCount++;
} else {
break; // Stop counting when we hit a green (>=2x)
}
}
return redCount;
}
// Function to display recent history (simplified, only show crash multipliers)
function showRecentHistory() {
var historyStr = "Recent: ";
for (var i = 0; i < Math.min(8, game.history.length); i++) {
var crash = game.history[i].odds; // Use 'odds' property
var color = crash >= 2.0 ? "" : "";
historyStr += color + crash.toFixed(2) + "x ";
}
log.info(historyStr);
}
game.onBet = function () {
totalGames++;
// Count current consecutive reds
consecutiveReds = countConsecutiveReds();
// Show current status
showRecentHistory();
if (isWaitingMode) {
// WAITING MODE - Check if we have enough reds to start betting
if (consecutiveReds >= config.redThreshold.value) {
isWaitingMode = false;
currentBet = config.baseBet.value;
log.success(" THRESHOLD MET! " + consecutiveReds + " consecutive reds under 2x - Starting to bet!");
} else {
log.info(" WAITING - Need " + config.redThreshold.value + " reds under 2x, currently have " + consecutiveReds + " consecutive reds");
return; // Skip betting this round
}
}
// BETTING MODE - Place actual bet
if (currentBet > config.maxBet.value) {
currentBet = config.maxBet.value;
log.warn(" Bet capped at maximum: " + config.maxBet.value);
}
if (currentBet > config.stop.value) {
log.error(" Bet too high: " + currentBet + " - STOPPING!");
game.stop();
return;
}
log.success(" Game #" + totalGames + " - BETTING: " + currentBet.toFixed(6) + " at " + config.payout.value + "x");
log.info(" Session: " + sessionWins + " wins, " + sessionLosses + " losses");
game.bet(currentBet, config.payout.value).then(function (payout) {
if (payout > 1) {
// WIN - Reset to base bet and go back to waiting mode
sessionWins++;
var profit = currentBet * (config.payout.value - 1);
log.success(" WIN! Profit: " + profit.toFixed(6) + " | Crash: " + payout.toFixed(2) + "x");
log.success(" Resetting to WAITING mode - need " + config.redThreshold.value + " new reds under 2x");
// Reset everything
currentBet = config.baseBet.value;
isWaitingMode = true;
} else {
// LOSS - Martingale (increase bet) but stay in betting mode
sessionLosses++;
log.error(" LOSS! Crash: " + payout.toFixed(2) + "x | Lost: " + currentBet.toFixed(6));
// Increase bet for next round (martingale)
currentBet = currentBet * config.lossMultiplier.value;
log.info(" Next bet: " + currentBet.toFixed(6) + " (Martingale x" + config.lossMultiplier.value + ")");
log.info(" Still in BETTING mode - will continue until win");
// Check if next bet would be too high
if (currentBet > config.maxBet.value) {
log.warn(" Next bet would exceed max limit - will be capped!");
}
}
});
};
}