syntaxsyntax-errorpine-scripttradingamibroker

What is the equivalent function in AmiBroker AFL for "ta.change" in TradingView Pine-Script?


I need to know the function from AmiBroker AFL which serves the same purpose as "ta.change" from TradingView Pine Script. "ta.change" Compares the current source value to its value length bars ago and returns the difference between the values when they are numerical. When a 'bool' source is used, returns true when the current source is different from the previous source.

Regards.


Solution

  • In AFL you can use Ref function to calculate change:

    length = 5;
    change = source - Ref( source, -length );