Page 1 of 1

Formula discriptions

Posted: Sat Aug 04, 2018 5:27 pm
by henry1224
Hello Chris,
Could you please provide a brief description of the following Formulas.

1: BarsCount

2: BarsSince with Reset

3: Backset

4: Convert NaN 2 Prev


Thanks

Henry

Re: Formula discriptions

Posted: Mon Aug 06, 2018 4:09 pm
by Chris White
BarsCount: Returns the bar number starting at 0 and incrementing by 1 each bar to the end of the data.
Useful for counting the number of bars between events.
Eg:
VALUEWHEN(BARSCOUNT(C), event1) - VALUEWHEN(BARSCOUNT(C), event2);

BarsSinceWithReset(Cond, Reset):
Returns the number of bars since the condition was true, resetting the count when Reset is true;

Backset(Cond, Data, N): Returns N bars from Data when condition is true;

ConvertNanToPrev(Data): IF the data series has NaN values, replaces them with the last known value so as to maintain a continues set of data.

Re: Formula discriptions

Posted: Wed Aug 08, 2018 7:58 pm
by henry1224
Hello Chris, thanks for the descriptions.
If I want to get the previous value of a variable using convertNan2Prev, I would have to make the variable end with a nan condition?

A:=If (C>Ref(C,1),C-Ref(C,1),Nan);
A1:ConvertNan2Prev(A);
Sum(A+A1,5);

Is that correct?

Henry