I don't think that you can easily get data for 2018 - 2019 with ib. If I remember correctly, you should have several millions on the account and spend several thousands in commissions to get that deep. Google ib historical data limitations or something like this.

Script from @dasch will generate signals when high or low prices will break the boundaries of
channel built on close price.

This

I'm making an indicator which requires me to select the highest value in a certain range only if that value is greater than the price channel high at that bar.

highest value of what? of the price? of the another indicator?

talking about prices - if you built the price channel on lows and highs, you can only check if current high/low is higher/lower than previous value because current value will be within the channel by definition:

I meant to say that if I have a range, and the highest high value in that range -->
Then only take it if the highest high value > Another Indicator I've defined at that bar.
So basically, in the below picture the line is the indicator. If there's no value above it, I don't want anything.
But if there are high values above it, then I want the highest high.

Looks like your first script with StopTrail orders worked as expected. You used 25% stop from the price of order execution. Your first orders were executed at prices around 14.5 - 15.5 and you stops were set to approx 11.5 - 12.0. You can see them executed at that spike of the cash, 6 red triangles in a row.

Numbers you posted for sure make sense for you, but you may want to elaborate more if you really want some help. Leverage is a word used in different context differently by different traders. What is ADSK? What is gross_lev? You made some calcs, but didn't reveal them.

Just make simple thing: open one position, post prices and size, cash before and aft in bt and in ib, post what you expect.