Syntax for Accumulative Swing Index

I am trying to create a crossover code fos Stochastic and Accumulative Swing Index


Buy: 


What is the syntax for Accumulative swing index.
Also, the logic for the code is Buy When Stockastic > 90, Accumilative Swing index >145, Trend > UP
And Sell When Stockastic > 10, Accumilative Swing index Trend < DOWN

BUY SCRIPT:

​SOPK(9, 3, 9, SIMPLE) > 90 AND
ASI(1) > 145 AND
TREND(ASI(1)) > UP

EXIT LONG:

​SOPK(9, 3, 9, SIMPLE) < 10 AND
TREND(ASI(1)) < DOWN

Corrected:

SOPK > 10 TO SOPK < 10

Thanks a lot. Works like a charm.
I have a query addition to this. I want to exit Longs just at the time of Short signal. When I enter the same Long script at exit short and the same short script at the exit long, its not generating. It should logically work right? When the signal is for short, the exit long should trigger. But it does not happen so.
Am I doing it wrong?