Adding unequal arrays of different symbols

I am trying to add daily volumes of some symbols to plot them but those symbols arrays doesn't have the same size so it plots only the size of the smallest on, i need it to add zero if this day isn't available instead of stopping

Here is my code

symlist = CategoryGetSymbols( categoryMarket,2);
//Loop Over market stocks
vol = 0;
TotalTurnOver = 0;

for ( i = 0; ( sym = StrExtract( symlist, i ) ) != ""; i++ ) 
{ 
	//Volume
	fc = Foreign( sym, "V" );
	vol = vol+fc;
	
} 
Plot(vol,"Volume",colorRed ,style = styleHistogram );

You may import an index such as SP500 having all historical data to create a composite (using StaticVarAdd or AddToComposite).

Can you please explain more?, i tried using StaticVarAdd but it isn't available.

You don't need to do anything special. Foreign automatically pads data to current symbol see documentation http://www.amibroker.com/f?foreign (please read COMMENT part).

The only thing you may need is to convert Null to zero, as missing bars may be Null:

// loop body
fc = Foreign( sym, "V" );
vol += Nz( fc ); // Null to zero function

Please note however that placing such code in a chart is not really good performance wise. It is better to create composite as @codejunkie explained http://www.amibroker.com/f?addtocomposite (see also http://www.amibroker.com/guide/a_addtocomposite.html)

StaticVarAdd mentioned earlier is available only for registered users (v6.28).

Thank you Tomasz it finally worked !
i will check the composite also.