Debug Loading new markets

Discuss anything related to using the program (eg. triggered betting tactics)

Moderator: 2020vision

Debug Loading new markets

Postby iceman » Sun Mar 13, 2011 2:08 pm

Sorry for having post this message in suggestions.....

I'ma using last version of Gary's GreenUp macro.

I have a debug problem when excel automaticly load a new market.

The message error is "run-time 13"

and the debug sign me the part of code written in red below.

Any suggestions?

Private Sub calculateFuturePL(r As Integer, betType As String, stake As Currency, odds As Currency)
Dim i As Integer
For i = 1 To UBound(pl)
If betType = "BACK" Then
If i = r Then
pl(i, 1) = pl(i, 1) + (stake * (odds - 1))
Else
pl(i, 1) = pl(i, 1) - stake
End If
Else
If i = r Then
pl(i, 1) = pl(i, 1) - (stake * (odds - 1))
Else
pl(i, 1) = pl(i, 1) + stake
End If
End If
Next
End Sub
User avatar
iceman
 
Posts: 57
Joined: Sun Feb 14, 2010 5:44 pm

Postby Captain Sensible » Mon Mar 14, 2011 1:47 pm

I'm guessing there must be more code than the snippet you posted but looks like that portion is running before the markets fully loaded and no value has been set for UBound(pl) so you're getting a type mismatch.

Need to step through it all and rearrange the order or look at adding some error trapping so the code won't run until UBound(pl) has a valid value.
User avatar
Captain Sensible
 
Posts: 2923
Joined: Sat Nov 19, 2005 2:29 pm

Postby osknows » Mon Mar 14, 2011 3:40 pm

Gary's greenup code is pretty robust so not sure why you're getting the error?

The run-time 13 error probably means that the variable 'pl' is Empty and has not been assigned. Have you changed Gary's code?

A 'dirty' fix can be implemented with the code below but I suggest you find out why the variable 'pl' is not being assigned. Perhaps post your amended code here

DIRTY FIX:
Code: Select all
Private Sub calculateFuturePL(r As Integer, betType As String, stake As Currency, odds As Currency)
Dim i As Integer
If Not IsEmpty(pl) Then
    For i = 1 To UBound(pl)
    If betType = "BACK" Then
    If i = r Then
    pl(i, 1) = pl(i, 1) + (stake * (odds - 1))
    Else
    pl(i, 1) = pl(i, 1) - stake
    End If
    Else
    If i = r Then
    pl(i, 1) = pl(i, 1) - (stake * (odds - 1))
    Else
    pl(i, 1) = pl(i, 1) + stake
    End If
    End If
    Next
End If
End Sub
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby iceman » Fri Mar 18, 2011 9:02 am

Thanks CAP and Osk, I solve the debug and now It works very fine.
It's only a little slow cancelling unmatched bets in case of few selections,
but this isn't a problem of the greenup macro.
It's probably due to my macro that cancel unmatched befor market turns IP.

Thanks!
User avatar
iceman
 
Posts: 57
Joined: Sun Feb 14, 2010 5:44 pm


Return to Discussion

Who is online

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