Coding with_Greening:True after Lay

We were all new to Bet Angel once. Ask any question you like here and fellow forum members promise not to laugh. Betfair trading made simple.
Post Reply
Bet_boy
Posts: 21
Joined: Mon Nov 07, 2011 11:13 pm

Hi All,

Could you please show me how to correct this:-

=IF(.....,"Lay",""""),IF(.....,"with_Greening:True","""")

If fulfilling the condition then "Lay",afterward if fulfilling the condition then "with_Greening:True".

Thank you.
6thSense
Bet Angel
Bet Angel
Posts: 375
Joined: Fri Nov 30, 2012 5:02 pm

I can't really tell what you are trying to do from that but the IF function is straight forward.

Think of it like this:

IF([This is TRUE],Then this,Else this)

You can nest these:

IF([This is TRUE],IF([This is TRUE],Then this,Else this),Else this)

Or are you trying to combine LAY with greening?

In which case the instruction is LAY OFFSET:x WITH_GREENING:TRUE

This will only work if an offset bet is placed as the greening calculation is made at the same time.

If you want to green without using an offset then you must submit a separate instruction after you have concluded betting. Such as a global 'GREEN_ALL' instruction.
Bet_boy
Posts: 21
Joined: Mon Nov 07, 2011 11:13 pm

Thank you 6th Sense.

I want to green without using an offset.If must use a separate instruction after i have concluded a bet,how can i add some triggering condition for the Greening?

Is there no combined sentence for Lay then Greening?
6thSense
Bet Angel
Bet Angel
Posts: 375
Joined: Fri Nov 30, 2012 5:02 pm

If you think about it logically it is a two step process.

Step 1: Bet
Step 2: Green up

So you will need to submit a separate GREEN_ALL instruction.
GMBing
Posts: 55
Joined: Sun Aug 07, 2011 11:58 am

Hi - When you say you want to green without using an offset then you must have an alternative reference to trigger the greening command.

In Guardian automation there is a grenn all profit condition which may be suitable or alternatively if as it sounds you are using excel interface then you could write a VBA page code to clear status "PLACED" when the greening command is activated.

Regards

G
Bet_boy
Posts: 21
Joined: Mon Nov 07, 2011 11:13 pm

Hi GMBing,thank you for your reminding.Yes,i want to create a code in Excel.But encountered several problems.

First,as you said that clearing status "PLACED" and "ERROR".I have coded a VBA.But it resulted the Excel was running very slow.Almost froze the Excel.Here is the code.I don't know what's wrong.Could you help me to correct it ?

Private Sub Worksheet_Change(ByVal Target As Range)
'
' Macro1 Macro
'

'
Range( _
"O17,O9,O11,O13,O15,O17,O19,O21,O23,O25,O27,O29,O31,O33,O35,O37,O39,O41,O43,O45,O47" _
).Select
Range("O47").Activate
Selection.ClearContents
End Sub

Thank you
GMBing
Posts: 55
Joined: Sun Aug 07, 2011 11:58 am

As an example to clear status PLACED if cammand CLOSE_TRADE is activated from excel

Private Sub Worksheet_Calculate{}

If [L9] = "CLOSE_TRADE" And [O9] = "PLACED" Then
[O9] = ""
End If

End Sub

You will need and If statement for each selection or sometimes more that one.

However once written save it as a Word Doc and paste into page code each time you connect to Excel

PS when playing arounnd with VBA codes be sure the Then element of the statement renders the If element as no longer true or you will have problems.

Like above the Then [O9] = "" makes the first part no longer true

Hope that helps

G
Bet_boy
Posts: 21
Joined: Mon Nov 07, 2011 11:13 pm

Hi GMBing,thank you for your coding.I have two questions:-

1. how can i code for clearing once per second ( can control the time)?

2. i am a newbie in Excell. How can i create your code in Excell and dose it only clear cell O9 ? If clear 20 selections,are this code repeated 20 times in the different cells ?

Cheers.
GMBing
Posts: 55
Joined: Sun Aug 07, 2011 11:58 am

Hi again

Be very careful about clearing status cell once every second. I once done something similar and placed 17 bets in a live market in one second. So it would have to be very carefully written to ensure a cammand prompt can not be fired at the second time the cell is instructed to clear

Also you would need to use a time range > value And < value as excel will look for the absolute time value which is changing by the milli second.
If you assign a cell to = countdown timer and then format that cell to "number, 10 decimal places" you will be able to see the value excel reads time values by.

It is also this decimal format that you need to use in If/Then command

Yes you do need a seperate statement for each selection and on some automated trading systems I have many per selection. But as I said once written it can be saved as a word doc and you only need paste it when you open excel. In theory of cousre you could record a marco to clear all cells at once and use the If statement to call this macro but the bet angel sheet is a read only dumb tool and it will be an attached sheet that really drives your trading and two open excel sheets both calling marco will very quickly crash - hence why I only use page code statements and no macros on the bet angel sheet.

Not being aware of your level of knowledge of excel or VBA programming it is difficukt to know what level of support you need but to anyone I would reccomend that you start will a very simple macro and a simple page code to call that macro. If you have the right logical mind set from this small block you will build castles and if you don't nothing will make it make sense

Regards
G
Bet_boy
Posts: 21
Joined: Mon Nov 07, 2011 11:13 pm

Hi GMBing,i have copied your code to BetAnel_1.But it couldn't work. I'm using Excel 2007 version.

Cheers.

Image

Image
GMBing
Posts: 55
Joined: Sun Aug 07, 2011 11:58 am

Hi

The red text on Private Sub Worksheet_Calculate() means there is a problem with this script.

Check that the open close brackets are the standard shift 9 0 type

or if you clear all text you should be able to select worksheet and calculate which will give you the opening and closing script automatically to inset If statement between.

Let me know if it works

Regards

G
Bet_boy
Posts: 21
Joined: Mon Nov 07, 2011 11:13 pm

Great, GMBing.The code is working now.I have just moved one condition as below:-
Private Sub Worksheet_Calculate()
If [O9] = "PLACED" Then
[O9] = ""
End If
End Sub

And could you also please let me know how to add something in to the code for clearing other statuses of selections (e.g. O11,O13,.......)

Appreciate you again.

Image
GMBing
Posts: 55
Joined: Sun Aug 07, 2011 11:58 am

Hi again

Its just a matter of writing muliple statement as example below

Private Sub Worksheet_Calculate()

If [L10] = "" And [O9] = "PLACED" Then
[O9] = ""
End If
If [L10] = “” And [O9] = “FAILED” Then
[O9] = “”
End If
If [L12] = "" And [O11] = "PLACED" Then
[O11] = ""
End If
If [L12] = “” And [O11] = “FAILED” Then
[O11] = “”
End If

End Sub

However the statement you have will allow betangel to place muliple bets as as soon as a bet is placed it will clear status and re place the bet over and over again until you have no funds available

So be careful

Regards

G
Bet_boy
Posts: 21
Joined: Mon Nov 07, 2011 11:13 pm

Excellent! Thank you with gratitude.Wish you having successful trading.
Post Reply

Return to “Bet Angel for newbies / Getting started”