exchange.SetMaxBarLen
Set the maximum length of the K-line (candlestick chart).
exchange.SetMaxBarLen(len)Examples
Limit K-lines to at most 50 bars, then fetch them and print the count.
javascript
function main() {
exchange.SetMaxBarLen(50)
var records = exchange.GetRecords()
if (!records) return
Log(records.length)
// Output: an integer no greater than 50
}
python
def main():
exchange.SetMaxBarLen(50)
records = exchange.GetRecords()
if not records:
return
Log(len(records))
# Output: an integer no greater than 50
rust
fn main() {
exchange.SetMaxBarLen(50);
let Ok(records) = exchange.GetRecords(None, None, None) else { return };
Log!(records.len());
// Output: an integer no greater than 50
}Arguments
| Name | Type | Required | Description |
len | number | Yes | Maximum length of the K-line. |
See Also
Remarks
The exchange.SetMaxBarLen() function affects the following two aspects when a cryptocurrency strategy is running:
-
It affects the number of K-line bars (Bar) obtained on the first call.
-
It affects the upper limit on the number of K-line bars (Bar).