Your usage of Foreign appears to be incorrect. Refer to http://www.amibroker.com/guide/afl/afl_view.php?id=54 where you will see that valid values for the second argument are limited to "open", "close", "high", "low", "volume", "interest". "Ref(Close,- 20)" is not valid.
Have a look at SetForeign/RestorePriceArrays instead. http://www.amibroker.com/guide/afl/afl_view.php?id=247 Mike --- In [email protected], "srengret" <[EMAIL PROTECTED]> wrote: > > > I'm trying to code buy selection criteria that requires the S&P500 > index ("^GSPC") to be higher now than 20 days ago along with a > RelStrength measure. > Here's the section of code of interest: > > Buy = RelStrength("^GSPC") > 20.0 > AND Foreign("^GSPC", "Close") > Foreign ("^GSPC", "Ref(Close,-20)"); > > When I place this in previously working code with other criteria, it > doesn't seem to have an effect. > > Does anyone see what is wrong with the last line and/or is there a > better way to do this? > > Regards, > SrEngRet >
