I'm trying to increase or reset stakes based on what my highest recorded balance is. So if I start with £200 at £1 stakes. If my new balance after a bet is higher than the highest recorded balance then my stake will reset to £1. If my balance is decreasing, the stake is increased by £1 and then reset when the new balance is higher than the recorded balance.
I've managed to set it up so that it records the highest balance when I start the program (either current balance or a manual balance adjustment which I can enter in case the program resets) and I can record the highest balance after a win by using the initial balance amount and IF(current balance>highest balance, current balance, highest balance) but the problem comes after this because I need it to keep taking the new highest balance but not sure how to do this without making tons of variables for highest balance (max_bal1, max_bal2, max_bal3... so on) and then a long winded IF statement for increasing the stake. Any ideas on how I can record the highest balance and then if the highest balance is greater than the previous highest balance, stake = £1, if not then stake = previous stake + £1?? Below is a table of bets of what I'm looking to achieve. Cheers.
Bet # | Date/Time | Market | Winning Bet | Max Balance | Unit Price | Units | Stake | Back Price | Lay Price | If Wins | If Loses | P/L (AC) | Starting Balance | Ending Balance |
1 | 01/01/2023 13:08 | Horse Racing - Calendar / 2023 / January 2023 / 01 (Sun) / Tramore / Tramore 01/01/2023 12:55 2m Mdn Hrd - 2m Mdn Hrd | Back | £200.00 | £1.00 | 1.00 | £1.00 | 1.25 | 1.26 | £0.25 | -£1.00 | £0.25 | £200.00 | £200.25 |
2 | 01/01/2023 13:20 | Horse Racing - Calendar / 2023 / January 2023 / 01 (Sun) / Cheltenham / Cheltenham 01/01/2023 13:10 2m4f Mdn Hrd - 2m4f Mdn Hrd | Back | £200.25 | £1.00 | 1.00 | £1.00 | 2.40 | 2.42 | £1.37 | -£1.00 | £1.37 | £200.25 | £201.62 |
3 | 01/01/2023 13:34 | Horse Racing - Calendar / 2023 / January 2023 / 01 (Sun) / Musselburgh / Musselburgh 01/01/2023 13:25 1m7f Juv Hrd - 1m7f Juv Hrd | Back | £201.62 | £1.00 | 1.00 | £1.00 | 2.67 | 2.69 | £1.64 | -£1.00 | £1.64 | £201.62 | £203.25 |
4 | 01/01/2023 13:47 | Horse Racing - Calendar / 2023 / January 2023 / 01 (Sun) / Fakenham / Fakenham 01/01/2023 13:35 3m5f Hcap Chs - 3m5f Hcap Chs | Lay | £203.25 | £1.00 | 1.00 | £1.00 | 3.25 | 3.30 | £2.21 | -£1.00 | -£1.00 | £203.25 | £202.25 |
5 | 01/01/2023 14:00 | Horse Racing - Calendar / 2023 / January 2023 / 01 (Sun) / Fairyhouse / Fairyhouse 01/01/2023 13:50 2m4f Mdn Hrd - 2m4f Mdn Hrd | Back | £203.25 | £1.00 | 2.00 | £2.00 | 3.60 | 3.65 | £5.10 | -£2.00 | £5.10 | £202.25 | £207.35 |
6 | 01/01/2023 14:16 | Horse Racing - Calendar / 2023 / January 2023 / 01 (Sun) / Tramore / Tramore 01/01/2023 14:05 2m6f Mdn Hrd - 2m6f Mdn Hrd | Lay | £207.35 | £1.00 | 1.00 | £1.00 | 1.82 | 1.83 | £0.80 | -£1.00 | -£1.00 | £207.35 | £206.35 |
7 | 01/01/2023 14:31 | Horse Racing - Calendar / 2023 / January 2023 / 01 (Sun) / Cheltenham / Cheltenham 01/01/2023 14:20 2m4f Grd2 Nov Chs - 2m4f Grd2 Nov Chs | Lay | £207.35 | £1.00 | 2.00 | £2.00 | 2.68 | 2.70 | £3.29 | -£2.00 | -£2.00 | £206.35 | £204.35 |
8 | 01/01/2023 14:44 | Horse Racing - Calendar / 2023 / January 2023 / 01 (Sun) / Musselburgh / Musselburgh 01/01/2023 14:35 2m4f Hcap Chs - 2m4f Hcap Chs | Back | £207.35 | £1.00 | 3.00 | £3.00 | 3.60 | 3.65 | £7.64 | -£3.00 | £7.64 | £204.35 | £211.99 |
9 | 01/01/2023 14:54 | Horse Racing - Calendar / 2023 / January 2023 / 01 (Sun) / Fakenham / Fakenham 01/01/2023 14:45 2m5f Nov Hcap Chs - 2m5f Nov Hcap Chs | Lay | £211.99 | £1.00 | 1.00 | £1.00 | 4.40 | 4.50 | £3.33 | -£1.00 | -£1.00 | £211.99 | £210.99 |
10 | 01/01/2023 15:12 | Horse Racing - Calendar / 2023 / January 2023 / 01 (Sun) / Fairyhouse / Fairyhouse 01/01/2023 15:00 3m Hcap Hrd - 3m Hcap Hrd | Lay | £211.99 | £1.00 | 2.00 | £2.00 | 5.30 | 5.40 | £8.43 | -£2.00 | -£2.00 | £210.99 | £208.99 |
11 | 01/01/2023 15:26 | Horse Racing - Calendar / 2023 / January 2023 / 01 (Sun) / Tramore / Tramore 01/01/2023 15:15 2m6f Grd3 Chs - 2m6f Grd3 Chs | Lay | £211.99 | £1.00 | 3.00 | £3.00 | 1.87 | 1.88 | £2.56 | -£3.00 | -£3.00 | £208.99 | £205.99 |
12 | 01/01/2023 15:41 | Horse Racing - Calendar / 2023 / January 2023 / 01 (Sun) / Cheltenham / Cheltenham 01/01/2023 15:30 2m4f Grd2 Hrd - 2m4f Grd2 Hrd | Lay | £211.99 | £1.00 | 4.00 | £4.00 | 4.40 | 4.50 | £13.33 | -£4.00 | -£4.00 | £205.99 | £201.99 |
13 | 01/01/2023 15:56 | Horse Racing - Calendar / 2023 / January 2023 / 01 (Sun) / Musselburgh / Musselburgh 01/01/2023 15:45 1m7f Hcap Hrd - 1m7f Hcap Hrd | Lay | £211.99 | £1.00 | 5.00 | £5.00 | 4.20 | 4.30 | £15.68 | -£5.00 | -£5.00 | £201.99 | £196.99 |
14 | 01/01/2023 16:11 | Horse Racing - Calendar / 2023 / January 2023 / 01 (Sun) / Catterick / Catterick 01/01/2023 16:00 3m1f Hcap Chs - 3m1f Hcap Chs | Lay | £211.99 | £1.00 | 6.00 | £6.00 | 2.40 | 2.42 | £8.23 | -£6.00 | -£6.00 | £196.99 | £190.99 |
15 | 01/01/2023 16:26 | Horse Racing - Calendar / 2023 / January 2023 / 01 (Sun) / Exeter / Exeter 01/01/2023 16:15 2m3f Hcap Chs - 2m3f Hcap Chs | Back | £211.99 | £1.00 | 7.00 | £7.00 | 5.10 | 5.20 | £28.13 | -£7.00 | £28.13 | £190.99 | £219.12 |
16 | 01/01/2023 16:41 | Horse Racing - Calendar / 2023 / January 2023 / 01 (Sun) / Fakenham / Fakenham 01/01/2023 16:30 3m Hcap Chs - 3m Hcap Chs | Lay | £219.12 | £1.00 | 1.00 | £1.00 | 2.75 | 2.77 | £1.72 | -£1.00 | -£1.00 | £219.12 | £218.12 |
17 | 01/01/2023 17:24 | Horse Racing - Calendar / 2023 / January 2023 / 01 (Sun) / Fairyhouse / Fairyhouse 01/01/2023 16:45 2m INHF - 2m INHF | Lay | £219.12 | £1.00 | 2.00 | £2.00 | 1.79 | 1.80 | £1.55 | -£2.00 | -£2.00 | £218.12 | £216.12 |
18 | 01/01/2023 17:54 | Horse Racing - Calendar / 2023 / January 2023 / 01 (Sun) / Southwell / Southwell 01/01/2023 17:26 5f Nov Stks - 5f Nov Stks | Lay | £219.12 | £1.00 | 3.00 | £3.00 | 3.90 | 3.95 | £8.53 | -£3.00 | -£3.00 | £216.12 | £213.12 |
19 | 01/01/2023 18:24 | Horse Racing - Calendar / 2023 / January 2023 / 01 (Sun) / Southwell / Southwell 01/01/2023 17:56 5f Hcap - 5f Hcap | Lay | £219.12 | £1.00 | 4.00 | £4.00 | 4.70 | 4.80 | £14.50 | -£4.00 | -£4.00 | £213.12 | £209.12 |
20 | 01/01/2023 18:54 | Horse Racing - Calendar / 2023 / January 2023 / 01 (Sun) / Southwell / Southwell 01/01/2023 18:26 5f Hcap - 5f Hcap | Lay | £219.12 | £1.00 | 5.00 | £5.00 | 4.30 | 4.40 | £16.17 | -£5.00 | -£5.00 | £209.12 | £204.12 |
21 | 02/01/2023 13:21 | Horse Racing - Calendar / 2023 / January 2023 / 01 (Sun) / Southwell / Southwell 01/01/2023 18:56 1m3f Hcap - 1m3f Hcap | Back | £219.12 | £1.00 | 6.00 | £6.00 | 4.8 | 4.90 | £22.34 | -£6.00 | £22.34 | £204.12 | £226.46 |
22 | 02/01/2023 13:29 | Horse Racing - Calendar / 2023 / January 2023 / 02 (Mon) / Lingfield / Lingfield 02/01/2023 13:23 1m Hcap - 1m Hcap | Lay | £226.46 | £1.00 | 1.00 | £1.00 | 3.6 | 3.65 | £2.55 | -£1.00 | -£1.00 | £226.46 | £225.46 |
23 | 02/01/2023 13:43 | Horse Racing - Calendar / 2023 / January 2023 / 02 (Mon) / Plumpton / Plumpton 02/01/2023 13:30 2m4f Nov Chs - 2m4f Nov Chs | Back | £226.46 | £1.00 | 2.00 | £2.00 | 1.14 | 1.15 | £0.27 | -£2.00 | £0.27 | £225.46 | £225.74 |
24 | 02/01/2023 13:56 | Horse Racing - Calendar / 2023 / January 2023 / 02 (Mon) / Ayr / Ayr 02/01/2023 13:45 2m4f Nov Hrd - 2m4f Nov Hrd | Lay | £226.46 | £1.00 | 3.00 | £3.00 | 1.39 | 1.40 | £1.15 | -£3.00 | -£3.00 | £225.74 | £222.74 |
25 | 02/01/2023 14:13 | Horse Racing - Calendar / 2023 / January 2023 / 02 (Mon) / Plumpton / Plumpton 02/01/2023 14:00 2m Nov Hrd - 2m Nov Hrd | Lay | £226.46 | £1.00 | 4.00 | £4.00 | 1.7 | 1.71 | £2.74 | -£4.00 | -£4.00 | £222.74 | £218.74 |
26 | 02/01/2023 14:27 | Horse Racing - Calendar / 2023 / January 2023 / 02 (Mon) / Ayr / Ayr 02/01/2023 14:15 2m4f Hcap Hrd - 2m4f Hcap Hrd | Lay | £226.46 | £1.00 | 5.00 | £5.00 | 6.95 | 7.15 | £29.16 | -£5.00 | -£5.00 | £218.74 | £213.74 |
27 | 02/01/2023 14:43 | Horse Racing - Calendar / 2023 / January 2023 / 02 (Mon) / Plumpton / Plumpton 02/01/2023 14:30 2m4f Nov Hrd - 2m4f Nov Hrd | Back | £226.46 | £1.00 | 6.00 | £6.00 | 1.39 | 1.40 | £2.29 | -£6.00 | £2.29 | £213.74 | £216.03 |
28 | 02/01/2023 14:58 | Horse Racing - Calendar / 2023 / January 2023 / 02 (Mon) / Ayr / Ayr 02/01/2023 14:45 3m Hcap Chs - 3m Hcap Chs | Back | £226.46 | £1.00 | 7.00 | £7.00 | 2.68 | 2.70 | £11.52 | -£7.00 | £11.52 | £216.03 | £227.56 |
29 | 02/01/2023 15:13 | Horse Racing - Calendar / 2023 / January 2023 / 02 (Mon) / Plumpton / Plumpton 02/01/2023 15:00 2m4f Hcap Hrd - 2m4f Hcap Hrd | Lay | £227.56 | £1.00 | 1.00 | £1.00 | 3.25 | 3.30 | £2.21 | -£1.00 | -£1.00 | £227.56 | £226.56 |