I fixed my code above.

According to the asset() page:
Quote:
If the asset function is used, it must be called in the first run (INITRUN) of the script. All variables and flags that affect the price data array, such as BarPeriod, BarZone, LookBack, Detrend, StartDate, EndDate, TICKS, Weekend, UpdateDays, AssetList, History etc. must be set _before_ calling asset.
http://zorro-project.com/manual/en/asset.htm

It's good practice to define an asset() before the series because if you trade multiple assets with the same script, it will become a requirement.