Nel primo commento, sotto al grafico, vi è scritto:
"WARNING: For you newbies or those unfamiliar with Pine. This script does not work as well as you think. A quirk of Pine script means it will not perform like this real time.
JayRogers probably did not realise this when writing it.
EXPLANATION:
It gets data from a higher timeframe, i.e. your testing on a 1 minute chart pulling data from a 1 hour chart; "security(tickerid, res, exp) : exp"
A quirk of "//@version=2" of Pine in backtesting is when you pull data from a higher timeframe it looks to the close of that timeframe, i.e. on a 1 minute chart asking for a close price on the 1 hour chart, it will retrieve the close at the end of that hour. So in the 1st minute of the hour the script pulls the price at the end of the hour.
It effectively looks into the future, hence the excellent results."