Error in 'CANCEL'

Please post any questions regarding the program here.

Moderator: 2020vision

Error in 'CANCEL'

Postby gvigliani » Sat Jun 18, 2011 4:08 pm

Hi Gruss,

I develop a long-time bot for Betting Assistant but I have a problem that I can not fix. I wrote a function that launches a Lay at a certain Odd. I put a tick off with a back that anticipates the possible stop Win. The function continues with a stop loss of control which provides a further back. If you arrive at the launch of BACK to Stop Loss, the Trigger "CANCEL" don't cancels the previous WIN BACK to STOP and so 'both calls are dropped.
Can you help?

Code for STOPWIN:

foglioExcelSnake.Range(Q(Cav_Scom)) = "CANCEL"
foglioExcelSnake.Range(R(Cav_Scom)) = Odd
foglioExcelSnake.Range(s(Cav_Scom)) =tmp_stake
foglioExcelSnake.Range(T(Cav_Scom)) = ""
foglioExcelSnake.Range(Q(Cav_Scom)) = "BACK"


Code for Stoploss:

foglioExcelSnake.Range(T(Cav_Scom)) = ""
foglioExcelSnake.Range(Q(Cav_Scom)) = "CLEAR"
foglioExcelSnake.Range(T(Cav_Scom)) = ""
foglioExcelSnake.Range(Q(Cav_Scom)) = "CANCEL"
foglioExcelSnake.Range(T(Cav_Scom)) = ""
foglioExcelSnake.Range(Q(Cav_Scom)) = "CANCEL-ALL"

foglioExcelSnake.Range(R(Cav_Scom)) = ODD
foglioExcelSnake.Range(s(Cav_Scom)) = STAKE
foglioExcelSnake.Range(T(Cav_Scom)) = ""
foglioExcelSnake.Range(Q(Cav_Scom)) = "BACK"



Cav_Scom is the bet line

Thank's
User avatar
gvigliani
 
Posts: 166
Joined: Thu Aug 13, 2009 3:11 pm
Location: Italia

Postby GaryRussell » Sat Jun 18, 2011 4:29 pm

Are you sure this is a bug in Betting Assistant? Your code doesn't look right.
If your code inserts "CANCEL" and then immediately inserts "BACK" then that's not going to work and is not a bug in BA.

Your code should allow the CANCEL trigger to be processed before inserting BACK. Your STOPWIN code should look something like the following for example. The stoploss code should be similar.
Code: Select all
If not betCancelled Then
   betCancelled = True
   foglioExcelSnake.Range(Q(Cav_Scom)) = "CANCEL"
else
   Application.EnableEvents = False
   foglioExcelSnake.Range(R(Cav_Scom)) = Odd
   foglioExcelSnake.Range(s(Cav_Scom)) =tmp_stake
   foglioExcelSnake.Range(T(Cav_Scom)) = ""
   foglioExcelSnake.Range(Q(Cav_Scom)) = "BACK"
   Application.EnableEvents = True
End If


On the first refresh it will insert CANCEL, BA will process the trigger and cancel the bet. On the next refresh it will insert BACK, BA will read the trigger and place the bet.
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

thank's

Postby gvigliani » Sat Jun 18, 2011 6:21 pm

Thank's Gary
User avatar
gvigliani
 
Posts: 166
Joined: Thu Aug 13, 2009 3:11 pm
Location: Italia

Bet Unmatched

Postby gvigliani » Fri Jun 24, 2011 11:28 am

Hello Gruss,
I'm sorry to bother you again but I can not erase the unmatched bets
User avatar
gvigliani
 
Posts: 166
Joined: Thu Aug 13, 2009 3:11 pm
Location: Italia

Re: Bet Unmatched

Postby GaryRussell » Fri Jun 24, 2011 11:44 am

gvigliani wrote:Hello Gruss,
I'm sorry to bother you again but I can not erase the unmatched bets

Can you be more specific? Can you confirm if it is a bug that you are reporting or if you just need help? If it's just help then I will move this to the help section of the forum.
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Delete Unmatched Bet

Postby gvigliani » Fri Jun 24, 2011 6:53 pm

The function call does not produce the cancellation of the bet.

Code: Select all
Private Sub canc_unmatch()
Dim fatto As Boolean
    fatto = False
While fatto = False
 If fatto = False Then
    foglioExcelSnake.Range(Q(Cav_Scom)) = "CANCEL"
    foglioExcelSnake.Range(T(Cav_Scom)) = ""
    fatto = True
 Else
    Exit Sub
 End If
Wend
End Sub
User avatar
gvigliani
 
Posts: 166
Joined: Thu Aug 13, 2009 3:11 pm
Location: Italia

Postby GaryRussell » Sat Jun 25, 2011 6:47 am

Is your code blanking column T at the same time as inserting "CANCEL" in column Q? If it is then it will never work. CANCEL needs to have the bet ref that should be cancelled in column T or it will do nothing.
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

LAY Trigger

Postby gvigliani » Sat Jun 25, 2011 5:30 pm

Dear Gruss,
I understand where is the problem . Trigger 'CANCEL' works very well that you enter a simple command like "LAY" or "BACK". But if I put a command like "LAY-TL10" command "BACK" present "LAY-TL10" remains in memory and you can not delete. Perhaps the case would be to implement a trigger that deletes the bet is not accepted by its Reference Bet.
thanks
User avatar
gvigliani
 
Posts: 166
Joined: Thu Aug 13, 2009 3:11 pm
Location: Italia

Postby GaryRussell » Sat Jun 25, 2011 6:16 pm

There already is a trigger to cancel all bets for a selection. You can use "CANCEL-ALL". The bet ref column in this case should contain any value, you could for example put "ALL" in the bet ref column. Therefore your code would would read as follows.

Code: Select all
Private Sub canc_unmatch()
Dim fatto As Boolean
    fatto = False
While fatto = False
 If fatto = False Then
    foglioExcelSnake.Range(Q(Cav_Scom)) = "CANCEL-ALL"
    foglioExcelSnake.Range(T(Cav_Scom)) = "ALL"
    fatto = True
 Else
    Exit Sub
 End If
Wend
End Sub
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby gvigliani » Sat Jun 25, 2011 8:06 pm

Dear Gary,
I rewrote the function using all of your advice but there is nothing to do. The "CANCEL" or "CANCEL-ALL" does not work exactly when you use Visual Basic 6 with Excel.

Code: Select all
Private Sub canc_unmatch(fatto As Boolean)
Dim tmp_stake As Double

 If fatto = False Then
    foglioExcelSnake.Range(Q(Cav_Scom)) = "CANCEL-ALL"
    foglioExcelSnake.Range(T(Cav_Scom)) = "ALL"
 Else
                AppExcel.EnableEvents = False
               
                foglioExcelSnake.Range(R(Cav_Scom)) =foglioExcelSnake.Range(f(Cav_Scom))
               
                'calcolo dello stake
                If livellato.Value = True Then
                    tmp_stake = CDbl(M_odd(Cav_Scom).Text) * (CDbl(m_stk(Cav_Scom).Text) / CDbl(foglioExcelSnake.Range(R(Cav_Scom))))
                ElseIf stessostake.Value = True Then
                    tmp_stake = CDbl(m_stk(Cav_Scom))
                End If
               
                foglioExcelSnake.Range(s(Cav_Scom)) = tmp_stake  ' metto lo stake previsto
                foglioExcelSnake.Range(Q(Cav_Scom)) = "BACK"      ' Lancio il Back
                AppExcel.EnableEvents = True
 End If

End Sub

User avatar
gvigliani
 
Posts: 166
Joined: Thu Aug 13, 2009 3:11 pm
Location: Italia

Postby GaryRussell » Sat Jun 25, 2011 9:00 pm

Yes it does. I will post an example when I get some time. I am sure this is not a bug. There must be something wrong with your code. It is difficult for me to see exactly how your spreadsheet works so it is better for you to adapt an example. It is not practical to for me to debug your code.

It would be a good idea for you to try the trigger manually so you get a feel for how it works.
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Problem solved

Postby gvigliani » Sun Jun 26, 2011 10:48 am

Hello Gary,
the problem is due to the fact that the trigger takes some time to complete its function. Launching into 2 commands in sequence and without control, the latter took over the first block. I solved the problem by inserting a wait loop in the T column linked to the disappearance of the command "ALL".

Code: Select all
        While foglioExcelSnake.Range(T(Cav_Scom)) = "ALL"
            Info_Sub.Text = "Cancel Bet Not Matched"
            DoEvents
        Wend


Thank you for the valuable help received.

Gaspare
User avatar
gvigliani
 
Posts: 166
Joined: Thu Aug 13, 2009 3:11 pm
Location: Italia


Return to Help

Who is online

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