Scripting help Please

I am trying to make a simple trading system where it gives me a buy or sell signal based on if there is a 8/21 sma cross (up for buy and down for sell) on the daily and there is a squeeze on all or either daily, weekly, monthly timeframes. I have been watching video on youtbe and used Chatgpt to help me but it’s not working. Here is the script it came up with: // Optuma Trading System - 8/21 EMA Cross with Squeeze on Daily, Weekly, or Monthly. If anyone could help me I would greatly appreciate it.

// Define Moving Averages
EMA8 = MOV(CLOSE, 8, EXPONENTIAL);
EMA21 = MOV(CLOSE, 21, EXPONENTIAL);

// Define Squeeze Conditions (Bollinger Bands inside Keltner Channels)
BB_Upper = BBANDTOP(CLOSE, 20, 2);
BB_Lower = BBANDBOTTOM(CLOSE, 20, 2);
KC_Upper = KELTNERBANDTOP(CLOSE, 20, 1.5);
KC_Lower = KELTNERBANDBOTTOM(CLOSE, 20, 1.5);
Squeeze = (BB_Upper < KC_Upper) AND (BB_Lower > KC_Lower);

// Multi-Timeframe Squeeze Conditions
TIMEFRAMESET(WEEKLY);
SqueezeWeekly = Squeeze;
TIMEFRAMESET(MONTHLY);
SqueezeMonthly = Squeeze;
TIMEFRAMESET(DAILY); // Reset to default timeframe

// Buy Condition - 8 EMA Crosses Above 21 EMA with Squeeze
BuySignal = IF((EMA8 > EMA21) AND (Squeeze OR SqueezeWeekly OR SqueezeMonthly), 1, 0);

// Sell Condition - 8 EMA Crosses Below 21 EMA with Squeeze
SellSignal = IF((EMA8 < EMA21) AND (Squeeze OR SqueezeWeekly OR SqueezeMonthly), 1, 0);

// Plot Buy/Sell Signals
PLOT(BuySignal, “Buy Signal”, color=GREEN, style=DOTS, linewidth=2);
PLOT(SellSignal, “Sell Signal”, color=RED, style=DOTS, linewidth=2);

// Signal Alerts
ALERT(BuySignal == 1, “8/21 EMA Buy Signal with Squeeze”, BAR);
ALERT(SellSignal == 1, “8/21 EMA Sell Signal with Squeeze”, BAR);

Thanks Eric. ChatGPT doesn’t understand our scripting language (eg we use MA() for a moving average, not MOV), so best to use our scripterbot:

Here’s a previous post on creating a Bollinger / Keltner squeeze: