CANCEL-ALL trigger not working

Please post any questions regarding the program here.

Moderator: 2020vision

CANCEL-ALL trigger not working

Postby billhiggs » Wed Apr 21, 2010 12:55 pm

I put in CANCEL-ALL in the trigger column and make sure the stake and odds are clear as well as the bet ref..but the bet does not cancel...i have to manually cancel it in BA

am i doing something wrong?

thanks
billhiggs
 
Posts: 6
Joined: Mon Apr 12, 2010 2:05 am

Postby GaryRussell » Wed Apr 21, 2010 2:39 pm

Yes you are doing something wrong. The bet ref should not be clear. You must make sure it contains something. It doesn't have to be a valid reference, you could put "CANCEL_PENDING" as the ref column for example. After CANCEL-ALL has triggered it will clear the ref column.
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby Lewis » Thu Apr 22, 2010 5:03 pm

Hi, seems I have been making a step can you confirm this is the correct procedure to cancel all unmatched bets on a selection.

My routine clears the bet ref etc.. 5 seconds after placement so I will proceed on the basis that Bet ref is empty.

I must write something into 'betref' [although it does not matter what]
Then trigger 'CANCEL-ALL'?
Lewis
 
Posts: 50
Joined: Sun Mar 28, 2010 10:15 pm

Postby GaryRussell » Thu Apr 22, 2010 5:25 pm

Lewis wrote:Hi, seems I have been making a step can you confirm this is the correct procedure to cancel all unmatched bets on a selection.

My routine clears the bet ref etc.. 5 seconds after placement so I will proceed on the basis that Bet ref is empty.

I must write something into 'betref' [although it does not matter what]
Then trigger 'CANCEL-ALL'?


That is correct.
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby zapbrann » Thu Aug 26, 2010 10:38 pm

Hi,

I have searched the forum and although it's mentioned a few times that you need to update the Bet Ref column with "any value" to ensure that unmatched bets are cancelled when using the CANCEL-ALL function, I was wondering if anyone could help me with how you actually do that?

I assume it must be through VBA, as the bet ref column is overwritten at each change in market.

I basically need the bet ref cell in excel (column T) to fill itself with a value when it realises that it's fellow trigger cell has turned to 'CANCEL-ALL'.

All comments and help appreciated!

Regards,

Zap.
zapbrann
 
Posts: 10
Joined: Tue Nov 24, 2009 3:59 pm

VBA Help...

Postby zapbrann » Fri Aug 27, 2010 9:11 am

All,

I have just tried this code this morning with no luck:

Code: Select all
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
         
'Look for changes in a range of cells

          If Not Intersect(Target, Range("A1:A10")) Is Nothing Then

                'Turn off ALL events so code doesn't loop.

                Application.EnableEvents = False

                'Autofill the 'BET Ref' column based on the number of rows used in horse column
               
                Selection.AutoFill Destination:=Range("T1:T" & Range("A" & Rows.Count).End(xlUp).Row)

                'Turn events back on

                Application.EnableEvents = True

            'Allow run time errors again

            On Error GoTo 0

        End If

    End Sub


I get 'Autofill method of range class failed'. Any ideas?

Thanks,

Zap.
zapbrann
 
Posts: 10
Joined: Tue Nov 24, 2009 3:59 pm

Postby GaryRussell » Fri Aug 27, 2010 9:28 am

zapbrann wrote:Hi,

I have searched the forum and although it's mentioned a few times that you need to update the Bet Ref column with "any value" to ensure that unmatched bets are cancelled when using the CANCEL-ALL function, I was wondering if anyone could help me with how you actually do that?

I assume it must be through VBA, as the bet ref column is overwritten at each change in market.

I basically need the bet ref cell in excel (column T) to fill itself with a value when it realises that it's fellow trigger cell has turned to 'CANCEL-ALL'.

All comments and help appreciated!

Regards,

Zap.

Insert the following code in sheet1 VBA module.
Code: Select all
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Columns.Count = 16 Then
        Application.EnableEvents = False
        Dim foundCell As Range, i As Integer, lastR As Integer
        Set foundCell = Range("Q4")
        Do
            lastR = foundCell.Row
            Set foundCell = Columns(17).Find(What:="CANCEL-ALL", After:=foundCell, _
                            LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
                           SearchDirection:=xlNext, MatchCase:=True)
            If foundCell Is Nothing Then Exit Do
            If foundCell.Row > lastR Then
                Cells(foundCell.Row, 20) = "CANCEL"
            End If
        Loop Until foundCell.Row <= lastR
        Application.EnableEvents = True
    End If
End Sub
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby zapbrann » Fri Aug 27, 2010 1:19 pm

Gary,

Thank you very much. This works a treat.

Regards,

Zap.
zapbrann
 
Posts: 10
Joined: Tue Nov 24, 2009 3:59 pm

Postby Optimus_Primed » Fri Aug 24, 2012 4:54 am

I know this is an old topic but i just used this vba code which works well.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Columns.Count = 16 Then
Application.EnableEvents = False
Dim foundCell As Range, i As Integer, lastR As Integer
Set foundCell = Range("Q4")
Do
lastR = foundCell.Row
Set foundCell = Columns(17).Find(What:="CANCEL-ALL", After:=foundCell, _
LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=True)
If foundCell Is Nothing Then Exit Do
If foundCell.Row > lastR Then
Cells(foundCell.Row, 20) = "CANCEL"
End If
Loop Until foundCell.Row <= lastR
Application.EnableEvents = True
End If
End Sub

The only problem is once the race is finished it continues to look for "cancel-all" and insert "cancel" in the bet ref.

Is there a way to stop it once race has finished - then start again for next auto market?
Optimus_Primed
 
Posts: 14
Joined: Fri Jun 08, 2012 6:55 am

Postby Graham » Fri Aug 24, 2012 9:36 am

If the market is suspended or closed this information will be in cell F2, so you could try changing

Cells(foundCell.Row, 20) = "CANCEL"

to

If Cells(2, 6) = "" Then Cells(foundCell.Row, 20) = "CANCEL"

That way it will only insert the reference if the market is neither suspended nor closed.[/quote]
Graham
 
Posts: 130
Joined: Thu Jan 27, 2011 10:25 am

CANCEL-ALL: It's a b*g

Postby spreadform » Sat Nov 10, 2012 5:37 pm

Just found this thread as CANCEL-ALL was not working for me, and I couldn't figure out why. The Help file doesn't say that one needs something in Bet ref for this trigger to work. In fact, this trigger is not using Bet ref for cancelling the bets since it doesn't matter what is in that cell (as long as it's not empty).

It follows then that this is a b*g. After all, when I'm cancelling all unmatched bets for a selection, I shouldn't care whether there are any bets at all. It appears to me that this issue could (and should) be fixed by ignoring the Bet ref cell in the application rather than using a workaround that requires VBA programming by the user. What is BA doing then if the user is programming a workaround for CANCEL-ALL to work as it is expected to work?

I could be wrong of course, but if this assessment is accurate, could we have this fixed in the next version?
spreadform
 
Posts: 108
Joined: Wed Apr 08, 2009 12:02 pm

Postby milfor » Sat Nov 10, 2012 8:08 pm

This is not a bug. It is useful because otherwise BA would keep sending
CANCEL-ALL commands to Betfair for hours.

If anything is in the Betref column, BA executes CANCEL-ALL and clears the
Betref. This will stop BA repeating the same command again and again.
milfor
 
Posts: 437
Joined: Mon Jun 26, 2006 1:44 am

Postby spreadform » Sat Nov 10, 2012 11:41 pm

Appreciate your comment but why would BA send CANCEL-ALL repeatedly? If it can be stopped in VBA, it can also be programmed within BA.
spreadform
 
Posts: 108
Joined: Wed Apr 08, 2009 12:02 pm

Postby milfor » Sun Nov 11, 2012 12:36 am

I think you don't know how BA works. If your refresh rate is 1 second, BA
'has a look' at the Excel cells every second. If it finds a BACK anywhere in
column Q it triggers a BACK bet. The only thing that prevents it from
sending a new BACK bet every second is that the Betref column is filled.

The CANCEL commands work the other way round: Everytime BA finds a
CANCEL or CANCEL-ALL anywhere in column Q it sends the command to the
API. The only thing that prevents it from repeating this every second is that
the Betref column is empty.

BA works this way for many years now. If the routine would be changed
many users and programs would get serious problems.
milfor
 
Posts: 437
Joined: Mon Jun 26, 2006 1:44 am

Postby Ian » Sun Nov 11, 2012 8:35 am

Spreadform is correct really because BA could clear all the trigger columns when it has processed the trigger CANCEL-ALL, which I suspect most people will have coded into their VBA at some point. However, as milfor says, it has worked like this for so long, it can't be changed now.
Ian
 
Posts: 834
Joined: Sat Nov 19, 2005 8:35 am
Location: Birmingham


Return to Help

Who is online

Users browsing this forum: Google [Bot] and 42 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.