How do I correct this (Error 47)?

image

image

Above figure shows that I want to do something for symbols inside the List 1.
but I meet Error 47 when I step by step ran it on debugger of AFL editor.

How do I correct this? Thank you very much !

What version are you using? You need to use at least version 6.20 see: Please Help me correct my code for 2-pass Ranking model

1 Like

Thank you very much for your help. My version is v6.28,
and I explore for 450 symbols only.
image

image
After Error 47 above (this is my full testing code),
AmiBroker Crashed (every time) and it didn't let me fill the crash report,
I've re-installed my computer for this yesterday,
but it happened agian today.

The number of symbols does not tell anything about the amount of memory used. As you can have gigabytes worth of tick data per symbol. You need to go to Tools->Performance Monitor to see how much memory is really used.
Since you are storing huge amount of data in static variables you may be running out of memory (again, we don't know if you are using 32-bit version or not since you are not telling it, see: How to ask a good question).

Also 6.28 is a BETA version. You should not use BETA if later official version (6.30) is available.

Thanks for your advice.
I don't know is it huge (1754 x 450 daily bars from AmiQuote) (not tick bar this time),
and I have some more memory for it (8GB, Win10, 64-bit Operating system),
and I don't know how to deal with this problem.

For example,

  1. I have no check [] Use Quick AFL, but it did (QuickAFL turned OFF)
  2. I don't know why SetForeign() take so much time.

Screencut below comes from v6.28:
image

image

Screencut below comes from v6.35:
image
image

My full code:

// You can run this with [Scan] or [Explore].
// Apply to: [*Filter] [WatchList 1]
//    Range: [1 recent bar]
wlnum = GetOption( "FilterIncludeWatchlist" );
List = CategoryGetSymbols( categoryWatchlist, wlnum ); 
if( Status( "stocknum" ) == 0 )
{
    StaticVarRemove( "~SymbolCount" ); 
    StaticVarRemove( "~ImpactPoints" );
    // ...
    dn = DateNum(); 
    for( n = 0; ( symbol = StrExtract( List, n ) )  != "";  n++ ) 
    {
		SetForeign( symbol ); 
		ImpactPoints = 0.01;
		StaticVarAdd( "~ImpactPoints", ImpactPoints ); 
		StaticVarAdd( "~SymbolCount", 1 ); 
		RestorePriceArrays(); 

    }// for( n = 0; ( Symbol = StrExtract( List, n ) )  != "";  n++ )
	svImpactPoints = StaticVarGet( "~ImpactPoints" );
	svSymbolCount = StaticVarGet( "~SymbolCount" ); 
}// if( Status( "stocknum" ) == 0 )

Your code is plainly wrong. Composites, including those created using StaticVarAdd should be created using SCAN or Exploration over ALL symbols within watch list, WITHOUT using SetForeign and loop. Much better performance is achieved using 2 line code that is documented in Users Guide.

Proper usage is as always documented in the manual, so just read it and follow:
http://www.amibroker.com/guide/a_addtocomposite.html
and
http://www.amibroker.com/guide/afl/staticvaradd.html (scroll down to example - it is just 2 lines that does everything you do in your lengthy inefficient formula).