Remap
|
Math functions |
SYNTAX | Remap( value, srcMin, srcMax, dstMin, dstMax ) |
RETURNS | NUMBER or ARRAY |
FUNCTION | The function re-maps a value (number or array) from 'source' to 'destination' range. That is, a value of srcMin would get mapped to dstMin, a value of srcMax to dstMax, values in-between to values in-between, etc. Does not constrain values to within the range, because out-of-range values are sometimes intended and useful. Parameters:
Depending on input value type (number or array) the result will be also number or array. Mathematically the function performs the following linear transformation:
Typical usage of the function is to convert indicator from one range to another. Say you have an indicator that ranges from -1..1 and you want it to be bounded in 0..100 space. Then you can use Remap( value, -1, 1, 0, 100 ); Or you want to convert pixels to prices or bars or vice versa as shown in the example below |
EXAMPLE | height = Status("pxheight"); |
SEE ALSO | Status() function |
The Remap function is used in the following formulas in AFL on-line library:
See updated/extended version on-line.