Formula error 29

Using AB version 6.3.0 with WIN 7

I have encountered this problem a few times ... Sorry, I don't think I can replicate in a small program.

Amibroker finds an AFL error (correctly) but after proper correction is made, the error remain and can not continue operating.

Code below and error message demonstrate the issue

image

AB found the vatiable "price" that was not defined. After correcting the problem and changing it to "Mkt_AvgPrice", and saving the code, the error message remains on screen even though the code checks out OK (no errors)

 
        case 1:
            DataGroup = "Market";			
            SetForeign( "SPY" );
            Mkt_AvgPrice		= ( O + H + L + C ) / 4;
            Mkt_AvgPrice_S		= T3Filter( Mkt_AvgPrice, 3, 0.5 );
            Mkt_slope			= Mkt_slope - Ref(Mkt_slope,-1);
            if (print) 		printf( "Market_Select = " + Market_Select + "\n" );
            //
            Plot( Mkt_AvgPrice_S, "", colorblack, styleThick | styleOwnScale, -0.5, 3 );
            Plot( Mkt_slope > -1.0, "", colorred, styleThick | styleOwnScale, -0.5, 3 );
            StaticVarSet("Mkt_Smooth",Mkt_AvgPrice_S);
            RestorePriceArrays();
            break;
type or paste code here

Remember, there are no bugs in AmiBroker.

If you get the Error message it is an error in your formula.

And Error 29 is clearly explained IN THE MANUAL:
http://www.amibroker.com/guide/errors/29.html

The thing is that you did not save the formula after editing under SAME name. You saved it under NEW name and old file is unaffected.

Also, there is no such thing as AmiBroker 6.3.0.

Latest version is AmiBroker 6.30.0 which is very different thing.

@ara1,

No one's perfect, and sometimes we're so convinced of our correctness that we miss silly little mistakes. I've done it lots of times.

It looks like you have a switch () ... case: ... statement, with multiple cases. Do other cases in the switch also have similar code, and also need to be changed?

In your post above, you provided a screenshot of the error before making a change to the code.

After making the change, is AB still reporting an error at exactly the same point as previously, or to somewhere else? ie. look at "Ln: 1513, Col: 46" in your initial screenshot - is it the same after changing the code?

There are a couple of things you can do to try and locate the problem:

  • display the "Watch" and "Output" windows in the AFL editor, via "Window, Watch". Have a look at the AB User Manual for instructions on how to use them.
  • set a breakpoint just above the line/s of code which seems to be causing the problem, and then step through the code, one line at a time, checking each variable.

Also, have a look at the suggestions provided here:

Failing that, your options are:

  • struggle-on by yourself
  • hire a professional programmer to look at your code, because "Sorry, I don't think I can replicate in a small program"
  • provide us with a better post, following the instructions in:

@ara1 Below you can find some general tips regarding how to easily find more information about specific Error in AB: