Line chart of multiple Symbols and Error 512

I've been trying to set up a line chart with multiple symbols. There are no errors untill the 5th and 6th SetForeign is written, The code flashes warning 512, Is there a way for me to set this right?

Thanks once again.

c1 =Close ;

c2 =Close ;

c3 =Close ;

c4 =Close ;

c5 =Close ;

c6 =Close ;

ST = c1+c2+c3+c4+c5+c6;


@RPS, before creating a new thread, a forum search is always a best practice

This was already discussed in previous posts

From there, be sure to read the link at Basics: Error, warning, notice

In your case, since you're not using it in an heavy loop, IMO, you can safely ignore/silence the warning.

Instead you should run analysis scan to add up prices.
Move symbols to a watchlist then run scan over that watchlist with pad & align being enabled in analysis settings general tab.

if (Status("action") == actionScan) {
	// Run in Analysis - Scan over filtered watchlist
	if( InWatchList( GetOption("FilterIncludeWatchlist") ) ) {
		if(Status("stocknum") == 0)
		StaticVarAdd("~NiftyOptionsSum", Close);	

//Plot result of analysis
Sum_options = StaticVarGet("~NiftyOptionsSum");
Plot( Sum_options, "~NiftyOptionsSum", colorRed );

Besides you are spamming the forum with same post

Don't do that.

I'm very sorry for the multiple posts. My apologies.

Thank you beppe for the insight, letme see if I can do a workaround like whar fxshrat advised.

Once again thanks to you both fxshrat and to Beppe for the insight

I just discovered that I would require to plot a Bollinger Band to the "ST" sumtotal , Is there any way that I could plot this. Thanks again.

Instead of SetForeign, to get close of other symbol you should just use

c1 = Foreign( symbol, "C" );

This is shorter and quicker than SetForeign/RestorePriceArrays.

1 Like

Thank you Tomasz, I am still unable to plot the Bollinger band to Close of sum totals of all symbols , in my case its "Plot(ST,"Test",colorRed,styleLine);" where ST is sum total of all symbols. Thanks again .

Why not? It is easy

c1 = Foreign( symbol, "C" );
// your remaining Foreign calls for c2...c6

ST = c1+c2+c3+c4+c5+c6;

Plot( BBandTop( ST ), "", colorBlue );
Plot( BBandBot( ST ), "", colorBlue );
1 Like

Thank you Tomasz, wow, I was under the impression the BBandTop and BBandBot default functions always associated with Close. Thanks once again.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.