Thank you Andrew, you are exceptionally helpful!
the thing is that I did not dare to push my script onto anyone<
so I only gave you the line the error code did mention.

But since you asked;
here is my script, and the syntax error in line 15 mentioned is:
for (int year = StartDate; year <= EndDate; year++)

Note that the error is actually not in that line but the opening bracket is supposed to be line 15
I don't see any syntax error.
Can you point me to my error?

Code
function run()
{
	StartDate = 2015;
	EndDate = 2022;
	BarPeriod = 1;
	LookBack = 1440;
	PlotScale = 15;	
	Commission = 0.6;
	Spread = 0.3*PIP;
	
	int start_time = 90009;
	int end_time = 100110;
	
	for (int year = StartDate; year <= EndDate; year++) 
	{ // <-- THIS IS ERROR LINE 15 !
		for (int week = 1; week <= 52; week++)
		{
			var time = 0;
			for (int day = 1; day <= 7; day++)
			{
				time = weekday(timeFromWeeks(year, week, day));
				if (time == MONDAY)
				{
					for (int hour = 9; hour <= 10; hour++)
					{
						for (int minute = 0; minute <= 1; minute++)
						{
							for (int second = 9; second <= 10; second++)
							{
								var bar_time = timeHour(time) * 10000 + timeMinute(time) * 100 + timeSecond(time);
								if (bar_time >= start_time && bar_time <= end_time)
								{
									// Do comparison here
									// Example: var close = priceClose(0);
									// var open = priceOpen(0);
									// if (close > open) { /* do something */ }
								}
								time = (time + 60); // Advance to next minute
							}
						}
					}
				}
			}
		}
	}
}


If you wonder what this script is about: It simply is a test whether I can compare two trading cycles from different times.

Last edited by YesNotes; 03/21/23 20:30. Reason: I tried to keep the script format