OK, given that we have seen that the Lay at SP trigger works every time, using selections present in the source file T456.txt, it has a price limit, so it wont bet over the price, and the tricky part comes, when/if at some point before in play, the price drops below the level given. As we have placed this using a Lay at SP, we cannot cancel the bet, due to the SP rules of betfair....
So, if we have a bet that has an 'in play' price below the set level, the bet will still get placed because we cannot set a minimum value through betfair, on a Lay bet, because the idea is that a lower price is a 'better' price. Same goes for Back bets, where a higher price is a 'better' price.
hence the need for the trigger to deal with this, which will check the SP, and if its below, it will place a bet.
Nothing new here...
So, as per my trigger system, I am writing to a text file, which has the ending 'SP', as in T456SP.txt, and this checks that the previous trigger has a number of runs > 0, AND also checks that the number of matched lay bets > 0, and if so, it places that selection in the SP text file.
Again, as before, nothing new...
Next part, which is failing, my trigger has the condition that the selection is contained in the SP text file. Of course, as we know, this is not working for me, and given that MarkV has gone to great lengths to help me sort it, I am still no further.
You may ask why I insist on writing to a text file, and reading from this text file?
Well, I have a number of strategies, let's stick with 2, and occasionally, more often than not, they will BOTH have the same selection in their respective source text file.
You could suggest that I just simply observe number of Matched Lay Bets > 0, and then check that the Actual Starting Price is below my level, and if so, place a back bet.
Using this approach, the trigger WILL work, because it is interacting with MFP, rather than an externally created text file, and as we know, MFP does its work perfectly.
BUT, as I want to use a number of strategies, each of which have their own price ranges I want to use, then, if the price is say 16, and this satisfies strategy 1 conditions, and a Lay at SP is placed, the races starts, and the Actual Starting Price is 16.5, which means that strategy 1 has had a successful bet. Now, if we look at strategy 2, whose minimum odds are 19, and given we are lucky enough for the selections price to not to reach, or go above 19, during the waiting phase before the off, then the Lay at SP part will not trigger. The problem is, the selection has had a successful lay bet matched, using strategy 1, so, if I then check the number of matched lay bets > 0, this condition will be satisfied, and a corresponding check to see if the SP is below 19, will come back as true, and so, a back bet will be placed.
Hopefully, given that anyone reading understands the whole process, you can see that strategy 2, will not have placed a Lay at SP bet, but, in its check, it will see that there is a lay bet matched for this selection, which was provided by strategy 1. As we know, the check does not know which part actually placed the Lay bet, and if the Back part spots this lay bet and the SP is below the expected level, a Back bet will be placed, which, in this case, is an unavoidable mistake.
Hence the reason why using a text file is essential, where Strategy 1's text file will be in a different location to Strategy 2's text file, and so, the checks done by each strategy, will be specific to location of its text file.
There may be a 'better' way to do this, such that each of these selections will not get mixed up in the process, and ALL of the rules are adhered to, but at this time, my setup looks to be the best one?
I will be happy if anyone is still awake at this point, reading my long text, and I will be even happier to discuss a maybe better solution?
Thanks for reading
Mark.