Yes, that looks quite wrong. I wonder why you get no runtime error with this script.

The order of commands does matter in programming. First set all script parameters, such as the bar period, TICKS, etc, and then load the asset. Not the other way around. Otherwise the asset is not loaded in TICKS mode, but in low resolution. The INITRUN clause is not needed.

You can see in workshop 6 in the manual how a portfolio script should look like.