Keeping a bet at the best available price on the opposite side
Description
These triggers will keep your bet at the best price available in the opposite side of the market. It is assumed that before the triggers set into action, you will place either a back or a lay bet on a selection of your choice, and that bet stays unmatched.
The triggers will then help match your bet at a price even better than the current offer. So if you place a back bet at the lay price, the triggers will keep cancelling and re-posting this bet if the prices change, so that it is always placed in the first position of the lay side.
The triggers may look a bit complex, but that's beause they cover all possible cases in this problem. You will find three blocks in the file: one is functional, do not change or remove it. The other two contain similar triggers, one is for keeping a BACK bet, and the other one is for keeping a LAY bet. Disable one of them if you don't need it.
The triggers will constantly keep an eye on the selection's price: as soon as it becomes worse, the trigger will cancel the existing unmatched bet and place another one, with a corrected price, in the hope that it will get matched sooner or later.
If the price deteriorates beyond the specified number of ticks as compared to the initial price of this selection, then a special trigger will match the remaining unmatched bet at the current best price to prevent losses.
There is a constant for editing the maximum number of ticks by which the price can deviate from the initial one.