Prefs() function (What is it good for?)

In the AFL guide, it says the Prefs() function retrieves preference settings.

I had a look at how it was used in some fo the example codes such as this one

   Moving Trend Bands (MTB)  [experimental]
   Written 030408We by 
   Similar to Bollinger Bands, maybe better?
// mid = LinearReg(C, Prefs(4));
   mid = TSF(C, Prefs(4));

   sd  = StDev(mid, Prefs(4));
   top = mid + 1 * sd;  // check 1
   bot = mid - 1 * sd;

   Plot(C, "Moving Trend Bands (MTB)   C",
     colorBlack, 1 + 8);
// Plot(mid,  "mid", colorRed, 1);
   Plot(top,  "top", colorBlue, 1);
   Plot(bot,  "bot", colorBlue, 1);

I still don't understand what it does or how to use it (such as what it's doing in this example)

Thanks in advance for anyones help

This function is for backwards compatibility only (so old code does not break, but you don't need to use it in new code).
It was supposed to read settings from Preferences dialog as in the past there were some parameters in the preferences.
Now all parameters are in the Parameter window and accessible via Param()

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