function myPrint (msgStr , msgLevel )
msgLevel = msgLevel or -99
debugLevel = debugLevel or 10
if msgLevel <= debugLevel and msgStr ~= nil then
--- print (msgStr)
print (msgLevel.. ":" .. msgStr)
end
end -- myPrint ()
function round(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end
function roundup(num, idp)
local mult = 10^(idp or 0)
return math.ceil(num * mult ) / mult
end
-- execution starts from here....
math.randomseed( os.time() )
minBet=0.00000001 --the minimum Amount you want to bet
maxBet=0.00000500 -- the maximum amount you want to bet
minChance=88 --the min chance you want to bet at. >0
maxChance=88 --the max chance you want to bet at <=98
maxRoll = 99
hEdge = 1
betMultiplier = (maxRoll+hEdge)/(maxRoll)
--betMultiplier = 1
winNumber = 1
loseNumber = 1
avgWinNumber = (maxRoll+hEdge)/chance
avgLoseNumber = (maxRoll+hEdge)/(maxRoll+hEdge-chance)
raWinNumber = 0
raLoseNumber = 0
loseCount = 0
winCount = 0
pMultiple = 0.000011355
lMultiple = 1.15 * pMultiple / (1-pMultiple) -- was 1.10
chance = maxChance
bpMultiple = 0.90
betProfit = bpMultiple * (maxRoll-chance)/chance
nextbet= 0.01
betDivisor = 50
calcBetDivisor = 1
prevExpProfit = balance * pMultiple
myPrint (string.format("lossMultiple:%.4f" ,lMultiple ) , 5)
prevBalance =balance
startBalance = balance
prevChance = chance
prevbet = nextbet
function dobet ()
myPrint ("..Start........................", 0)
if (prevBalance <= balance) then
myPrint ( string.format(" GAINED...:%.8f", balance - prevBalance) , 5)
else
myPrint ( string.format(" LOST.....:%.8f", prevBalance - balance) , 5)
end
if (win ) then
winCount += 1
raWinNumber += (winNumber - raWinNumber)/winCount
winNumber = 1
loseNumber += 1
myPrint ("BetID:" .. lastBet.Id .. " was WIN " , 5)
else
loseCount += 1
raLoseNumber += (loseNumber - raLoseNumber)/loseCount
loseNumber = 1
winNumber += 1
expProfit2 += lastBet.amount / betDivisor
myPrint ("BetID:" .. lastBet.Id .. " was LOSE " , 5)
end
--set nextbet
if (startBalance < balance ) then
startBalance = balance
expProfit2 = balance * pMultiple
myPrint ( "........Restarted........",5 )
else
myPrint ( string.format(" bal*lMultiple:%.8f",balance * lMultiple) , 5)
myPrint ( string.format("diff Balance:%.8f",(startBalance - balance)) , 15)
end
betLimit = math.min( balance * pMultiple * 100 , maxBet )
myPrint ( string.format("expProfit2:%.10f", expProfit2) , 5)
nextbet = expProfit2 / betProfit
if ( nextbet/math.ceil(chance / (maxRoll - chance)) < minBet ) then
myPrint(" No possible profit ...increase bet OR reduce Chance..." , 5)
nextbet = minBet * math.ceil(chance / (maxRoll - chance))
end
if nextbet > betLimit then
expProfit2 = expProfit2 / betMultiplier
nextbet = nextbet / betMultiplier
end
nextbet = roundup(nextbet ,8)
myPrint ( string.format("startBalance:%.8f", startBalance) , 5)
myPrint ( string.format("prevBalance:%.8f", prevBalance) , 15)
myPrint ( string.format("balance:%.8f", balance) , 5)
myPrint ( string.format("diff Balance:%.8f", startBalance - balance) , 5)
myPrint ( string.format("prevChance:%.2f", prevChance) , 15)
myPrint ("chance:" .. chance , 5)
myPrint ( string.format("prevbet:%.8f", prevbet) , 15)
myPrint ( string.format("nextbet:%.8f", nextbet) , 5)
myPrint ("WinCount:" .. winCount .. " LoseCount:" .. loseCount, 5)
myPrint ( string.format("Win/Lose ideal:%.4f Real:%.4f",
wlIdeal, wlReal ) , 5)
myPrint ( string.format("taWinNumber:%.4f taLoseNumber:%.4f",
avgWinNumber, avgLoseNumber ), 5)
myPrint ( string.format("raWinNumber:%.4f raLoseNumber:%.4f",
raWinNumber, raLoseNumber ), 5)
myPrint ("..End........................", 0)
prevBalance = balance
prevChance = chance
prevbet = nextbet
prevExpProfit = expProfit
end