QuaScript DocumentationLanguage guide, engine API, 601 builtins and the preset library · v3.0.0-phase1 arrayGenerated from the engine catalog by tools/gen-docs.mjs; do not edit.array.addscript.qsarray.add(a, b) -> array<any>Element-wise with an array of the same size or a number.ArgumentKindDefaultNotesaarray<any>requiredbanyrequiredarray.argmaxscript.qsarray.argmax(a) -> numStatistic over the elements (na elements ignored).ArgumentKindDefaultNotesaarray<any>requiredarray.argminscript.qsarray.argmin(a) -> numStatistic over the elements (na elements ignored).ArgumentKindDefaultNotesaarray<any>requiredarray.copyscript.qsarray.copy(a) -> array<any>Copy of the array.ArgumentKindDefaultNotesaarray<any>requiredarray.correlationscript.qsarray.correlation(a, b) -> numPearson correlation of two arrays.ArgumentKindDefaultNotesaarray<any>requiredbarray<any>requiredarray.covariancescript.qsarray.covariance(a, b) -> numPopulation covariance of two arrays.ArgumentKindDefaultNotesaarray<any>requiredbarray<any>requiredarray.createscript.qsarray.create(size, fill = na) -> array<any>Fixed-size numeric array (never reallocates).ArgumentKindDefaultNotessizeintrequiredfillnumnaarray.cumsumscript.qsarray.cumsum(a) -> array<any>Transformed copy.ArgumentKindDefaultNotesaarray<any>requiredarray.diffscript.qsarray.diff(a) -> array<any>Transformed copy.ArgumentKindDefaultNotesaarray<any>requiredarray.divscript.qsarray.div(a, b) -> array<any>Element-wise with an array of the same size or a number.ArgumentKindDefaultNotesaarray<any>requiredbanyrequiredarray.dotscript.qsarray.dot(a, b) -> numDot product.ArgumentKindDefaultNotesaarray<any>requiredbarray<any>requiredarray.fillscript.qsarray.fill(a, v)Sets every element.ArgumentKindDefaultNotesaarray<any>requiredvnumrequiredarray.getscript.qsarray.get(a, i) -> numElement i (0 = oldest after roll); na when out of range.ArgumentKindDefaultNotesaarray<any>requirediintrequiredarray.linregscript.qsarray.linreg(a) -> (slope, intercept, r_squared)Least-squares line over x = 0..n-1.ArgumentKindDefaultNotesaarray<any>requiredReturns 3 values: slope, intercept, r_squared.array.maxscript.qsarray.max(a) -> numStatistic over the elements (na elements ignored).ArgumentKindDefaultNotesaarray<any>requiredarray.meanscript.qsarray.mean(a) -> numStatistic over the elements (na elements ignored).ArgumentKindDefaultNotesaarray<any>requiredarray.minscript.qsarray.min(a) -> numStatistic over the elements (na elements ignored).ArgumentKindDefaultNotesaarray<any>requiredarray.mulscript.qsarray.mul(a, b) -> array<any>Element-wise with an array of the same size or a number.ArgumentKindDefaultNotesaarray<any>requiredbanyrequiredarray.normalizescript.qsarray.normalize(a) -> array<any>Transformed copy.ArgumentKindDefaultNotesaarray<any>requiredarray.ofscript.qsarray.of(v0) -> array<any>Array of the given numbers.ArgumentKindDefaultNotesv0numrequiredarray.percentilescript.qsarray.percentile(a, pct = 50) -> numPercentile with linear interpolation (50 = median).ArgumentKindDefaultNotesaarray<any>requiredpctnum50array.rankscript.qsarray.rank(a, x) -> numPercent of elements <= x.ArgumentKindDefaultNotesaarray<any>requiredxnumrequiredarray.reversescript.qsarray.reverse(a)Reverses in place.ArgumentKindDefaultNotesaarray<any>requiredarray.rollscript.qsarray.roll(a, x) -> numRolling window push in O(1): appends x, drops and returns the oldest value.ArgumentKindDefaultNotesaarray<any>requiredxnumrequiredarray.setscript.qsarray.set(a, i, v)Sets element i.ArgumentKindDefaultNotesaarray<any>requirediintrequiredvnumrequiredarray.sizescript.qsarray.size(a) -> intNumber of elements.ArgumentKindDefaultNotesaarray<any>requiredarray.slicescript.qsarray.slice(a, from, to = na) -> array<any>Read-only view of [from, to).ArgumentKindDefaultNotesaarray<any>requiredfromintrequiredtointnaarray.sortscript.qsarray.sort(a, descending = 0)Sorts in place.ArgumentKindDefaultNotesaarray<any>requireddescendingbool0array.stdevscript.qsarray.stdev(a) -> numStatistic over the elements (na elements ignored).ArgumentKindDefaultNotesaarray<any>requiredarray.subscript.qsarray.sub(a, b) -> array<any>Element-wise with an array of the same size or a number.ArgumentKindDefaultNotesaarray<any>requiredbanyrequiredarray.sumscript.qsarray.sum(a) -> numStatistic over the elements (na elements ignored).ArgumentKindDefaultNotesaarray<any>requiredarray.variancescript.qsarray.variance(a) -> numStatistic over the elements (na elements ignored).ArgumentKindDefaultNotesaarray<any>requiredarray.zscorescript.qsarray.zscore(a) -> array<any>Transformed copy.ArgumentKindDefaultNotesaarray<any>required← draw: drawing objectslist →All 81 chaptersGuideGetting startedScript headersLanguage basicsFunctionsStructs, enums and traitsLibrariesParametersRenderingColorsDrawingsCollectionsTime, sessions and dataStrategiesBotsExecution modelBuilding complex analysesAdvancedChart styles by exampleEngineEngine APIPerformanceDiagnosticsReferenceta: technical analysisstat: statisticsmathcolorrender: outputsdraw: drawing objectsarraylistmapgridtablestr: textparam: settingsbarassetintervaltimesessionfeed: other intervalsalertorderexitpositionportfolioriskbook: order book (host data)orderbook (host data)derivative (host data)financial (host data)option pricinganchorshapestyleraysidepanechartaccounthftPresetsEvery chartGalleryLanguage showcasesbookFundamentals and flowsWebGPU StudioMicrostructureTrendlines and levelsMoving averagesMomentumMultiple intervalsLayoutsMarket structureStatisticsTrendVolatilityVolumeVertical panesBotsChart stylesLibrariesStrategies