Type/to search
Built-in Functions
Global
Log
Market
Trade
Account
Futures
Exchange
exchange.GetName
exchange.GetLabel
exchange.GetCurrency
exchange.SetCurrency
exchange.GetQuoteCurrency
exchange.GetPeriod
exchange.SetMaxBarLen
exchange.SetPrecision
exchange.GetRate
exchange.SetRate
exchange.SetBase
exchange.GetBase
exchange.SetProxy
exchange.SetTimeout
exchange.Encode
IO
Network
Storage
Threads
TA
Talib
OS
Structures
Built-in Variables and Constants
Conventions
Exchanges

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

NameTypeRequiredDescription

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).