TA.Lowest
The TA.Lowest() function is used to calculate the lowest price over a period.
TA.Lowest(inReal)
TA.Lowest(inReal, period, attr)Examples
javascript
function main() {
var records = exchange.GetRecords()
var lowestForOpen = TA.Lowest(records, 10, "Open")
Log(lowestForOpen)
}
python
def main():
records = exchange.GetRecords()
lowestForOpen = TA.Lowest(records, 10, "Open")
Log(lowestForOpen)
rust
fn main() {
let records = exchange.GetRecords(None, None, None).unwrap();
// Rust's TA.Lowest has no attribute-name parameter; first extract the opening price numeric sequence, then calculate (not including the current Bar)
let opens: Vec<f64> = records.iter().map(|r| r.Open).collect();
let lowestForOpen = TA.Lowest(&opens, 10);
Log!(lowestForOpen);
}
c++
void main() {
auto records = exchange.GetRecords();
auto lowestForOpen = TA.Lowest(records.Open(), 10);
Log(lowestForOpen);
}Returns
| Type | Description |
number | The |
Arguments
| Name | Type | Required | Description |
inReal |
| Yes | The |
period | number | No | The |
attr | string | No | The |
See Also
Remarks
For example, when calling the TA.Lowest(records, 30, "Low") function: if the period parameter period is set to 0, it means calculating over all Bar of the K-line data passed in via the inReal parameter; if the attribute parameter attr is not specified, the K-line data passed in via the inReal parameter is treated as an ordinary array.
When using the TA.Highest() and TA.Lowest() functions in a C++ strategy, note the following: the Highest() and Lowest() functions each have only 2 parameters, and the first parameter passed in is not the K-line data r obtained from calling auto r = exchange.GetRecords(), but rather requires calling a method of r to pass in specific attribute data. For example, pass in r.Close() for closing price data. The calling method for Close, High, Low, Open, Volume is the same as r.Close().
Test example for a C++ language strategy:
c++
void main() {
Records r;
r.Valid = true;
for (auto i = 0; i < 10; i++) {
Record ele;
ele.Time = i * 100000;
ele.High = i * 10000;
ele.Low = i * 1000;
ele.Close = i * 100;
ele.Open = i * 10;
ele.Volume = i * 1;
r.push_back(ele);
}
for(int j = 0; j < r.size(); j++){
Log(r[j]);
}
// Note: the first parameter passed in is not r; you need to call r.Close()
auto highest = TA.Highest(r.Close(), 8);
Log(highest);
}