Ichimoku, using Tenkan-sen and Kijun-sen as a band for a signal test

TenkanSen = ICHIMOKUCLOUD().TenkanSen;
KijunSen = ICHIMOKUCLOUD().KijunSen;

Cu = MAX(TenkanSen, KijunSen);
Cl = MIN(TenkanSen, KijunSen);

ClosePrice = CLOSE();

BullishSignal = ClosePrice > Cu;
BearishSignal = ClosePrice < Cl;

IF(BullishSignal, 1, IF(BearishSignal, -1, 0));

SHOWBAR(BullishSignal, Green, Bar, AboveHigh);
SHOWBAR(BearishSignal, Red, Bar, BelowLow);

I used the AI to check the script. AI says that the script looks good, but it also warns that it is still learning scripting and can be wrong. Anyway, I used this script as a signal test, on the SP500 and I set the test period from 07/20/1998 to 04/30/2004 (my in sample data)
Unfortunately, no results were shown because the of the “invalid script”

Did I make a mistake in the defining the script? Scripting is like a new language to me, and I am learning it slowly with the help of the AI in knowledge base

Hi Jeff,

Do not use AI to learn scripting as it doesn’t understand the correct syntax and will only work for very simple formulas. We have a series of tutorial videos available under the Scripting Resources section of the Help menu in the software, or by signing in here:

If you can show the signals on a chart and describe exactly when they should occur then we’ll point you in the right direction.