I have a rule called 'Back Bet Placed'. I then have another rule called 'Back Bet Accepted' which moves the bot on obviously once the opening bet has been fully matched.
The problem is, 'Back Bet Accepted' triggers immediately. I have a condition that 'The Value of Unmatched Back Bets' = 0 but, I've checked in the logs, this = 0 before I get confirmation that the first bet has even been acknowledged.
I need something like a stored value to store the transaction count (for that selection in particular) in the first rule then a condition that this number is larger in the second rule, does automation have anything like that? I know there are transaction count cells in Excel's template sheet.
If not, any ideas for a good workaround? I was thinking of having a flag 'if unmatched > 0' as an in-between rule but what about if the bet gets matched immediately and was never unmatched?? Got to the stage where I am overthinking so here I am.
TIA.
Rule Triggering Too Quickly.
-
- Posts: 78
- Joined: Sun May 10, 2020 11:47 am
I normally deal with situations like this by having a separate stored variable that indicates which phase of the trade I am up to. So it may have the following states:
tradePhase=0 - Pre-Trade. Conditions: number of unmatched bets on the current selection=0; value of back bets matched = value of lay bets matched.
tradePhase=1 - Order placed. Conditions: number of unmatched bets on the current selection > 0
tradePhase=2 - Opening Bet Matched. :Conditions: Value of Back Bets Matched != Value of Lay Bets Matched.
You'd have separate rules to set each of the above phases which would run every refresh. Their only purpose is to set the tradePhase stored value and they are run before any rule that does any actual work. This has the following advantages:
tradePhase=0 - Pre-Trade. Conditions: number of unmatched bets on the current selection=0; value of back bets matched = value of lay bets matched.
tradePhase=1 - Order placed. Conditions: number of unmatched bets on the current selection > 0
tradePhase=2 - Opening Bet Matched. :Conditions: Value of Back Bets Matched != Value of Lay Bets Matched.
You'd have separate rules to set each of the above phases which would run every refresh. Their only purpose is to set the tradePhase stored value and they are run before any rule that does any actual work. This has the following advantages:
- It separates out the market logic from the rules that actually make a bet
- Allows the conditions of betting rules to be more abstract eg: I only place my closing lay bet if tradePhase=2
- All following rules have access to the tradePhase value without having to duplicate the logic in the conditions. You just test the value of tradePhase
You do not have the required permissions to view the files attached to this post.
-
- Posts: 575
- Joined: Wed Apr 19, 2017 5:12 pm
Hi the4droogs,
I think our logic is pretty parallel in that your phases match up with how I've set up my signals to move between different phases of the system.
Something that stands out to me immediately is that if I have a rule which is 'Order Placed' but I have a condition that this can only trigger if unmatched back bets > 0, then this will never fire, surely? There's no bet open without this rule to ever make this condition true?
Will that condition, "Unmatched bets on the current selection > 0" ALWAYS work?? I'm using the reverse price but is there not the slightest chance that my opening bet will be immediately accepted and thus I am stuck in Phase 1, resulting in me having an open back bet which wont close until post time when my green-up rule overrides it to close. I'm OCD with accounting for every outcome I can think of.
If I then had 'Unmatched bets on the current selection > 0 OR Value of Back Bets Matched = Value of Lay Bets Matched' then this could account for it but the back bets = lay bets currently in stage 0 so arghhhh, you see my problem?
I need a transaction count like in Excel, but that's not in automation is it? Unless there's another way around it while still accounting for an opening bet being matched immediately? There is a chance this could happen? I'm overthinking this.
I think our logic is pretty parallel in that your phases match up with how I've set up my signals to move between different phases of the system.
Something that stands out to me immediately is that if I have a rule which is 'Order Placed' but I have a condition that this can only trigger if unmatched back bets > 0, then this will never fire, surely? There's no bet open without this rule to ever make this condition true?
I think if I had a 'bridge' flag between the phases, so Phase 1 placed the opening order, the flag checks it is in the market and then Phase 2 confirms it has been matched, that would work. Here is my problem.the4droogs wrote: ↑Wed Sep 01, 2021 12:09 amtradePhase=0 - Pre-Trade. Conditions: number of unmatched bets on the current selection=0; value of back bets matched = value of lay bets matched.
tradePhase=1 - Order placed. Conditions: number of unmatched bets on the current selection > 0
tradePhase=2 - Opening Bet Matched. :Conditions: Value of Back Bets Matched != Value of Lay Bets Matched.
Will that condition, "Unmatched bets on the current selection > 0" ALWAYS work?? I'm using the reverse price but is there not the slightest chance that my opening bet will be immediately accepted and thus I am stuck in Phase 1, resulting in me having an open back bet which wont close until post time when my green-up rule overrides it to close. I'm OCD with accounting for every outcome I can think of.
If I then had 'Unmatched bets on the current selection > 0 OR Value of Back Bets Matched = Value of Lay Bets Matched' then this could account for it but the back bets = lay bets currently in stage 0 so arghhhh, you see my problem?
I need a transaction count like in Excel, but that's not in automation is it? Unless there's another way around it while still accounting for an opening bet being matched immediately? There is a chance this could happen? I'm overthinking this.
-
- Posts: 78
- Joined: Sun May 10, 2020 11:47 am
Why not? If you place your opening bet at tradePhase=0 and it goes unmatched, then the condition would be true which would cause this rule to be activated and set tradePhase to 1CallumPerry wrote: ↑Wed Sep 01, 2021 10:13 am
Something that stands out to me immediately is that if I have a rule which is 'Order Placed' but I have a condition that this can only trigger if unmatched back bets > 0, then this will never fire, surely?
Yes there is a chance that the opening bet will be immediately accepted, which will mean that the total amount of back bets matched is not equal to the total amount of lay bets matched so the next rule would fire and change to tradePhase=2 - which would mean it's time to place your closing bet as the opening bet has been matched.is there not the slightest chance that my opening bet will be immediately accepted and thus I am stuck in Phase 1
Once the closing bet is matched the first rule would trigger again since the total value of lay bets matched is now equal to the total value of back bets matched. Voila! You're back to tradePhase zero and the bot is ready to go again.
-
- Posts: 575
- Joined: Wed Apr 19, 2017 5:12 pm
Hi decomez6,
Yeah, I've used incremental signal rules several times in this bot already. Is there some way you're thinking I could use this to solve the problem I have outlined above?
you want the number of matched bets or amounts of mathced bets ?CallumPerry wrote: ↑Wed Sep 01, 2021 10:55 amHi decomez6,
Yeah, I've used incremental signal rules several times in this bot already. Is there some way you're thinking I could use this to solve the problem I have outlined above?
back ? lays ? or total ?
do you want to save this count/ amount as a Stored value to use it as a flag ?
unless i am missing somethingIf I then had 'Unmatched bets on the current selection > 0 OR Value of Back Bets Matched = Value of Lay Bets Matched' then this could account for it but the back bets = lay bets currently in stage 0 so arghhhh, you see my problem?
the4droogs idea is a nice way to stop adding into positions until your bets have all been matched
stage 0 : ready to accept bets (store value 0 )
stage 1 : bets active (store value 1 )
stage 2 :trade complete (store value 2 )
you can then control the amounts of bets to placed depending which stage you currently are. using the stored value 0,1 or 2.
my suggestion is to increase a signal count when a condition is met and decrease it when the condition goes the opposite way , e.g . when you back increase the count by 1 and when you lay decrease by 1 terefore going back to your starting position
then use the signal value change to drive other files .
-
- Posts: 575
- Joined: Wed Apr 19, 2017 5:12 pm
Hi again decomez6,
That’s the problem, I guess. I don’t know what I need to store. I need a solid way of moving from ‘Bet Placed’ to ‘Bet Accepted’. Just has the afternoon/evening out with this problem on my mind.
I should have pointed out that it’s not just as simple as going from A to B, the bot could also go to opening bet unmatched and LTP moved a few ticks or opening bet partially matched etc so there’s quite a few routes that I’m trying to account for. Was just hoping there was a simple condition/stored value I could use but there doesn’t seem to be.
I have decided to use a ‘bridge’ flag between phases that will hopefully distinguish between the three possible next stages. Going to sleep on the problem and see if I can come up with anything. Thank you for your help so far.
That’s the problem, I guess. I don’t know what I need to store. I need a solid way of moving from ‘Bet Placed’ to ‘Bet Accepted’. Just has the afternoon/evening out with this problem on my mind.
I should have pointed out that it’s not just as simple as going from A to B, the bot could also go to opening bet unmatched and LTP moved a few ticks or opening bet partially matched etc so there’s quite a few routes that I’m trying to account for. Was just hoping there was a simple condition/stored value I could use but there doesn’t seem to be.
I have decided to use a ‘bridge’ flag between phases that will hopefully distinguish between the three possible next stages. Going to sleep on the problem and see if I can come up with anything. Thank you for your help so far.
i think you need to account for all possible scenarios, make appropriate rules for each occassion and then set up some flags using designated stored values .CallumPerry wrote: ↑Wed Sep 01, 2021 9:47 pmHi again decomez6,
That’s the problem, I guess. I don’t know what I need to store. I need a solid way of moving from ‘Bet Placed’ to ‘Bet Accepted’.
I have decided to use a ‘bridge’ flag between phases that will hopefully distinguish between the three possible next stages. Going to sleep on the problem and see if I can come up with anything. Thank you for your help so far.
matched / umnamtced bets conditions are a good way to seperate each stage .
the partially matched bets can also be stored as a value ( Back /Lay partially matched). then condition a rule to trigger only when the partiailly matched is = to X amount.
i made the small bot below to demonstrate how you could go about saving each back bet as a stored value and only use the amount matched fully or partially to offset the bet .
NB: the bot is only to show you one way of doing it its not fully tested .
the next one is a bonus to help you see how you could go about cancelling some unwanted bets ...
NB: this bot can be modified and i actually find it interesting , but again it all depends if you got enough time to spend such a simple bot...could be something in it .
You do not have the required permissions to view the files attached to this post.