Refresh rate value

Please post any questions regarding the program here.

Moderator: 2020vision

Refresh rate value

Postby Daywalker » Sat Aug 21, 2010 12:21 pm

hi

my sheet starts at A10. i want refresh rate to be 1 second upto 10 mins before off then 0.2 seconds until 30 seconds before off (thats when my triggers stop going in) then at 10 seconds to off refresh rate = -1, selecting next race from quick pick list. cell U6 is seconds to off. will this work?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Columns.Count <> 16 Then Exit Sub
Application.EnableEvents = False

If Range("U6") > 600 Then
Range("Q11") = 1
ElseIf Range("U6") > 30 Then
Range("Q11") = 0.2
ElseIf Range("U6") > 10 Then
Range("Q11") = -1
End If

Application.EnableEvents = True
End Sub

thanks
User avatar
Daywalker
 
Posts: 200
Joined: Wed Aug 18, 2010 11:43 pm
Location: Mid-West Yorkshire

Postby osknows » Sat Aug 21, 2010 12:55 pm

Hello Daywalker,


I think this will work

Code: Select all
Dim nextracetrigger As Integer
Const inplayrefresh As Double = 0.2
Const normalrefresh As Double = 1

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Columns.Count <> 16 Then Exit Sub
Application.EnableEvents = False

With ThisWorkbook.Sheets(Target.Worksheet.Name)
If .Range("U6") > 30 Then
.Range("Q11") = normalrefresh
ElseIf .Range("U6") <= 30 and .Range("U6") >10  Then
.Range("Q11") = inplayrefresh
ElseIf .Range("U6")<= 10 And nextracetrigger = 0 Then
lastrace = .Range("A10").Value
.Range("Q11").Value = -1
nextracetrigger = 1
End If

If lastrace <> .Range("A10").Value Then
nextracetrigger = 0
End If

End With

Application.EnableEvents = True
End Sub
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby Daywalker » Sat Aug 21, 2010 1:40 pm

Thanks osknows, i'll have a dabble :)
User avatar
Daywalker
 
Posts: 200
Joined: Wed Aug 18, 2010 11:43 pm
Location: Mid-West Yorkshire

Postby Daywalker » Sat Aug 21, 2010 2:34 pm

hi osknows

tried it but when it jumps to next race it leaves -1 in the refresh rate and jumps to next race after that, then it changes to 1 or 0.2. any ideas?
User avatar
Daywalker
 
Posts: 200
Joined: Wed Aug 18, 2010 11:43 pm
Location: Mid-West Yorkshire

Postby Daywalker » Sat Aug 21, 2010 3:47 pm

now i've fannied with it and it works but i dont know what i've done. i'll keep an eye on it
User avatar
Daywalker
 
Posts: 200
Joined: Wed Aug 18, 2010 11:43 pm
Location: Mid-West Yorkshire

Postby Daywalker » Sat Aug 21, 2010 5:38 pm

nope. sometimes it jumps one race sometimes two.
User avatar
Daywalker
 
Posts: 200
Joined: Wed Aug 18, 2010 11:43 pm
Location: Mid-West Yorkshire

Postby GaryRussell » Sat Aug 21, 2010 6:24 pm

osknows' code looks ok to me. How are you populating cell U6, with a formula or with VBA?
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby osknows » Sat Aug 21, 2010 6:33 pm

It would also help if I included 'Dim lastrace As String'

The code should be
Code: Select all
Dim nextracetrigger As Integer
Dim lastrace As String
Const inplayrefresh As Double = 0.2
Const normalrefresh As Double = 1

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Columns.Count <> 16 Then Exit Sub
Application.EnableEvents = False

With ThisWorkbook.Sheets(Target.Worksheet.Name)
If .Range("U6") > 30 Then
.Range("Q11") = normalrefresh
ElseIf .Range("U6") <= 30 and .Range("U6") >10  Then
.Range("Q11") = inplayrefresh
ElseIf .Range("U6")<= 10 And nextracetrigger = 0 Then
lastrace = .Range("A10").Value
.Range("Q11").Value = -1
nextracetrigger = 1
End If

If lastrace <> .Range("A10").Value Then
nextracetrigger = 0
End If

End With

Application.EnableEvents = True
End Sub



This has been tested to work ok with Gary's famous formula in U6

cell U6 =IF(LEFT(D2)<>"-",(HOUR(D2)*3600)+(MINUTE(D2)*60)+SECOND(D2),-((HOUR(SUBSTITUTE(D2,"-",""))*3600)+(MINUTE(SUBSTITUTE(D2,"-",""))*60)+SECOND(SUBSTITUTE(D2,"-",""))))

you might have to swap cell D2 for D11 in your case
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby Daywalker » Sat Aug 21, 2010 7:27 pm

Gary, i'm using the formula that's in osknows last post to populate U6, i found it in another post on the forum.

Osknows, i've tried your new code and it works perfect. before the '-1' seemed to flash and hang around until the next market populated excell which took a few seconds, in which time the highlighter in the quick pick list jumped again. Thanks very much for this, it's ace :D

Today was my first day using my excel sheet through Gruss. the sheet entered bets in 20 markets, placing 55 bets with tick offset and stop loss. i used £2 stakes and only lost 25 pence. i think this is well cool and down to the knowledge available on this forum and the fantastic gruss product

Thanks again :D
User avatar
Daywalker
 
Posts: 200
Joined: Wed Aug 18, 2010 11:43 pm
Location: Mid-West Yorkshire


Return to Help

Who is online

Users browsing this forum: Google [Bot] and 19 guests

Sports betting software from Gruss Software


The strength of Gruss Software is that it’s been designed by one of you, a frustrated sports punter, and then developed by listening to dozens of like-minded enthusiasts.

Gruss is owned and run by brothers Gary and Mark Russell. Gary discovered Betfair in 2004 and soon realised that using bespoke software to place bets was much more efficient than merely placing them through the website.

Gary built his own software and then enhanced its features after trialling it through other Betfair users and reacting to their improvement ideas, something that still happens today.

He started making a small monthly charge so he could work on it full-time and then recruited Mark to help develop the products and Gruss Software was born.

We think it’s the best of its kind and so do a lot of our customers. But you can never stand still in this game and we’ll continue to improve the software if any more great ideas emerge.