Error : You are calling plot function over 500 times :(

	if (B1Found && B2Found)
		{			
			line = LineArray( HLBarPerm - 4, High[HLBarPerm], HLBarPerm - 2, High[HLBarPerm], 0 );	
			Plot( line, "", colorWhite, styleNoLabel | styleDashed | styleNoRescale | styleThick, Null, Null, 3, -3 );
		} 
	}
	else
	{
		if(HLBar > 5)
		{
			line = LineArray( HLBar - 4, Low[HLBar], HLBar - 2, Low[HLBar], 0 );			
			Plot( line, "", colorWhite, styleNoLabel | styleDashed | styleNoRescale | styleThick, Null, Null, 3, -3 );
		}
		else
		{
			line = LineArray( HLBar-2 , Low[HLBar], HLBar, Low[HLBar], 0 );			
			Plot( line, "", colorWhite, styleNoLabel | styleDashed | styleNoRescale | styleThick, Null, Null, 1, -1 );
		}		
	}

Dear Seniors,

Can you please suggest what I am doing wrong in above code :frowning:

When I data for more that one year I am getting the error as shown in the attached image.

Can you please help me with how I can fix this error?

Thanks & Regard,
Sumit

Do not use Plot() function inside (BarCount) loop.

There is proper code example by T.J. at User KB on how to use LineArray with Plot.
http://www.amibroker.org/userkb/2007/04/20/plotting-trade-zigzag-lines/
See @Tomasz's version (2nd code) there.

Re-write code.

2 Likes

Thanks a lot @fxshrat