For question 1, if the script's Calculate property is Calculate.OnBarClose then the script will process the BarsInProgress in the order they were added starting with the primary series with the exception of the 5-minute series you added. That will be called every 5 minutes, messing up the order because it's a higher period. If all the series were 1 minute, they would process in the order they were added.
For question 2, you need at least one 5 minute bar in order to access Opens[1][0], in your script you would write:
OnBarUpdate() { if(CurrentBars[0] < 0 || CurrentBars[1] < 0 || CurrentBars[2] < 0 || CurrentBars[3] < 0) return; //Otherwise, here you have at least one 5 minute bar to access. }
Best regards.
-ChrisL
Leave a comment: