/
FibonacciFailsafeV3.lua
206 lines (167 loc) · 4.41 KB
/
FibonacciFailsafeV3.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
-- CttCJim's Self-watching Fibonacci V3
-- Special thanks to Blaksmith for edits
-- After panic level, resets on first win.
-- If no win after panicReset, resets to base bet
-- Future versions may aim for a particular balance and incorporate minimum balances.
-- no-bs-faucet.com has more info and if you want to tip me, just head there!
-- bethigh=true -- bet high when true, bet low when false
enablezz=false -- set to true to use high/low switching
-- settings from advanced mode
enablesrc=false -- set to true to use stop/reset conditions
-- settings from advanced mode
-- constants
minbet = 0.00000001 -- Set this according to the coin / token you are on!
restTime = 0.0 -- How long to wait in seconds before the next bet. Some sites need this
basebet = 0.00000001
nextbet=basebet
basechance=34.75 -- changed by Blaksmith
paniclevel = 5 -- where we try to recover
panicflag = 0
prevbet = basebet
fibstep = 1.0 -- step multiplier. change to 1 for classic fibonacci sequence.
-- can also enter: fibstep = x.xx while it is running to take a bigger risk!
dynStep = 600000 --determines dynamic bet. bet = balance / dynStep
-- Added by Blaksmith
dynamicBase = true -- Set this to false to *not* calculate the base bet according to your balance
smoothPanic = false -- Set this to false to *not* raise the chance to soften the blow before resetting completely.
panicReset = 50 -- Set this to how many times it can roll after hitting panic, before completely resetting
panicCounter = 0
panicOffset = 1.0 -- Increment chance by this much on every loss beyond paniclevel
-- End Added by Blaksmith
onwin = -2
onlose = 1
fibdex=0
currbet=basebet
panicnumber = 1 -- this too
i=0
-- Added by Blaksmith
local clock = os.clock
function sleep(n) -- seconds
local t0 = clock()
while clock() - t0 <= n do end
end
-- End Added by Blaksmith
function myfib(level)
fibno=basebet
temp=0
prevfibno=0
if level == 0 then
fibno= basebet
else
for j=0,level-1,1 do
temp=fibno
fibno=fibno + (prevfibno * fibstep)
prevfibno=temp
end
end
return fibno
end
-- initialization
function initialize()
if dynamicBase == true then
basebet = balance / dynStep
if basebet < minbet then
basebet = minbet
end
end
panicnumber=basebet
nextbet = basebet
chance = basechance -- Added by Blaksmith
temp=0
prevtemp=0
fibdex=0
panicnumber=myfib(paniclevel)
tempstr = "Panic Number: panicnumber"
tempcalc = string.format("%.8f", panicnumber)
tempstr = string.gsub(tempstr, "panicnumber", tempcalc)
print (tempstr)
highLowAverage = {}
averageCount = 0
averageIndex = 0
averageMax = panicReset -- High / Low average switching.
rollCount = 0
rollSeedCount = 0
-- Initialize the array
for i=0, averageMax do
highLowAverage[i] = 0
end
end
initialize()
function dobet()
if win then
-- print("win")
if panicflag==1 then
nextbet=basebet
fibdex=0
print("panic over, reset")
else
fibdex=fibdex+onwin
if fibdex < 0 then -- lets not get negative index numbers
fibdex=0
end
nextbet=myfib(fibdex)
end
if dynamicBase == true then
basebet = balance / dynStep
if basebet < minbet then
basebet = minbet
end
panicnumber = myfib(paniclevel)
end
panicCounter=0
panicflag=0
chance = basechance
else -- if lose
-- print("lose")
if prevbet >= panicnumber then
print("bet over limit, PANIC")
panicflag=1
end
fibdex=fibdex+onlose
nextbet=myfib(fibdex)
-- Added by Blaksmith
if panicflag == 1 then
panicCounter += 1
if smoothPanic == true then
chance += panicOffset -- Needs to be tweaked.
end
end
if panicCounter >= panicReset then -- Completely reset
nextbet = basebet
fibdex=0
panicflag = 0
chance = basechance
panicCounter = 0 -- Added by Blaksmith
print("Too many panic rolls! Resetting!")
end
-- End Added by Blaksmith
end
prevbet=nextbet
-- Added by Blaksmith
-- Calculate the average, and then change high / low accordingly
if(lastBet.Roll >= 50) then
highLowAverage[averageIndex] = 1
else
highLowAverage[averageIndex] = 0
end
averageIndex += 1
if(averageIndex >= averageMax) then
averageIndex = 0
end
if(averageCount < averageMax) then
averageCount += 1
end
average = 0.00
for i=0, averageCount do
average += highLowAverage[i]
end
average = average / averageCount
-- print (average)
if average >= 0.5 then
bethigh = true
else
bethigh = false
end
-- End Added by Blaksmith
sleep(restTime)
end