I would like the attached Tradingview script converted to python. I do not need anything plotted, but instead of plotting create a signal or variable with the B and S. On the plot, using the offset, the S and B flags work best, earlier than without the offset. I am pulling live data directly from the exchanges to use as input for the price. In the pine script, there is a variable named g, it is not defined, so I'm not sure how the pine script is working with undefined variables, but it seems to work on trading view. The winning bidder will have to provide a live screen share showing it working.