NeedForTrade Documentation

Calculating Function on N Bar Back

A Function can be calculated as it was called on any previous bar. Every Function has optional BarsBack parameter that specifies on which bar the function is calculated. If BarsBack parameter isn't specified or is equal to 0, then function is calculated on current bar. If BarsBack parameter is set to 1 function is calculated on prvious bar and so on. BarsBack parameter is market with blue text color in the Code Editor.



a = Summation(Bars.Close, 10);    // Calculating on current bar
a = Summation(Bars.Close, 10, 1); // Calculating on previous bar
a = Summation(Bars.Close, 10, 2); // Calculation on third bar back
a = Summation(Bars.Close, 10, 10); // Calculation on the tenths bar back

See also Functions.