you can change the code like this:

which will run that function only once, when both ticket numbers are recorded
... or you can create another rearrangement of blocks too, like this one:

where the custom code block happens after all the cycles are finished
but in this case, custom code block must have its ID number larger (yellow circle) than any number from the green circle
... each for loop can go through all the trades (can happens more than 1x) and condition blocks as filters can be added (and record only that trade, which will match the filter) ... but thats your job 











