Martingale Strategy Calculator

Calculate betting strategy based on desired profit and number of rolls to target that profit. Console log has list of bets to be made.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
    // @name         Martingale Strategy Calculator
    // @version      1.0
    // @description  Calculate betting strategy based on desired profit and number of rolls to target that profit. Console log has list of bets to be made.
    // @description  See 
    // @description  Please sign up using my ref link:
    // @description  Would be happy about a donation when you make money with the script! > BTC
    // @author       rorg314
    // @match        https://freebitco.in/?op=home
    // @match        https://freebitco.in/?op=home#
    // @match        https://freebitco.in/
    // @match        https://freebitco.in/*
    // @require      http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js

// @namespace https://greasyfork.org/users/583382
// ==/UserScript==


//Config values//
var n = 1;
var betlast = 0;
var testbet = 0;
var nmax = 100;
var profit =0;
var rolls = 0;
var dprof = 0;
var cumsum = 0;
var minbet = [];
var cumsumarray = [];
var tries=0;
var testcum = 0;
var testprofit = 0;
var maxroll = 0;
//USER VALUES//
var odd = 5; //Desired odds
var npmax = 4; //Desired number of rolls win max profit
var iniprof = 100; // Desired max profit
var maxSpend = 500000; // Desired max spend before lose
//USER VALUES//

//FUNCTIONS//
//Test bet required to reach desired profit value (after n rolls)
function testprof() {
	testcum = cumsum;
	testbet=0;
	testprofit = odd*testbet-testcum;
	while(testprofit <= dprof){
	testbet++;
	testcum++;
	testprofit = odd*testbet-testcum;
	}
}
//Test the bet required on the n-th roll
function testn() {
	if(cumsum < maxSpend){
			if(n<=npmax){dprof = iniprof;} else {dprof = 1;} //switch to break even after npmax rolls
	testprof(); //Call testprof
	betlast = testbet;
	cumsum = cumsum + betlast;
	cumsumarray[n] = cumsum;
	minbet[n] = testbet;
	n++;
	}
    else{maxroll = n; nmax = n;}//stop if bet over max
}

while(n<nmax){ testn();}

console.log(minbet);
console.log('Max lose streak = ' + maxroll);