I've added a script from the Community Scripts, and it is calculated incorrectly and/or I don't understand how it works

Scripts of the Community Scripts are written by TradingView users. If you have any questions related to such a study, please contact its author directly. You can find the author nickname next to the script title in the Indicators dialog window: