- bars since comparision between past and present array values was true
Trading system toolbox
|| BarsSinceCompare( past, comparison, current )
|| For every bar in current array, go back in time and compare past array values with current bar value and get number of bars since comparison was true.
- past - the array holding "past" values to compare to
- comparison - string that defines comparison operator, available choices are ">", "<", ">=", "<="
- current - the array holding "current" values to compare to
For more discussion about that function see: https://forum.amibroker.com/t/duplicate-bars-since-price-was-this-high-low/28355/14
// get bars since close was last time higher than current close
BarsSinceCompare( Close, ">", Close );
// get bars since low was last time higher than current close
BarsSinceCompare( Low, ">", Close );
// get bars since low was last time higher than or equal than current close
BarsSinceCompare( Low, ">=", Close );
// get bars since high was lower than or equal than current low
BarsSinceCompare( High, "<=", Low );
|| BarsSince() function
The BarsSinceCompare function is used in the following formulas
in AFL on-line library:
See updated/extended version on-line.