Author Topic: Logging EVERYTHING that a trigger does  (Read 5219 times)

Tags:
  • All members
  • Posts: 314
Logging EVERYTHING that a trigger does
« on: 30 Dec 2017, 13:06 »
Hi,

This is probably a newbie question, and I send my apologies if it is, BUT...

I am a Debug 'freak', and that is why I am pretty much an expert in finding problems with my own, and others' software.

I have wrote a trigger, and it is not doing what I expected, and I cannot work out why it is failing. Yes, I understand that it must be my mistake, because MFP works by what instructions I give it.

So, in order to discover what the mistake is, I want to debug it.

The problem is, when I click on the trigger, and it opens a firefox tab, I am just not getting anything displayed, so, I cannot discover which items have been executed. I have been watching the races today, and I have a trigger that examines the prices of each selection, and if it is within a certain range, an SP bet is placed.

THEN, given that the bet is matched (highly likely, as its a BSP bet), then, whilst in play, I have to examine if the actual_sp is within the range, if it is BELOW the accepted value, then I am expecting the trigger to place a BACK bet, at the same amount given at the lay time. A race happened today, and it placed a Lay at SP bet, and the actual starting price was below the accepted value, and so, I was expecting it to place a back bet, and that didnt happen...

My trigger doesnt seem to be executing that, and this now means, I have to sit and watch, and if the lay bet is placed, and the actual_sp is below the acceptable value, I place a manual bet. Which takes away the automated process, as I have to do it semi-manually.

Is there some way that I can get a FULL and detailed log of exactly what has happened, at every stage. I expected that to be shown once I click the trigger, but I am not getting anything, so, I am hoping that I can somehow extract the executions/actions somehow?

I am determined not to send in a trigger request, as I really need to be able to locate mistakes myself, rather than rely on someone else, to fix it for me.

Thanks

Mark.

  • Moderator
  • Posts: 3597
*
Re: Logging EVERYTHING that a trigger does
« Reply #1 on: 30 Dec 2017, 18:12 »
Hi
Ensure the following setting is ticked:
Settings > Betting Options > Triggers > Log information about triggers

Run your trigger
on the main market screen towards the top right, click Program logs, then select the tab: Trigger Logs

further troubleshooting:
you should be able to see program log and statement tabs, if you also cant see those try lowering your browser security settings, or try another browser

HNY
Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 314
Re: Logging EVERYTHING that a trigger does
« Reply #2 on: 30 Dec 2017, 19:18 »
Hi MarkV,
Many thanks for your assistance,

I think I am going to have to look at requesting a trigger to be looked at. I really do NOT like to do that. This is not because I am unhappy about the new £6 cost, but, because my trigger 'looks' right, but I can't drill down into every single detail. I simply want to be able to see every single variable/object throughout the process, which will enable me to figure out why its not working.

I know 100% that my logic is correct

I place a LAY at SP, I write an entry into a file
I wait for the bet to be placed, at the off, at BSP
THEN, once in play, I check to make sure that the actual_sp is below a set value, and if it is, then I look to place a back bet at the same price, with the same amount, which effectively will balance everything out, and produce £0 net.

Simple logic, which should work, but, for the life of me, I cannot drill down into exactly whats happening throughout the process, and thats because I am not able to get hold of the logging data.

The settings and advice you gave, are already being followed, I have logging of triggers set, always, but sadly, I am still not getting the logs back.

I am getting sick of trying, because I do a lot of stuff that is way more complicated than this, with ease, yet I can't debug a simple trigger. frustrating.

If somebody is happy to be on board with this to help me sort it, then let me know and I will ask for you in the trigger request. (which is in fact a trigger 'fix')

Thanks

Mark.

  • Moderator
  • Posts: 3597
*
Re: Logging EVERYTHING that a trigger does
« Reply #3 on: 30 Dec 2017, 21:23 »
Hi
Logging:
disregarding trigger logs, can you see either the program log or the statement?
if you can't see either of those something on your computer is stopping the logging system in MFP, i.e. browser security, antivirus, firewall etc.
if you can see either the statement or program log, please try a new profile with the default settings and see if the triggers are logged then.

Offset Mistake Trigger, perhaps try something like this in test mode (I've not tested it):
back
price: bm_layp
amount: bm_laya
all matching selections
execute: once per selection
Conditions:
markets minutes since the off is equal or greater than 0.07 
and trigger 456 V1 number of runs per selection is greater than 0
and selections number of matched lay bets is greater than 0
and selections actual starting price is less than lowSetMaxV1



 
Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 314
Re: Logging EVERYTHING that a trigger does
« Reply #4 on: 30 Dec 2017, 22:21 »
Hi MarkV,

Many thanks for your help.

I cannot use....

price: bm_layp
amount: bm_laya

This is because I may have another strategy (similar to this) which is also betting on this selection, which will cause confusion as each bet is NOT distinct, so I have decided to go with:

price : actual_sp
amount : bankV1 * (percV1/100)/(actual_sp - 1)

where actual_sp is specific to that selection, and as the Lay at SP is using percV1 percetage of my bank, producing an actual ammount when divided by the consequent actual_sp, then the bet amounts will be the same.

Conditions:

Selections name is in file T2R456_A4A5A6D4D5D6WLSP00.txt, (which was written to by SP 456 V1)
and Market's status is In-Play (I didn't realise I could do this, but this will eliminate the need to set an after market start value)
and selections Actual Starting Price is less than lowSetMaxV1 - (I am not sure how this is different to using Trigger expression actual_sp is lower....)
and Trigger SP 456 V1 Number of runs is greater than 0

I was potentially thinking of using Selections Trigger expression lay_sptotal is greater than ((bankV1 * (percV1/100)) - 1), where use of -1 is just in case there are any slippage in amount, the -1 will cover it...? Not sure?


As for the logs, I can see both Program Log and Statement, I have discovered that when I click in the area where the named triggers are located, I can select any of these. I selected the Back Offset Mistake, and there was nothing in there... So, I suspect that it is not doing anything.

Thanks again, I will try what you have suggested, and if I don't get any joy, I will look to request a trigger fix.

I appreciate that my trigger is pretty simple, but involves some complicated tasks. The logging of the text files is important to me because I gather the data so that I can continually analyse it and try to perfect the picking technique, the system I have is pretty good, sadly, it is let down by the trigger not doing as hoped - MY FAULT, I know that, but just need some help to perfect it.

Thanks

Mark.

  • All members
  • Posts: 314
Re: Logging EVERYTHING that a trigger does
« Reply #5 on: 02 Jan 2018, 21:02 »
Hi,

After the frustration of not getting my trigger to work, and posting a Trigger 'fix' request, I decided to try and look at the logs, and sadly, as has proven to be the case many times, I decided to go into the profiles / <profile> / logs / triggers / <date> / <race Time? / directory, and open the gz file with winrar, to be presented with a text log file.

I opened the log for a particular race where I lost money, because my trigger is not working. I wanted to see exactly what is contained in these logs, in a raw state, i.e. the text of the log...

As you can see from the image, I have overlayed the image of the text file, containing the criminal horse "Caspian Prince", which won, and I LAYED it....

So, if you look at the image, you can see that the trigger is called "Back Offset Mistake V2", the race time was 17:10, hopefully, you can see in the trigger that it is checking to see if the selections name is in the file "T2R456_A4A5A6D4D5D6WLSP00.txt", and from the overlayed image, you can see, quite clearly, that it IS indeed in there, but then, the statement preceded with 17:13:30|2|3, shows as  FALSE.

This trigger is checking for any selections contained in the text file, and if found, it then looks to see if the number of matched lay bets is greater than 0, and there are other conditions, but these have not been reached, because the trigger exits once the condition is false. I have gone right to the bottom of the log file, and they all show false


For the sake of simplicity, I will refer to the file above as SP00, and the log file as LogMistakeV2

So, before the race goes in play, I have a trigger which places a LAY at SP bet, AND it writes to the file SP00.

Once the race goes in play, I have another trigger which examines the SP00 file, and if there is an entry in there, then, surely, the trigger log should show this condition as TRUE.

I am not fully understanding how these log files are structured, but I know for absolute certain, that "Caspian Prince", was DEFINITELY in the SP00 file, and yet, the log file shows FALSE?

Throughout all of my trigger development, I ALWAYS enclose the selections name with speech marks, and the trigger's action which does this is a simple write to text file, with the text as ["sel_name"], hence Caspian Prince is shown as "Caspian Prince"

I can't believe that "Caspian Prince" and Caspian Prince are different, because ALL of my selections that contain a space, are contained in speech marks, and MFP picks them up no problem, so I don't think it is that which is causing the condition to show as false...

Maybe I am mis-reading the log file?

Any help would be appreciated.

Thanks

Mark

  • Moderator
  • Posts: 3597
*
Re: Logging EVERYTHING that a trigger does
« Reply #6 on: 04 Jan 2018, 13:55 »
Hi
I replicated the basic operation of the trigger in the screenshot to see if I can get the backing trigger to work. Seems to be ok. Just wondering if you have the option to reread the file ticked in the condition selections name is in file, as the text file is being updated "live"?

The back amount did not match the lay amount, perhaps you could try using the index for multiple bets on the same selection:
bm_1_laya = last matched lay bet amount on the selection
bm_2_laya = second last matched lay bet amount on the selection
etc..
 
Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 314
Re: Logging EVERYTHING that a trigger does
« Reply #7 on: 04 Jan 2018, 14:41 »
Hi MarkV,

That is good to know that my back trigger seems to be ok, which is valid enough for me. I was certain it was right. Yes, I ALWAYS use reread, it just seems the logical thing to do, especially as the text is changing live.

I am pretty sure I must have done something stupid, and I need to figure it out.

The second part of your response, I think is what I have needed for a LONG time, I wish I had known this before, although looking at it, I suppose that I should have figured it out.

I think one of my previous posts was complaining that there is no unique identifier for each bet, that we can reference, but, looking at bm_X_laya, where X is the index of the lay bet amount, I think this will possibly solve a LOT of problems. And, with this information, I can now look at developing more complex staking plans, for which previously I was reluctant to do because I could not identify if the selections lay/back bet was relevant to this action, but now, given I know the amount used, I can explore much more. Although I need to learn to walk before I can run.

This has given me a lot more scope for development, so, thanks very much for that...

Just out of interest, in C#, if you try to reference an index outside the count, the application will throw an exception, can I assume that if I try to reference bm_8_laya, and only 2 bets have been matched, then it will just ignore, and continue with the rest? Or, would this cause the rest of the trigger to fail?

Thanks again

Mark.

  • Moderator
  • Posts: 3597
*
Re: Logging EVERYTHING that a trigger does
« Reply #8 on: 04 Jan 2018, 15:42 »
Quote
Just out of interest, in C#, if you try to reference an index outside the count, the application will throw an exception, can I assume that if I try to reference bm_8_laya, and only 2 bets have been matched, then it will just ignore, and continue with the rest? Or, would this cause the rest of the trigger to fail?
Hi
it will return 0, use the Variables Viewer to see variables and formulas values live as they are happening, see attached screenshot
Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 314
Re: Logging EVERYTHING that a trigger does
« Reply #9 on: 05 Jan 2018, 14:28 »
Hi,

I am getting a little lost looking at bm_laya.

If I have, say 3 separate selections, I set to Lay them at SP, with a liability, and I duplicate the Lay at SP, with half of this liability. I want to be able to show each of the respective lay amounts, and so, given the selection index is 1, 2 and 3 respectively, then, I want to setup my View User Variables to show each of their bm_1_laya and bm_2_laya, and in order to be able to view these, I expected to be able to use :

s1_bm_1_laya
s1_bm_2_laya
s2_bm_1_laya
s2_bm_2_laya
s3_bm_1_laya
s3_bm_2_laya

Sadly, that didn't workout...

is there another way I should do this?

I know that you showed me bm_1_laya and bm_2_laya, but if I am wishing to look at more selections, and their lay amounts, I had hoped the above would  have worked?

Thanks

  • All members
  • Posts: 314
Re: Logging EVERYTHING that a trigger does
« Reply #10 on: 05 Jan 2018, 14:49 »
Also, clearly something is definitely not right here....

even though I have 2 Lay bets on 2 separate selections, all of the bm_laya are showing 0 ?

  • All members
  • Posts: 314
I am going insane!!
« Reply #11 on: 05 Jan 2018, 15:42 »
Hi All,

As per the subject header, I have to say this problem is driving me insane!

I have setup a test trigger, and decided to use a very simple logic, Lay at SP, regardless of anything else, except that the selection is contained within the text file. Easy.. Next, when it goes in play, check the number of lay bets match greater than 0, and if so, write to another text file. Easy, so far, so good, the first part lays at SP, second part then writes an entry to the file, but, even though I have put 1 single condition into the backing trigger, that being that the selection is contained in the file that was written in part 2, and if its there, place a back bet for the amount defined by liability/(sp - 1)

I don't think we could get anything simpler than this, but is is still not working, it seems the back trigger is not doing anything at all, I have it on top whilst the race goes in play, the write to file trigger flashes dark green, meaning the selection has been added, and then, as the back trigger is an in play trigger, it SHOULD keep polling and when it finds all conditions are true, it should execute the back. At no point does the back trigger flash dark green.

Einsteins theory of insanity is doing the same thing and expecting a different result. Well, I have tried every which way, and now, even at it simplest, Lay at SP, then in play, back at SP, it cannot reach that far.

MarkV, you said it looks OK, and this one now should definitely get an OK, but no joy at all.

I really need to get this to work.

Could this have something to do with the fact that I am laying at SP, and the SP values are not lining up with betfairs official tick values?

I have no idea why this refuses to work, I end up having to sit at my PC all day long, in case the lay bet goes in at below the allowed odds, and I have to take manual action to back it.

Nighmare!

  • Moderator
  • Posts: 3597
*
Re: Logging EVERYTHING that a trigger does
« Reply #12 on: 05 Jan 2018, 19:35 »
Hi
In answer to Reply #10:

In the screenshot your market is sorted by rank? the variable sel_index (which uses the prefix s_) is the index under which the selections are displayed by Betfair.
In the variable viewer if you do not specify the selection by using a prefix s_ or r_ it will default to the first selection

I think this probably also answers Reply #9

Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • Moderator
  • Posts: 3597
*
Re: Logging EVERYTHING that a trigger does
« Reply #13 on: 05 Jan 2018, 20:07 »
Hi
similar to what I tested in Reply #6, I replicated the basic operation of your trigger to test the backing trigger and writing to file. For this test I did not incorporate your formula for the amount. All good, please see screenshot. 
Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 314
Re: Logging EVERYTHING that a trigger does
« Reply #14 on: 05 Jan 2018, 21:43 »
Hi MarkV,

Your help is very much appreciated.

I don't set any ordering, to be honest, I am not aware that you can do that in MFP?

To be honest, I am not in any urgent need to use bm_laya. My own view of this, is that if I place a Lay at SP bet, and write to a text file, specific to that strategy, then, if I check the file for a selection, and then look at its actual_sp, and it does fall below the allowed value, I can then set a back bet.

I am looking at risking 8.5% of my bank, I want to use a decent sized bank, with a view to risking 5%, but I am stuck at using only £1K, because I cant get this working. As for your test trigger, I am pretty much doing this, but it just doesn't seem to work.

I may look at a redesign, and build it up from basics, I have a couple of weeks to spare, and from the help you have given, I am sure I can get this working. I suspect nobody has bitten on my trigger 'fix' request because as it stands, it should work, but there must be something going on with my machine causing it to fail?

There are a couple of things that I want to ask at this point, and the first is using selections from a cloud storage, such as Dropbox or Sync. Sometimes they do have a delay in updating, but, as far as physical location is concerned, it is still stored on my hard disk. I am wondering if there is any issue between Sync and MFP? - that's kind of clutching at straws..

On the same MFP, I have had problems for weeks with my install, and I think it has something to do with Adobe acrobat. The problem I have is that when I start MFP, it loads, and then freezes for some time, then, after around 1 minute, I get an empty adobe pdf document pop up, and then, shortly afterwards, I get what looks like a javascript popup that is entitled Acrobat plug-in, with the mess "Could not find Acrobat External Window Handler"...

I reported it to support a couple of weeks ago, but have had no response.

I may look to do a re-install, although I am reluctant to do that.

Thanks very much for your responses and your help. I think this has probably gone as far as it can, the logic seems to be OK, but its not working on my machine. The strategy I am using is that good, I am prepared to replace my whole machine, and just build a new MFP machine, one which I can leave to do its task properly. I might look to create a VM, and see how that goes.

Thanks again

Mark.

 

Please note, BetFair is seems to be currently OFFLINE