-1 Trigger Help

Please post any questions regarding the program here.

Moderator: 2020vision

-1 Trigger Help

Postby Yorkie » Thu Dec 23, 2010 7:51 pm

Hi Guys

I have a list of events in the quick pick list. I then have a cell in sheet1 that when the time to the start is less than 2 minutes and certain conditions are met turns to 1. These conditions can be the bet i want to place has been placed or the odds are too low or the spread is too large etc.
I then have a small piece of vba that populates Q2 with -1 when the cell in excel turns to 1 to move onto the next event.

The problem i have is that everytime the excel cell turns to 1 and therefore the Q2 -1 is triggered instead of moving onto the next event it moves on 2 events.
If anyone can tell me how i can stop this happening i'd be grateful.

The vba i use if it helps is

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Columns.Count <> 16 Then Exit Sub
Application.EnableEvents = False

If Workbooks("Trial1.xlsm").Sheets("Sheet1").Range("AJ5").Value = 1 Then
Workbooks("Trial1.xlsm").Sheets("Sheet1").Range("Q2").Value = -1

End If

Application.EnableEvents = True

End Sub

Cheers

Yorkie
Yorkie
 
Posts: 116
Joined: Wed Feb 25, 2009 1:04 pm

Postby GaryRussell » Fri Dec 24, 2010 7:35 am

-1 sets a flag that tells BA to move to the next market. This flag is checked every second, but in the meantime everything else continues, it does not wait for the market change. Therefore your code needs to wait for the market to change. If you change it as follows it should be ok.

Code: Select all
Dim marketChanging as Boolean,currentMarket as String

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Columns.Count <> 16 Then Exit Sub
Application.EnableEvents = False

If Workbooks("Trial1.xlsm").Sheets("Sheet1").Range("AJ5").Value = 1 Then
   If not marketChanging Then
      marketChanging=True
      currentMarket=[A1]
      Workbooks("Trial1.xlsm").Sheets("Sheet1").Range("Q2").Value = -1
   Else
      If [A1]<>currentMarket then marketChanging=False
   End If
End If

Application.EnableEvents = True

End Sub
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby Yorkie » Sat Dec 25, 2010 12:19 pm

Cheers Gary
Yorkie
 
Posts: 116
Joined: Wed Feb 25, 2009 1:04 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 50 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.