Jump to content

can someone write me the piece of script (for the crash game) to make it stop as soon as i win 10% of the initial budget? I attach the script


Cristian2
 Share

Recommended Posts

var config = {
    betPercentage: {
        label: 'percentage of total coins to bet',
        value: 0.25,
        type: 'number'
    },
    payout: {
        label: 'payout',
        value: 2,
        type: 'number'
    },
    onLoseTitle: {
        label: 'On Lose',
        type: 'title'
    },
    onLoss: {
        label: '',
        value: 'increase',
        type: 'radio',
        options: [{
                value: 'reset',
                label: 'Return to base bet'
            }, {
                value: 'increase',
                label: 'Increase bet by (loss multiplier)'
            }
        ]
    },
    lossMultiplier: {
        label: 'loss multiplier',
        value: 2,
        type: 'number'
    },
    onWinTitle: {
        label: 'On Win',
        type: 'title'
    },
    onWin: {
        label: '',
        value: 'reset',
        type: 'radio',
        options: [{
                value: 'reset',
                label: 'Return to base bet'
            }, {
                value: 'increase',
                label: 'Increase bet by (win multiplier)'
            }
        ]
    },
    winMultiplier: {
        label: 'win multiplier',
        value: 1,
        type: 'number'
    },
    otherConditionsTitle: {
        label: 'Other Stopping Conditions',
        type: 'title'
    },    
    winGoalAmount: {
        label: 'Stop once you have made this much',
        value: currency.amount * 2,
        type: 'number'
    },
    lossStopAmount: {
        label: 'Stop betting after losing this much without a win.',
        value: 0,
        type: 'number'
    },    
    otherConditionsTitle: {
        label: 'Experimentle Please Ignore',
        type: 'title'
    },
    loggingLevel: {
        label: 'logging level',
        value: 'compact',
        type: 'radio',
        options: [{
                value: 'info',
                label: 'info'
            }, {
                value: 'compact',
                label: 'compact'
            }, {
                value: 'verbose',
                label: 'verbose'
            }
        ]
    }
};
// deleted input parameters
var stop = 0;
var lossesForBreak = 0;
var roundsToBreakFor = 0;

// end deleted parameters
var totalWagers = 0;
var netProfit = 0;
var totalWins = 0;
var totalLoses = 0;
var longestWinStreak = 0;
var longestLoseStreak = 0;
var currentStreak = 0;
var loseStreak = 0;
var numberOfRoundsToSkip = 0;
var currentBet = GetNewBaseBet();
var totalNumberOfGames = 0;
var originalbalance = currency.amount;
var runningbalance = currency.amount;
var consequetiveLostBets = 0;
var lossStopAmountVar = config.lossStopAmount.value;

function main() {

    game.onBet = function () {

        // if we are set to skip rounds then do so.
        if (numberOfRoundsToSkip > 0) {
            numberOfRoundsToSkip -= 1;
            log.info('Skipping round to relax, and the next ' + numberOfRoundsToSkip + ' rounds.');
            return;
        } else {
        
                if(totalNumberOfGames == 0)
                {
                    // this is so we account for the first round.
                    currentBet = GetNewBaseBet();
                }
                
                if(loseStreak >= 2)
                {
                    if(game.history[0].crash > 200)
                    {
                        loseStreak = 0;
                    }
                    else
                    {
                        log.info('Not betting until current loseStreak is over.');
                        return;
                    }                    
                }

            log.info('Placed bet for the amount of ' + currentBet);
            game.bet(currentBet, config.payout.value).then(function (payout) {
                runningbalance -= currentBet;
                totalWagers += currentBet;
                totalNumberOfGames += 1;

                if (payout > 1) {
                    var netwin = currentBet * config.payout.value - currentBet;
                    consequetiveLostBets = 0;
                    if(config.loggingLevel.value != 'compact')
                    {
                        LogMessage('We won a net profit of: ' + netwin.toFixed(8), 'success');
                    }
                    netProfit += netwin;
                    runningbalance += netwin + currentBet;

                    if (loseStreak > 0) {
                        loseStreak = 0;
                    }

                    currentStreak += 1;
                    totalWins += 1;

                    LogSummary('true', currentBet);

                    if (config.onWin.value === 'reset') {
                        currentBet = GetNewBaseBet();
                    } else {
                        currentBet *= config.winMultiplier.value;
                    }

                    LogMessage('We won, so next bet will be ' + currentBet.toFixed(8) + ' ' + currency.currencyName, 'success');
                } else {
                        log.error('We lost a net amount of: ' + currentBet.toFixed(8));
                        netProfit -= currentBet;
                        loseStreak += 1;
                        currentStreak = 0;
                        totalLoses += 1;
                        consequetiveLostBets += currentBet;

                        LogSummary('false', currentBet);

                        if (config.onLoss.value == 'reset') {
                            currentBet = GetNewBaseBet();
                        } else {
                            currentBet *= config.lossMultiplier.value;
                        }
                            LogMessage('We lost, so next bet will be ' + currentBet.toFixed(8) + ' ' + currency.currencyName, 'failure');            
                    }

                    if (currentStreak > longestWinStreak) {
                        longestWinStreak = currentStreak;
                    }
                    if (loseStreak > longestLoseStreak) {
                        longestLoseStreak = loseStreak;
                    }

                    recordStats();

                    if (config.winGoalAmount.value != 0 && netProfit > config.winGoalAmount.value) {
                        // we have earned enough stop and quit.
                        log.success('The net profits ' + netProfit.toFixed(8) + ' which triggers stop the for making enough.');
                        game.stop();
                    }
                    if (lossStopAmountVar != 0 && consequetiveLostBets > (lossStopAmountVar)) {
                        // the point of this is to limit the bleed so you don't loose too much.
                        log.error('The net profits ' + netProfit.toFixed(8) + ' which triggers stop for losing enough. The next bet would be ' + currentBet.toFixed(8) + '.');
                        game.stop();
                    }
                }
            );
        }
    };
    }

    function recordStats() {
        if (config.loggingLevel.value != 'compact') {
            LogMessage('total wagers: ' + totalWagers.toFixed(8), 'info');
            LogMessage('Net Profit: ' + netProfit.toFixed(8), 'info');
            LogMessage('Current win streak: ' + currentStreak, 'info');
            LogMessage('Current Lose streak: ' + loseStreak, 'info');
            LogMessage('Total wins: ' + totalWins, 'info');
            LogMessage('Total Losses: ' + totalLoses, 'info');
            LogMessage('Longest win streak: ' + longestWinStreak, 'info');
            LogMessage('Longest lose streak: ' + longestLoseStreak, 'info');
        }
    }

    function GetNewBaseBet() {
        var returnValue = 0;
        returnValue = runningbalance * (config.betPercentage.value / 100);

        if(returnValue > currency.minAmount)
        {
            LogMessage('Recalculating base bet to ' + returnValue.toFixed(8) + ' which is ' + config.betPercentage.value + ' percent of ' + runningbalance.toFixed(8), 'info');
        }
        else
        {
            LogMessage('The recalculated bet amount ' + returnValue.toFixed(8) + ' is lower than the minimum allowed bet.  Setting bet to the minimum allowable amount of ' + currency.minAmount, 'info');
            returnValue = currency.minAmount;
        }

        return returnValue;
    }

    function LogSummary(wasWinner, betAmount) {
        if (config.loggingLevel.value == 'compact') {
            if (wasWinner == 'true') {
                var winAmount = (betAmount * config.payout.value) - betAmount;
                log.success('Winner!! You won ' + winAmount.toFixed(8));
            } else {
                log.error('Loser!! You lost ' + betAmount.toFixed(8));
            }
            var winPercentage = (totalWins / totalNumberOfGames) * 100;
            var losePercentage = (totalLoses / totalNumberOfGames) * 100;

            log.info('Total Games: ' + totalNumberOfGames);
            log.info('Wins: ' + totalWins + '(' + winPercentage.toFixed(2) + ' % )');
            log.info('Loses: ' + totalLoses + '(' + losePercentage.toFixed(2) + ' % )');

            var netNumber = runningbalance - originalbalance;
            var netPecentage = (netNumber / originalbalance) * 100;

            if (originalbalance < runningbalance) {
                log.success('Total Profit: ' + netNumber.toFixed(8) + '(' + netPecentage.toFixed(2) + '%)');
            } else {
                log.error('Total Profit: ' + netNumber.toFixed(8) + '(' + netPecentage.toFixed(2) + '%)');
            }
        }

    }

    /// Determines whether or not to log an event or not to make it easier later
    function LogMessage(message, loggingLevel) {
        if (message) {

            if (config.loggingLevel.value != 'compact') {
                switch (loggingLevel) {
                case 'success':
                    log.success(message);
                    break;
                case 'failure':
                    log.error(message);
                    break;
                case 'info':
                    log.info(message);
                    break;
                case 'compact':
                    break;
                case 'verbose':
                    if (isVerbose)
                        log.info(message);
                    break;
                }
            } else {
                switch (loggingLevel) {
                case 'success':
                    log.success(message);
                    break;
                case 'failure':
                    log.error(message);
                    break;
                case 'compact':
                    log.info(message);
                    break;
                case 'info':
                    break;
                case 'verbose':
                    break;
                }
            }
        }
    }

Link to comment
Share on other sites

Here you go.  and since it is my script to begin with its only fitting i modify it right lol.  I added the percentage as a parameter so you can change it if you want later, i defaulted it to 10 as you stated. I haven't tried it yet though

 

var config = {
    betPercentage: {
        label: 'percentage of total coins to bet',
        value: 0.25,
        type: 'number'
    },
    payout: {
        label: 'payout',
        value: 2,
        type: 'number'
    },
    onLoseTitle: {
        label: 'On Lose',
        type: 'title'
    },
    onLoss: {
        label: '',
        value: 'increase',
        type: 'radio',
        options: [{
                value: 'reset',
                label: 'Return to base bet'
            }, {
                value: 'increase',
                label: 'Increase bet by (loss multiplier)'
            }
        ]
    },
    lossMultiplier: {
        label: 'loss multiplier',
        value: 2,
        type: 'number'
    },
    onWinTitle: {
        label: 'On Win',
        type: 'title'
    },
    onWin: {
        label: '',
        value: 'reset',
        type: 'radio',
        options: [{
                value: 'reset',
                label: 'Return to base bet'
            }, {
                value: 'increase',
                label: 'Increase bet by (win multiplier)'
            }
        ]
    },
    winMultiplier: {
        label: 'win multiplier',
        value: 1,
        type: 'number'
    },
    otherConditionsTitle: {
        label: 'Other Stopping Conditions',
        type: 'title'
    },    
    winGoalAmount: {
        label: 'Stop once you have made this much',
        value: currency.amount * 2,
        type: 'number'
    },
    lossStopAmount: {
        label: 'Stop betting after losing this much without a win.',
        value: 0,
        type: 'number'
    },    
    winStopPercentage: {
        label: 'Stop betting after we win more than this percentage of starting bankroll.',
        value: 10,
        type: 'number'
    },    
    otherConditionsTitle: {
        label: 'Experimentle Please Ignore',
        type: 'title'
    },
    loggingLevel: {
        label: 'logging level',
        value: 'compact',
        type: 'radio',
        options: [{
                value: 'info',
                label: 'info'
            }, {
                value: 'compact',
                label: 'compact'
            }, {
                value: 'verbose',
                label: 'verbose'
            }
        ]
    }
};
// deleted input parameters
var stop = 0;
var lossesForBreak = 0;
var roundsToBreakFor = 0;

// end deleted parameters
var totalWagers = 0;
var netProfit = 0;
var totalWins = 0;
var totalLoses = 0;
var longestWinStreak = 0;
var longestLoseStreak = 0;
var currentStreak = 0;
var loseStreak = 0;
var numberOfRoundsToSkip = 0;
var currentBet = GetNewBaseBet();
var totalNumberOfGames = 0;
var originalbalance = currency.amount;
var stopWinAmount = originalbalance * (config.winStopPercentage.value/100);
var runningbalance = currency.amount;
var consequetiveLostBets = 0;
var lossStopAmountVar = config.lossStopAmount.value;

function main() {

    stopWinAmount = originalbalance * (config.winStopPercentage.value/100);

    game.onBet = function () {

        // if we are set to skip rounds then do so.
        if (numberOfRoundsToSkip > 0) {
            numberOfRoundsToSkip -= 1;
            log.info('Skipping round to relax, and the next ' + numberOfRoundsToSkip + ' rounds.');
            return;
        } else {
        
                if(totalNumberOfGames == 0)
                {
                    // this is so we account for the first round.
                    currentBet = GetNewBaseBet();
                }
                
                if(loseStreak >= 2)
                {
                    if(game.history[0].crash > 200)
                    {
                        loseStreak = 0;
                    }
                    else
                    {
                        log.info('Not betting until current loseStreak is over.');
                        return;
                    }                    
                }

            log.info('Placed bet for the amount of ' + currentBet);
            if(netProfit > stopWinAmount)
            {
                log.info('Stopping because we made enough.')
                game.stop();
            }
            game.bet(currentBet, config.payout.value).then(function (payout) {
                runningbalance -= currentBet;
                totalWagers += currentBet;
                totalNumberOfGames += 1;

                if (payout > 1) {
                    var netwin = currentBet * config.payout.value - currentBet;
                    consequetiveLostBets = 0;
                    if(config.loggingLevel.value != 'compact')
                    {
                        LogMessage('We won a net profit of: ' + netwin.toFixed(8), 'success');
                    }
                    netProfit += netwin;
                    runningbalance += netwin + currentBet;

                    if (loseStreak > 0) {
                        loseStreak = 0;
                    }

                    currentStreak += 1;
                    totalWins += 1;

                    LogSummary('true', currentBet);

                    if (config.onWin.value === 'reset') {
                        currentBet = GetNewBaseBet();
                    } else {
                        currentBet *= config.winMultiplier.value;
                    }

                    LogMessage('We won, so next bet will be ' + currentBet.toFixed(8) + ' ' + currency.currencyName, 'success');
                } else {
                        log.error('We lost a net amount of: ' + currentBet.toFixed(8));
                        netProfit -= currentBet;
                        loseStreak += 1;
                        currentStreak = 0;
                        totalLoses += 1;
                        consequetiveLostBets += currentBet;

                        LogSummary('false', currentBet);

                        if (config.onLoss.value == 'reset') {
                            currentBet = GetNewBaseBet();
                        } else {
                            currentBet *= config.lossMultiplier.value;
                        }
                            LogMessage('We lost, so next bet will be ' + currentBet.toFixed(8) + ' ' + currency.currencyName, 'failure');            
                    }

                    if (currentStreak > longestWinStreak) {
                        longestWinStreak = currentStreak;
                    }
                    if (loseStreak > longestLoseStreak) {
                        longestLoseStreak = loseStreak;
                    }

                    recordStats();

                    if (config.winGoalAmount.value != 0 && netProfit > config.winGoalAmount.value) {
                        // we have earned enough stop and quit.
                        log.success('The net profits ' + netProfit.toFixed(8) + ' which triggers stop the for making enough.');
                        game.stop();
                    }
                    if (lossStopAmountVar != 0 && consequetiveLostBets > (lossStopAmountVar)) {
                        // the point of this is to limit the bleed so you don't loose too much.
                        log.error('The net profits ' + netProfit.toFixed(8) + ' which triggers stop for losing enough. The next bet would be ' + currentBet.toFixed(8) + '.');
                        game.stop();
                    }
                }
            );
        }
    };
    }

    function recordStats() {
        if (config.loggingLevel.value != 'compact') {
            LogMessage('total wagers: ' + totalWagers.toFixed(8), 'info');
            LogMessage('Net Profit: ' + netProfit.toFixed(8), 'info');
            LogMessage('Current win streak: ' + currentStreak, 'info');
            LogMessage('Current Lose streak: ' + loseStreak, 'info');
            LogMessage('Total wins: ' + totalWins, 'info');
            LogMessage('Total Losses: ' + totalLoses, 'info');
            LogMessage('Longest win streak: ' + longestWinStreak, 'info');
            LogMessage('Longest lose streak: ' + longestLoseStreak, 'info');
        }
    }

    function GetNewBaseBet() {
        var returnValue = 0;
        returnValue = runningbalance * (config.betPercentage.value / 100);

        if(returnValue > currency.minAmount)
        {
            LogMessage('Recalculating base bet to ' + returnValue.toFixed(8) + ' which is ' + config.betPercentage.value + ' percent of ' + runningbalance.toFixed(8), 'info');
        }
        else
        {
            LogMessage('The recalculated bet amount ' + returnValue.toFixed(8) + ' is lower than the minimum allowed bet.  Setting bet to the minimum allowable amount of ' + currency.minAmount, 'info');
            returnValue = currency.minAmount;
        }

        return returnValue;
    }

    function LogSummary(wasWinner, betAmount) {
        if (config.loggingLevel.value == 'compact') {
            if (wasWinner == 'true') {
                var winAmount = (betAmount * config.payout.value) - betAmount;
                log.success('Winner!! You won ' + winAmount.toFixed(8));
            } else {
                log.error('Loser!! You lost ' + betAmount.toFixed(8));
            }
            var winPercentage = (totalWins / totalNumberOfGames) * 100;
            var losePercentage = (totalLoses / totalNumberOfGames) * 100;

            log.info('Total Games: ' + totalNumberOfGames);
            log.info('Wins: ' + totalWins + '(' + winPercentage.toFixed(2) + ' % )');
            log.info('Loses: ' + totalLoses + '(' + losePercentage.toFixed(2) + ' % )');

            var netNumber = runningbalance - originalbalance;
            var netPecentage = (netNumber / originalbalance) * 100;

            if (originalbalance < runningbalance) {
                log.success('Total Profit: ' + netNumber.toFixed(8) + '(' + netPecentage.toFixed(2) + '%)');
            } else {
                log.error('Total Profit: ' + netNumber.toFixed(8) + '(' + netPecentage.toFixed(2) + '%)');
            }
        }

    }

    /// Determines whether or not to log an event or not to make it easier later
    function LogMessage(message, loggingLevel) {
        if (message) {

            if (config.loggingLevel.value != 'compact') {
                switch (loggingLevel) {
                case 'success':
                    log.success(message);
                    break;
                case 'failure':
                    log.error(message);
                    break;
                case 'info':
                    log.info(message);
                    break;
                case 'compact':
                    break;
                case 'verbose':
                    if (isVerbose)
                        log.info(message);
                    break;
                }
            } else {
                switch (loggingLevel) {
                case 'success':
                    log.success(message);
                    break;
                case 'failure':
                    log.error(message);
                    break;
                case 'compact':
                    log.info(message);
                    break;
                case 'info':
                    break;
                case 'verbose':
                    break;
                }
            }
        }
    }

Link to comment
Share on other sites

Thanks, I'll let you know soon if it works correctly

if i want to set a stop win this code is ok? and where is it to be inserted?

 

var config = {
  stopOnLose: {label: 'Stop after losing this much', value: currency.amount/2, type:'number'}

}
  


function main () {
  var loseCount = 0;
  var betCount = 0;
  var betAmount = config.bet.value;
  var maxLosecount = 0 ;
  var netWinLose = 0;

  game.onBet = function () {
    game.bet(betAmount, config.payout.value).then(function(payout) {
      betCount++;
      if (payout > 1) {
      netWinLose = (betAmount*payout)-betAmount;
        betAmount = config.bet.value;
        loseCount = 0;
        log.success("Won");
      } else {
        netWinLose -= betAmount;
        log.error("Lost " + betAmount);
        loseCount++;
        if(loseCount == config.streak.value){
          betAmount *= (config.streak.value * 10);
        }
        if (loseCount > config.streak.value){
          betAmount *= 2;
        }
        if (loseCount == config.maxStreak.value){
          betAmount = config.bet.value;
        }
        if( maxLosecount < loseCount){
          maxLosecount = loseCount;
        }
      }
      
      if( (-1*netWinLose) >= stopOnLose )
      {
        game.stop();
      }
      
      console.log(
          " betCount " + betCount +
          " betAmount " + betAmount +
          " loseCount " + loseCount + 
          " maxLosecount " + maxLosecount
        );
    });
  }
}

 

30 minutes ago, Skele said:

Here you go.  and since it is my script to begin with its only fitting i modify it right lol.  I added the percentage as a parameter so you can change it if you want later, i defaulted it to 10 as you stated. I haven't tried it yet though

 

var config = {
    betPercentage: {
        label: 'percentage of total coins to bet',
        value: 0.25,
        type: 'number'
    },
    payout: {
        label: 'payout',
        value: 2,
        type: 'number'
    },
    onLoseTitle: {
        label: 'On Lose',
        type: 'title'
    },
    onLoss: {
        label: '',
        value: 'increase',
        type: 'radio',
        options: [{
                value: 'reset',
                label: 'Return to base bet'
            }, {
                value: 'increase',
                label: 'Increase bet by (loss multiplier)'
            }
        ]
    },
    lossMultiplier: {
        label: 'loss multiplier',
        value: 2,
        type: 'number'
    },
    onWinTitle: {
        label: 'On Win',
        type: 'title'
    },
    onWin: {
        label: '',
        value: 'reset',
        type: 'radio',
        options: [{
                value: 'reset',
                label: 'Return to base bet'
            }, {
                value: 'increase',
                label: 'Increase bet by (win multiplier)'
            }
        ]
    },
    winMultiplier: {
        label: 'win multiplier',
        value: 1,
        type: 'number'
    },
    otherConditionsTitle: {
        label: 'Other Stopping Conditions',
        type: 'title'
    },    
    winGoalAmount: {
        label: 'Stop once you have made this much',
        value: currency.amount * 2,
        type: 'number'
    },
    lossStopAmount: {
        label: 'Stop betting after losing this much without a win.',
        value: 0,
        type: 'number'
    },    
    winStopPercentage: {
        label: 'Stop betting after we win more than this percentage of starting bankroll.',
        value: 10,
        type: 'number'
    },    
    otherConditionsTitle: {
        label: 'Experimentle Please Ignore',
        type: 'title'
    },
    loggingLevel: {
        label: 'logging level',
        value: 'compact',
        type: 'radio',
        options: [{
                value: 'info',
                label: 'info'
            }, {
                value: 'compact',
                label: 'compact'
            }, {
                value: 'verbose',
                label: 'verbose'
            }
        ]
    }
};
// deleted input parameters
var stop = 0;
var lossesForBreak = 0;
var roundsToBreakFor = 0;

// end deleted parameters
var totalWagers = 0;
var netProfit = 0;
var totalWins = 0;
var totalLoses = 0;
var longestWinStreak = 0;
var longestLoseStreak = 0;
var currentStreak = 0;
var loseStreak = 0;
var numberOfRoundsToSkip = 0;
var currentBet = GetNewBaseBet();
var totalNumberOfGames = 0;
var originalbalance = currency.amount;
var stopWinAmount = originalbalance * (config.winStopPercentage.value/100);
var runningbalance = currency.amount;
var consequetiveLostBets = 0;
var lossStopAmountVar = config.lossStopAmount.value;

function main() {

    stopWinAmount = originalbalance * (config.winStopPercentage.value/100);

    game.onBet = function () {

        // if we are set to skip rounds then do so.
        if (numberOfRoundsToSkip > 0) {
            numberOfRoundsToSkip -= 1;
            log.info('Skipping round to relax, and the next ' + numberOfRoundsToSkip + ' rounds.');
            return;
        } else {
        
                if(totalNumberOfGames == 0)
                {
                    // this is so we account for the first round.
                    currentBet = GetNewBaseBet();
                }
                
                if(loseStreak >= 2)
                {
                    if(game.history[0].crash > 200)
                    {
                        loseStreak = 0;
                    }
                    else
                    {
                        log.info('Not betting until current loseStreak is over.');
                        return;
                    }                    
                }

            log.info('Placed bet for the amount of ' + currentBet);
            if(netProfit > stopWinAmount)
            {
                log.info('Stopping because we made enough.')
                game.stop();
            }
            game.bet(currentBet, config.payout.value).then(function (payout) {
                runningbalance -= currentBet;
                totalWagers += currentBet;
                totalNumberOfGames += 1;

                if (payout > 1) {
                    var netwin = currentBet * config.payout.value - currentBet;
                    consequetiveLostBets = 0;
                    if(config.loggingLevel.value != 'compact')
                    {
                        LogMessage('We won a net profit of: ' + netwin.toFixed(8), 'success');
                    }
                    netProfit += netwin;
                    runningbalance += netwin + currentBet;

                    if (loseStreak > 0) {
                        loseStreak = 0;
                    }

                    currentStreak += 1;
                    totalWins += 1;

                    LogSummary('true', currentBet);

                    if (config.onWin.value === 'reset') {
                        currentBet = GetNewBaseBet();
                    } else {
                        currentBet *= config.winMultiplier.value;
                    }

                    LogMessage('We won, so next bet will be ' + currentBet.toFixed(8) + ' ' + currency.currencyName, 'success');
                } else {
                        log.error('We lost a net amount of: ' + currentBet.toFixed(8));
                        netProfit -= currentBet;
                        loseStreak += 1;
                        currentStreak = 0;
                        totalLoses += 1;
                        consequetiveLostBets += currentBet;

                        LogSummary('false', currentBet);

                        if (config.onLoss.value == 'reset') {
                            currentBet = GetNewBaseBet();
                        } else {
                            currentBet *= config.lossMultiplier.value;
                        }
                            LogMessage('We lost, so next bet will be ' + currentBet.toFixed(8) + ' ' + currency.currencyName, 'failure');            
                    }

                    if (currentStreak > longestWinStreak) {
                        longestWinStreak = currentStreak;
                    }
                    if (loseStreak > longestLoseStreak) {
                        longestLoseStreak = loseStreak;
                    }

                    recordStats();

                    if (config.winGoalAmount.value != 0 && netProfit > config.winGoalAmount.value) {
                        // we have earned enough stop and quit.
                        log.success('The net profits ' + netProfit.toFixed(8) + ' which triggers stop the for making enough.');
                        game.stop();
                    }
                    if (lossStopAmountVar != 0 && consequetiveLostBets > (lossStopAmountVar)) {
                        // the point of this is to limit the bleed so you don't loose too much.
                        log.error('The net profits ' + netProfit.toFixed(8) + ' which triggers stop for losing enough. The next bet would be ' + currentBet.toFixed(8) + '.');
                        game.stop();
                    }
                }
            );
        }
    };
    }

    function recordStats() {
        if (config.loggingLevel.value != 'compact') {
            LogMessage('total wagers: ' + totalWagers.toFixed(8), 'info');
            LogMessage('Net Profit: ' + netProfit.toFixed(8), 'info');
            LogMessage('Current win streak: ' + currentStreak, 'info');
            LogMessage('Current Lose streak: ' + loseStreak, 'info');
            LogMessage('Total wins: ' + totalWins, 'info');
            LogMessage('Total Losses: ' + totalLoses, 'info');
            LogMessage('Longest win streak: ' + longestWinStreak, 'info');
            LogMessage('Longest lose streak: ' + longestLoseStreak, 'info');
        }
    }

    function GetNewBaseBet() {
        var returnValue = 0;
        returnValue = runningbalance * (config.betPercentage.value / 100);

        if(returnValue > currency.minAmount)
        {
            LogMessage('Recalculating base bet to ' + returnValue.toFixed(8) + ' which is ' + config.betPercentage.value + ' percent of ' + runningbalance.toFixed(8), 'info');
        }
        else
        {
            LogMessage('The recalculated bet amount ' + returnValue.toFixed(8) + ' is lower than the minimum allowed bet.  Setting bet to the minimum allowable amount of ' + currency.minAmount, 'info');
            returnValue = currency.minAmount;
        }

        return returnValue;
    }

    function LogSummary(wasWinner, betAmount) {
        if (config.loggingLevel.value == 'compact') {
            if (wasWinner == 'true') {
                var winAmount = (betAmount * config.payout.value) - betAmount;
                log.success('Winner!! You won ' + winAmount.toFixed(8));
            } else {
                log.error('Loser!! You lost ' + betAmount.toFixed(8));
            }
            var winPercentage = (totalWins / totalNumberOfGames) * 100;
            var losePercentage = (totalLoses / totalNumberOfGames) * 100;

            log.info('Total Games: ' + totalNumberOfGames);
            log.info('Wins: ' + totalWins + '(' + winPercentage.toFixed(2) + ' % )');
            log.info('Loses: ' + totalLoses + '(' + losePercentage.toFixed(2) + ' % )');

            var netNumber = runningbalance - originalbalance;
            var netPecentage = (netNumber / originalbalance) * 100;

            if (originalbalance < runningbalance) {
                log.success('Total Profit: ' + netNumber.toFixed(8) + '(' + netPecentage.toFixed(2) + '%)');
            } else {
                log.error('Total Profit: ' + netNumber.toFixed(8) + '(' + netPecentage.toFixed(2) + '%)');
            }
        }

    }

    /// Determines whether or not to log an event or not to make it easier later
    function LogMessage(message, loggingLevel) {
        if (message) {

            if (config.loggingLevel.value != 'compact') {
                switch (loggingLevel) {
                case 'success':
                    log.success(message);
                    break;
                case 'failure':
                    log.error(message);
                    break;
                case 'info':
                    log.info(message);
                    break;
                case 'compact':
                    break;
                case 'verbose':
                    if (isVerbose)
                        log.info(message);
                    break;
                }
            } else {
                switch (loggingLevel) {
                case 'success':
                    log.success(message);
                    break;
                case 'failure':
                    log.error(message);
                    break;
                case 'compact':
                    log.info(message);
                    break;
                case 'info':
                    break;
                case 'verbose':
                    break;
                }
            }
        }
    }

it works, the only thing is that if he wins the base bet he rebets again and then stops, he should win the base bet and stops

for testing I set the percentage to 0.5

 

Placed bet for the amount of 0.023851665462500005
Winner!! You won 0.02385167
Total Games: 3
Wins: 2(66.67 % )
Loses: 1(33.33 % )
Total Profit: 0.04764385(0.50%)
We won, so next bet will be 0.02391129 USDT
Placed bet for the amount of 0.02391129462615625
Stopping because we made enough.
Script is stopped!
Link to comment
Share on other sites

he doesn't actually rebet the if statement is above the betting statement.  So it should stop before it gets to the next bet.  Its right at  before the bet if(netProfit > stopwin) and stopwin is (initialbalance * (stopWinPercentage/100)). so i it may just be logging issues. i will have to look..

 

Link to comment
Share on other sites

1 minute ago, Skele said:

he doesn't actually rebet the if statement is above the betting statement.  So it should stop before it gets to the next bet.  Its right at  before the bet if(netProfit > stopwin) and stopwin is (initialbalance * (stopWinPercentage/100)). so i it may just be logging issues. i will have to look..

 

could you also introduce the stop loss at 10% of the initial budget loss?

Link to comment
Share on other sites

i could or you could take your balance and subtract 10% and put the value in the stop loss field that way, i could default it to 10% if you want.

Link to comment
Share on other sites

1 minute ago, Skele said:

i could or you could take your balance and subtract 10% and put the value in the stop loss field that way, i could default it to 10% if you want.

where?

Stop betting after losing this much without a win.
here?
Link to comment
Share on other sites

so so i started to do this and i am wondering if this is really what you want.  So currently the stop loss it based off your balance after your last win.  So if you set it to 5$ for instance and you get up to 10$ and then start to lose it still stop when you still have 5$ profit.  As opposed to how the auto and play works where if you were up to 10$ profit, and the stop loss was set to -5$ you would have to lose 15$ before the script would stop.  So do you want it to be 10% of the balance after the last win, or just 10% of the initial balance.  Where this comes into play is when you actually make some reasonable money.  say you start with 10$ balance so your stop loss would be 1, but the script builds your balance up to like 30$, would you want your stop loss to stay at 1$ or should it have risen proportionally until it would then be at 3$.

correct, that takes an amount of coin to lose before it stops

Link to comment
Share on other sites

5 minutes ago, Skele said:

so so i started to do this and i am wondering if this is really what you want.  So currently the stop loss it based off your balance after your last win.  So if you set it to 5$ for instance and you get up to 10$ and then start to lose it still stop when you still have 5$ profit.  As opposed to how the auto and play works where if you were up to 10$ profit, and the stop loss was set to -5$ you would have to lose 15$ before the script would stop.  So do you want it to be 10% of the balance after the last win, or just 10% of the initial balance.  Where this comes into play is when you actually make some reasonable money.  say you start with 10$ balance so your stop loss would be 1, but the script builds your balance up to like 30$, would you want your stop loss to stay at 1$ or should it have risen proportionally until it would then be at 3$.

correct, that takes an amount of coin to lose before it stops

EXACT I WOULD LIKE MY STOPP LOSS TO ALWAYS REMAIN THE ONE I SET AT THE BEGINNING, HOW DO I DO IT?

Link to comment
Share on other sites

oh and i checked and it is just a placement of the logs issue it isn't actually betting just move this line:
log.info('Placed bet for the amount of ' + currentBet);

to be just above the bet and delow the stopwin check

like so:

            if(netProfit > stopWinAmount)
            {
                log.info('Stopping because we made enough.')
                game.stop();
            }
            
            log.info('Placed bet for the amount of ' + currentBet);
            game.bet(currentBet, config.payout.value).then(function (payout) {

if you want it to always remain 1 then you can just calc it at the start and put it into the stopafterlossingthis much without a win

if you are going for 10% its super simple just take your balance and shift the decimal one place to the left and your done.

Link to comment
Share on other sites

8 minutes ago, Skele said:

oh and i checked and it is just a placement of the logs issue it isn't actually betting just move this line:
log.info('Placed bet for the amount of ' + currentBet);

to be just above the bet and delow the stopwin check

like so:

            if(netProfit > stopWinAmount)
            {
                log.info('Stopping because we made enough.')
                game.stop();
            }
            
            log.info('Placed bet for the amount of ' + currentBet);
            game.bet(currentBet, config.payout.value).then(function (payout) {

if you want it to always remain 1 then you can just calc it at the start and put it into the stopafterlossingthis much without a win

if you are going for 10% its super simple just take your balance and shift the decimal one place to the left and your done.

I HAVE NOTICED THAT IN ABOUT 6H IF ALL GOES WELL YOU HAVE A 100% RETURN, CAN YOU INSERT A FUNCTION THAT AS SOON AS THE SCRIPT HAS BEEN EXECUTING FOR 6H DOES IT STOP?

Link to comment
Share on other sites

I could but profit amount is a much better way to go about it.  with Stop on win, really being the deciding factor, i normally have stop on win set to 100%, and you can get 100% a lot faster than 6 hours depending on kind of numbers are trending at the time.

 

Link to comment
Share on other sites

Just now, Skele said:

I could but profit amount is a much better way to go about it.  with Stop on win, really being the deciding factor, i normally have stop on win set to 100%, and you can get 100% a lot faster than 6 hours depending on kind of numbers are trending at the time.

 

YES I REALIZED THAT STOP WIN IS BETTER

3 minutes ago, Cristian2 said:

 

COULD I HAVE THE NICKNAME OF ONE OF YOUR SOCIAL SOCIAL SO I CAN CONTACT YOU MORE QUICKLY?

21 minutes ago, Skele said:

I could but profit amount is a much better way to go about it.  with Stop on win, really being the deciding factor, i normally have stop on win set to 100%, and you can get 100% a lot faster than 6 hours depending on kind of numbers are trending at the time.

 

I tried setting the stopp loss at 0.026 and even losing that figure it doesn't stop, I also tried without the -, why?

unnamed.jpg

Link to comment
Share on other sites

I've added a percentage for stop loss it will look at the currentAmount and if the bet is more than 10%(0.1) of the total currentAmount will stop the script: 
Maybe later I'll try to implement the backtest for this but I have noticed that almost any pattern or strategy at the end will have same win chance of 50% and similar streak loss  in the long run.

var config = {
  betPercentage: {
    label: 'percentage of total coins to bet',
    value: 0.25,
    type: 'number'
  },
  payout: {
    label: 'payout',
    value: 2,
    type: 'number'
  },
  onLoseTitle: {
    label: 'On Lose',
    type: 'title'
  },
  onLoss: {
    label: '',
    value: 'increase',
    type: 'radio',
    options: [{
      value: 'reset',
      label: 'Return to base bet'
    }, {
      value: 'increase',
      label: 'Increase bet by (loss multiplier)'
    }
    ]
  },
  lossMultiplier: {
    label: 'loss multiplier',
    value: 2,
    type: 'number'
  },
  onWinTitle: {
    label: 'On Win',
    type: 'title'
  },
  onWin: {
    label: '',
    value: 'reset',
    type: 'radio',
    options: [{
      value: 'reset',
      label: 'Return to base bet'
    }, {
      value: 'increase',
      label: 'Increase bet by (win multiplier)'
    }
    ]
  },
  winMultiplier: {
    label: 'win multiplier',
    value: 1,
    type: 'number'
  },
  otherConditionsTitle: {
    label: 'Other Stopping Conditions',
    type: 'title'
  },
  winGoalAmount: {
    label: 'Stop once you have made this much',
    value: currency.amount * 2,
    type: 'number'
  },
  lossStopAmount: {
    label: 'Stop betting after losing this much without a win.',
    value: 0,
    type: 'number'
  },
  lossStopPercentage: {
    label: 'Stop betting after losing this percetange of current amount',
    value: 0.1,
    type: 'number'
  },
  otherConditionsTitle: {
    label: 'Experimentle Please Ignore',
    type: 'title'
  },
  loggingLevel: {
    label: 'logging level',
    value: 'compact',
    type: 'radio',
    options: [{
      value: 'info',
      label: 'info'
    }, {
      value: 'compact',
      label: 'compact'
    }, {
      value: 'verbose',
      label: 'verbose'
    }
    ]
  }
};
// deleted input parameters
var stop = 0;
var lossesForBreak = 0;
var roundsToBreakFor = 0;

// end deleted parameters
var totalWagers = 0;
var netProfit = 0;
var totalWins = 0;
var totalLoses = 0;
var longestWinStreak = 0;
var longestLoseStreak = 0;
var currentStreak = 0;
var loseStreak = 0;
var numberOfRoundsToSkip = 0;
var currentBet = GetNewBaseBet();
var totalNumberOfGames = 0;
var originalbalance = currency.amount;
var runningbalance = currency.amount;
var consequetiveLostBets = 0;
var lossStopAmountVar = config.lossStopAmount.value;

function main () {

  game.onBet = function () {

    // if we are set to skip rounds then do so.
    if (numberOfRoundsToSkip > 0) {
      numberOfRoundsToSkip -= 1;
      log.info('Skipping round to relax, and the next ' + numberOfRoundsToSkip + ' rounds.');
      return;
    } else {

      if (totalNumberOfGames == 0) {
        // this is so we account for the first round.
        currentBet = GetNewBaseBet();
      }

      if (loseStreak >= 2) {
        if (game.history[0].crash > 200) {
          loseStreak = 0;
        }
        else {
          log.info('Not betting until current loseStreak is over.');
          return;
        }
      }

      log.info('Placed bet for the amount of ' + currentBet);
      game.bet(currentBet, config.payout.value).then(function (payout) {
        runningbalance -= currentBet;
        totalWagers += currentBet;
        totalNumberOfGames += 1;

        if (payout > 1) {
          var netwin = currentBet * config.payout.value - currentBet;
          consequetiveLostBets = 0;
          if (config.loggingLevel.value != 'compact') {
            LogMessage('We won a net profit of: ' + netwin.toFixed(8), 'success');
          }
          netProfit += netwin;
          runningbalance += netwin + currentBet;

          if (loseStreak > 0) {
            loseStreak = 0;
          }

          currentStreak += 1;
          totalWins += 1;

          LogSummary('true', currentBet);

          if (config.onWin.value === 'reset') {
            currentBet = GetNewBaseBet();
          } else {
            currentBet *= config.winMultiplier.value;
          }

          LogMessage('We won, so next bet will be ' + currentBet.toFixed(8) + ' ' + currency.currencyName, 'success');
        } else {
          log.error('We lost a net amount of: ' + currentBet.toFixed(8));
          netProfit -= currentBet;
          loseStreak += 1;
          currentStreak = 0;
          totalLoses += 1;
          consequetiveLostBets += currentBet;
          
          LogSummary('false', currentBet);
          
          if (config.onLoss.value == 'reset') {
            currentBet = GetNewBaseBet();
          } else {
            currentBet *= config.lossMultiplier.value;
          }
          LogMessage('We lost, so next bet will be ' + currentBet.toFixed(8) + ' ' + currency.currencyName, 'failure');
        }

        if (currentBet >= runningbalance * config.lossStopPercentage.value) {
          log.error('CurrentBet is more than 10% of running balance The net profits ' + netProfit.toFixed(8) + ' which triggers stop for losing enough. The next bet would be ' + currentBet.toFixed(8) + '.');
          game.stop();
        }

        if (currentStreak > longestWinStreak) {
          longestWinStreak = currentStreak;
        }
        if (loseStreak > longestLoseStreak) {
          longestLoseStreak = loseStreak;
        }

        recordStats();

        if (config.winGoalAmount.value != 0 && netProfit > config.winGoalAmount.value) {
          // we have earned enough stop and quit.
          log.success('The net profits ' + netProfit.toFixed(8) + ' which triggers stop the for making enough.');
          game.stop();
        }
        if (lossStopAmountVar != 0 && consequetiveLostBets > config.lossStopAmount) {
          // the point of this is to limit the bleed so you don't loose too much.
          log.error('The net profits ' + netProfit.toFixed(8) + ' which triggers stop for losing enough. The next bet would be ' + currentBet.toFixed(8) + '.');
          game.stop();
        }
      }
      );
    }
  };
}

function recordStats () {
  if (config.loggingLevel.value != 'compact') {
    LogMessage('total wagers: ' + totalWagers.toFixed(8), 'info');
    LogMessage('Net Profit: ' + netProfit.toFixed(8), 'info');
    LogMessage('Current win streak: ' + currentStreak, 'info');
    LogMessage('Current Lose streak: ' + loseStreak, 'info');
    LogMessage('Total wins: ' + totalWins, 'info');
    LogMessage('Total Losses: ' + totalLoses, 'info');
    LogMessage('Longest win streak: ' + longestWinStreak, 'info');
    LogMessage('Longest lose streak: ' + longestLoseStreak, 'info');
  }
}

function GetNewBaseBet () {
  var returnValue = 0;
  returnValue = runningbalance * (config.betPercentage.value / 100);

  if (returnValue > currency.minAmount) {
    LogMessage('Recalculating base bet to ' + returnValue.toFixed(8) + ' which is ' + config.betPercentage.value + ' percent of ' + runningbalance.toFixed(8), 'info');
  }
  else {
    LogMessage('The recalculated bet amount ' + returnValue.toFixed(8) + ' is lower than the minimum allowed bet.  Setting bet to the minimum allowable amount of ' + currency.minAmount, 'info');
    returnValue = currency.minAmount;
  }

  return returnValue;
}

function LogSummary (wasWinner, betAmount) {
  if (config.loggingLevel.value == 'compact') {
    if (wasWinner == 'true') {
      var winAmount = (betAmount * config.payout.value) - betAmount;
      log.success('Winner!! You won ' + winAmount.toFixed(8));
    } else {
      log.error('Loser!! You lost ' + betAmount.toFixed(8));
    }
    var winPercentage = (totalWins / totalNumberOfGames) * 100;
    var losePercentage = (totalLoses / totalNumberOfGames) * 100;

    log.info('Total Games: ' + totalNumberOfGames);
    log.info('Wins: ' + totalWins + '(' + winPercentage.toFixed(2) + ' % )');
    log.info('Loses: ' + totalLoses + '(' + losePercentage.toFixed(2) + ' % )');

    var netNumber = runningbalance - originalbalance;
    var netPecentage = (netNumber / originalbalance) * 100;

    if (originalbalance < runningbalance) {
      log.success('Total Profit: ' + netNumber.toFixed(8) + '(' + netPecentage.toFixed(2) + '%)');
    } else {
      log.error('Total Profit: ' + netNumber.toFixed(8) + '(' + netPecentage.toFixed(2) + '%)');
    }
  }

}

/// Determines whether or not to log an event or not to make it easier later
function LogMessage (message, loggingLevel) {
  if (message) {

    if (config.loggingLevel.value != 'compact') {
      switch (loggingLevel) {
        case 'success':
          log.success(message);
          break;
        case 'failure':
          log.error(message);
          break;
        case 'info':
          log.info(message);
          break;
        case 'compact':
          break;
        case 'verbose':
          if (isVerbose)
            log.info(message);
          break;
      }
    } else {
      switch (loggingLevel) {
        case 'success':
          log.success(message);
          break;
        case 'failure':
          log.error(message);
          break;
        case 'compact':
          log.info(message);
          break;
        case 'info':
          break;
        case 'verbose':
          break;
      }
    }
  }
}

 

Edited by Bivodudqeub
Link to comment
Share on other sites

Il 16/01/2023 alle 13:15, Skele ha detto:

 

Ecco qua. E dato che è il mio script per cominciare, è l'unico appropriato, lo modifico bene lol. Ho aggiunto la percentuale come parametro in modo da poterla cambiare se vuoi più tardi, l'ho impostata di default a 10 come hai detto. Però non l'ho ancora provato

 

var config = {
percentuale di bet: {
etichetta: "percentuale del totale

 

to set 10% do I have to put 0.1 in the box? 20%=0.2 etc?

Link to comment
Share on other sites

7 minutes ago, Cristian2 said:

to set 10% do I have to put 0.1 in the box? 20%=0.2 etc?

yes exactly! I've tried a couple of times and both times got stop before betting more than 10% of the current amount.

Edited by Bivodudqeub
Link to comment
Share on other sites

thats because if you look at the code  it checks the stoploss such that its (theamountcurrentlyLost+thenextbetamount) > stoploss then stop.  The reason for this is well if i only want to lost 10$ and i start betting at 20$ i d9on't expect it to let me risk more than i am willing to lose.  Martingale in general is not a sustainable strategy.  You will have better success with doing something like hunting 10x with a 12% increase on loss, but only starting to bet after you have seen 20 or 30 red games in a row, or something of that nature.  But even there if you look at the stats, most of the time its going to hit before the first 20 games, which is fine, but you also have some run away red streaks where it may go 70 games before hitting a 10x.

Personally i prefer limbo because its faster and although you can't skip games there you can min bet instead which is almost the same thing, then only bet on games that have a higher probability of being winning games.  Because it is so much faster than crash you also start to see little patterns that can sometimes be used to your advantage like a good portion of the time 10x games seem to come in clusters. etc..

As far as my socials go my TG is https://t.me/Skele69 and my discord is skele69#6388

I don't monitor the forums much because i get a bunch of spam emails from the 2$ shit links for everyone scammer. So i just started ignoring all of them.

Link to comment
Share on other sites

On 1/28/2023 at 1:23 PM, Bivodudqeub said:

yes exactly! I've tried a couple of times and both times got stop before betting more than 10% of the current amount.

I noticed that if I impose 0.1 in it doesn't stop with 1% loss not 10%, so I have to put 1

Link to comment
Share on other sites

7 hours ago, Cristian2 said:

I noticed that if I impose 0.1 in it doesn't stop with 1% loss not 10%, so I have to put 1

It should work I only added this part to the code 
 

  if (currentBet >= runningbalance * config.lossStopPercentage.value) {
          log.error('CurrentBet is more than 10% of running balance The net profits ' + netProfit.toFixed(8) + ' which triggers stop for losing enough. The next bet would be ' + currentBet.toFixed(8) + '.');
          currentBet = GetNewBaseBet();
        }

currentBet is more or equal than runningbalance * 0.1,

take a look my XML balance was 15 and it stopped the game before betting more than 10% of my current XML 


image.thumb.png.47bdb97d4aa325e8ff77988bc17fde05.png

Link to comment
Share on other sites

On 1/30/2023 at 3:32 AM, Bivodudqeub said:

It should work I only added this part to the code 
 

  if (currentBet >= runningbalance * config.lossStopPercentage.value) {
          log.error('CurrentBet is more than 10% of running balance The net profits ' + netProfit.toFixed(8) + ' which triggers stop for losing enough. The next bet would be ' + currentBet.toFixed(8) + '.');
          currentBet = GetNewBaseBet();
        }

currentBet is more or equal than runningbalance * 0.1,

take a look my XML balance was 15 and it stopped the game before betting more than 10% of my current XML 


/cdn-cgi/mirage/b4bd2dd410e96a7a394a40b3c6e387ba9234f6d4f38b3fd306c18fda094f4791/1280/https://forum.bc.game/uploads/monthly_2023_01/image.thumb.png.47bdb97d4aa325e8ff77988bc17fde05.png

Can you write me the whole code with this last part?

Link to comment
Share on other sites

On 2/2/2023 at 10:28 PM, Cristian2 said:

Can you write me the whole code with this last part?

is this one 

but let me save you some money and avoid using it, I tried a handful of times and never manage to double my balance, that pattern of cutting losses every two losses is not such a good strategy, it could work maybe in the beginning if you are lucky. 

Link to comment
Share on other sites

You need to be a member in order to leave a comment

Sign up for a new account in our community. It's easy!

Register a new account

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...