nexustrade 5.2.0 → 5.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -592,7 +592,7 @@ const portfolio = (name, strategies, options = {}) => {
|
|
|
592
592
|
exports.portfolio = portfolio;
|
|
593
593
|
// ---- generated indicator builders ----
|
|
594
594
|
/**
|
|
595
|
-
*
|
|
595
|
+
* The absolute value of an indicator.
|
|
596
596
|
*/
|
|
597
597
|
function AbsoluteValue(operand) {
|
|
598
598
|
const d = { type: "AbsoluteValue" };
|
|
@@ -600,7 +600,7 @@ function AbsoluteValue(operand) {
|
|
|
600
600
|
return d;
|
|
601
601
|
}
|
|
602
602
|
/**
|
|
603
|
-
*
|
|
603
|
+
* Running total of close-location value times volume. Unlike OBV it weights where in the range the bar closed, so weak closes on high volume distribute. Range: Unbounded (cumulative).
|
|
604
604
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
605
605
|
* @param interval Bar interval the line is accumulated on
|
|
606
606
|
*/
|
|
@@ -611,7 +611,7 @@ function AccumulationDistribution(asset, interval = "Day") {
|
|
|
611
611
|
return d;
|
|
612
612
|
}
|
|
613
613
|
/**
|
|
614
|
-
*
|
|
614
|
+
* Wilder's ADX: trend strength on 0-100, with optional +DI and -DI trend-direction lines. ADX above ~25 is conventionally a strong trend. Range: 0 to 100.
|
|
615
615
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
616
616
|
* @param length Length of time
|
|
617
617
|
* @param interval Unit of time
|
|
@@ -625,7 +625,7 @@ function AverageDirectionalIndex(asset, length = 14, interval = "Day", line = "a
|
|
|
625
625
|
return d;
|
|
626
626
|
}
|
|
627
627
|
/**
|
|
628
|
-
*
|
|
628
|
+
* The average of True Range over a window. A smoothed measure of volatility used for position sizing and stop-losses. Range: >= 0.
|
|
629
629
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
630
630
|
* @param length Length of time
|
|
631
631
|
* @param interval Unit of time
|
|
@@ -637,7 +637,7 @@ function AverageTrueRange(asset, length = 14, interval = "Day") {
|
|
|
637
637
|
return d;
|
|
638
638
|
}
|
|
639
639
|
/**
|
|
640
|
-
*
|
|
640
|
+
* Detects a bearish fair value gap (3-candle gap down) on minute bars. Returns the gap's resistance price (candle1 low) while the pattern is active; otherwise no value (condition fails). Not a 0/1 flag — never compare to 1. Range: price when present.
|
|
641
641
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
642
642
|
*/
|
|
643
643
|
function BearishFairValueGap(asset) {
|
|
@@ -646,7 +646,7 @@ function BearishFairValueGap(asset) {
|
|
|
646
646
|
return d;
|
|
647
647
|
}
|
|
648
648
|
/**
|
|
649
|
-
*
|
|
649
|
+
* One Bollinger band, returned as a single number: the simple moving average of price plus the given number of standard deviations of price over the same window. A positive number gives the upper band, a negative number the lower band, and 0 the moving average itself. Range: Same scale as price.
|
|
650
650
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
651
651
|
* @param length Length of time
|
|
652
652
|
* @param interval Unit of time
|
|
@@ -661,7 +661,7 @@ function BollingerBand(asset, length = 30, interval = "Day", numStandardDeviatio
|
|
|
661
661
|
}
|
|
662
662
|
exports.BBand = BollingerBand;
|
|
663
663
|
/**
|
|
664
|
-
*
|
|
664
|
+
* Detects a bullish fair value gap (3-candle gap up) on minute bars. Returns the gap's support price (candle1 high) while the pattern is active; otherwise no value (condition fails). Not a 0/1 flag — never compare to 1 (that is for CrossAbove/CrossBelow). Range: price when present.
|
|
665
665
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
666
666
|
*/
|
|
667
667
|
function BullishFairValueGap(asset) {
|
|
@@ -670,14 +670,14 @@ function BullishFairValueGap(asset) {
|
|
|
670
670
|
return d;
|
|
671
671
|
}
|
|
672
672
|
/**
|
|
673
|
-
*
|
|
673
|
+
* The amount of cash available to make new purchases. Range: >= 0.
|
|
674
674
|
*/
|
|
675
675
|
function BuyingPower() {
|
|
676
676
|
const d = { type: "BuyingPower" };
|
|
677
677
|
return d;
|
|
678
678
|
}
|
|
679
679
|
/**
|
|
680
|
-
*
|
|
680
|
+
* Money flow volume over money volume across N bars, bounded in -1 to +1. Sustained readings above +0.2 show institutional accumulation. Range: -1 to +1.
|
|
681
681
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
682
682
|
* @param length Length of time
|
|
683
683
|
* @param interval Unit of time
|
|
@@ -689,7 +689,7 @@ function ChaikinMoneyFlow(asset, length = 20, interval = "Day") {
|
|
|
689
689
|
return d;
|
|
690
690
|
}
|
|
691
691
|
/**
|
|
692
|
-
*
|
|
692
|
+
* Prices, the average close, or the end time of completed chart candles, built from contiguous minute data. Stock candles align to the regular trading session. Range: Same scale as price for open, high, low, close and sma; the endTime line returns the end time of the newest selected candle in Unix seconds.
|
|
693
693
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
694
694
|
* @param barMinutes Completed candles: stocks divide the 390-minute regular session from 9:30 ET. Crypto divides the 1440-minute UTC day or uses 10080 for a Monday UTC week; legacy intraday sizes remain valid. Observation cadence must be Minute even for daily/weekly candles.
|
|
695
695
|
* @param line open: oldest selected candle; close: newest; high/low: range; sma: mean candle closes.
|
|
@@ -708,7 +708,7 @@ function ChartBar(asset, barMinutes = 5, line = "close", bars = 1, offsetBars =
|
|
|
708
708
|
return d;
|
|
709
709
|
}
|
|
710
710
|
/**
|
|
711
|
-
*
|
|
711
|
+
* Deviation of the typical price from its moving average, scaled by mean deviation. Readings above +100 are overbought, below -100 oversold. Range: Unbounded (typically -300 to +300).
|
|
712
712
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
713
713
|
* @param length Length of time
|
|
714
714
|
* @param interval Unit of time
|
|
@@ -722,7 +722,7 @@ function CommodityChannelIndex(asset, length = 20, interval = "Day", constant =
|
|
|
722
722
|
return d;
|
|
723
723
|
}
|
|
724
724
|
/**
|
|
725
|
-
*
|
|
725
|
+
* The annualized growth rate of a fundamental metric over a specified number of years. Smooths out quarterly volatility to show the long-term trend. Range: Unbounded (percentage).
|
|
726
726
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
727
727
|
* @param metric The fundamental metric to use
|
|
728
728
|
* @param years Floating point years value
|
|
@@ -773,8 +773,8 @@ function ConsecutiveTrue(condition, length = 1, interval = "Day") {
|
|
|
773
773
|
return d;
|
|
774
774
|
}
|
|
775
775
|
/**
|
|
776
|
-
*
|
|
777
|
-
* @param operands
|
|
776
|
+
* Rolling Pearson correlation (-1 to 1) of two indicators' period-over-period returns over N paired observations. Flat or degenerate windows read no-signal instead of a fabricated number.
|
|
777
|
+
* @param operands One list of exactly 2 sub-indicators.
|
|
778
778
|
* @param length Length of time
|
|
779
779
|
* @param interval Unit of time
|
|
780
780
|
*/
|
|
@@ -816,21 +816,21 @@ function CrossBelow(left, right) {
|
|
|
816
816
|
return d;
|
|
817
817
|
}
|
|
818
818
|
/**
|
|
819
|
-
*
|
|
819
|
+
* Hours since midnight in America/New_York time, including fractional hours. For example, 9:30 AM returns 9.5. Daylight saving time is handled automatically.
|
|
820
820
|
*/
|
|
821
821
|
function CurrentTimeHours() {
|
|
822
822
|
const d = { type: "CurrentTimeHours" };
|
|
823
823
|
return d;
|
|
824
824
|
}
|
|
825
825
|
/**
|
|
826
|
-
*
|
|
826
|
+
* Minutes since midnight in America/New_York time, including fractional minutes. For example, 9:30 AM returns 570. Daylight saving time is handled automatically.
|
|
827
827
|
*/
|
|
828
828
|
function CurrentTimeMinutes() {
|
|
829
829
|
const d = { type: "CurrentTimeMinutes" };
|
|
830
830
|
return d;
|
|
831
831
|
}
|
|
832
832
|
/**
|
|
833
|
-
*
|
|
833
|
+
* Seconds since midnight in America/New_York time, including fractions of a second. For example, 9:30 AM returns 34200. Daylight saving time is handled automatically.
|
|
834
834
|
*/
|
|
835
835
|
function CurrentTimeSeconds() {
|
|
836
836
|
const d = { type: "CurrentTimeSeconds" };
|
|
@@ -852,7 +852,7 @@ function CurrentValue(operand) {
|
|
|
852
852
|
return d;
|
|
853
853
|
}
|
|
854
854
|
/**
|
|
855
|
-
*
|
|
855
|
+
* Account-owned timestamp/value data uploaded through CSV or JSON ingestion. Range: User-defined numeric value.
|
|
856
856
|
* @param asset Pass CANDIDATE inside a rebalance pipeline to bind per candidate.
|
|
857
857
|
* @param customIndicatorId 24-char hex ObjectId of the owned series (list_custom_indicators).
|
|
858
858
|
*/
|
|
@@ -863,28 +863,28 @@ function CustomIndicator(asset, customIndicatorId) {
|
|
|
863
863
|
return d;
|
|
864
864
|
}
|
|
865
865
|
/**
|
|
866
|
-
*
|
|
866
|
+
* The day of the month in America/New_York, from 1 through 31. Combine with Month and Year for a specific calendar date.
|
|
867
867
|
*/
|
|
868
868
|
function Date() {
|
|
869
869
|
const d = { type: "Date" };
|
|
870
870
|
return d;
|
|
871
871
|
}
|
|
872
872
|
/**
|
|
873
|
-
*
|
|
873
|
+
* The weekday in America/New_York: Monday = 1 through Sunday = 7. Use Date for the day of the month.
|
|
874
874
|
*/
|
|
875
875
|
function Day() {
|
|
876
876
|
const d = { type: "Day" };
|
|
877
877
|
return d;
|
|
878
878
|
}
|
|
879
879
|
/**
|
|
880
|
-
*
|
|
880
|
+
* The number of days since an AI agent was launched by this strategy. Useful for rate-limiting agent launches. Range: >= 0.
|
|
881
881
|
*/
|
|
882
882
|
function DaysSinceAgent() {
|
|
883
883
|
const d = { type: "DaysSinceAgent" };
|
|
884
884
|
return d;
|
|
885
885
|
}
|
|
886
886
|
/**
|
|
887
|
-
*
|
|
887
|
+
* The number of days since an alert was triggered. Useful for rate-limiting alerts. Range: >= 0.
|
|
888
888
|
* @param message (Optional) Message to display when the indicator is triggered
|
|
889
889
|
*/
|
|
890
890
|
function DaysSinceAlert(message) {
|
|
@@ -893,7 +893,7 @@ function DaysSinceAlert(message) {
|
|
|
893
893
|
return d;
|
|
894
894
|
}
|
|
895
895
|
/**
|
|
896
|
-
*
|
|
896
|
+
* Calendar days since the asset's most recent earnings report. In backtests and live, this is the last actually-reported quarter at-or-before the decision time (no look-ahead). Use to time post-earnings entries (e.g. fade the gap after N days, or wait for the IV crush to settle). Range: >= 0 (0 on the report day; grows as time passes).
|
|
897
897
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
898
898
|
*/
|
|
899
899
|
function DaysSinceEarnings(asset) {
|
|
@@ -902,14 +902,14 @@ function DaysSinceEarnings(asset) {
|
|
|
902
902
|
return d;
|
|
903
903
|
}
|
|
904
904
|
/**
|
|
905
|
-
*
|
|
905
|
+
* Elapsed days since the latest Filled-matching portfolio order stamped RebalanceOption, RebalanceOptionRenewal or RebalanceOptionFunding. It uses fill time and ignores strategy ID, so these strategies share a cooldown. Unfilled or canceled orders do not reset it. Range: >= 0 (days), or a large number if no RebalanceOption-generated order exists.
|
|
906
906
|
*/
|
|
907
907
|
function DaysSinceLastRebalanceOptionOrder() {
|
|
908
908
|
const d = { type: "DaysSinceLastRebalanceOptionOrder" };
|
|
909
909
|
return d;
|
|
910
910
|
}
|
|
911
911
|
/**
|
|
912
|
-
*
|
|
912
|
+
* The number of days since the most recent option order matching the specified filters. Supports filtering by underlying, option type (call/put), spread type, direction (long/short), position effect (open/close), and days to expiration at order time. Range: >= 0 (days), or a large number if no matching order exists.
|
|
913
913
|
* @param underlying Filter by underlying (e.g., AAPL, SPY). Leave empty for all.
|
|
914
914
|
* @param optionType Filter by Call or Put. Leave empty for all.
|
|
915
915
|
* @param direction Filter by Long or Short. Leave empty for all.
|
|
@@ -932,7 +932,7 @@ function DaysSinceOptionOrder(underlying, optionType, direction, spreadType, pos
|
|
|
932
932
|
return d;
|
|
933
933
|
}
|
|
934
934
|
/**
|
|
935
|
-
*
|
|
935
|
+
* The number of days since the most recent order matching the specified filters. Range: >= 0 (days), or a large number if no matching order exists.
|
|
936
936
|
* @param assets Ticker(s) whose orders are counted. One string or an array.
|
|
937
937
|
* @param side Buy or Sell
|
|
938
938
|
*/
|
|
@@ -944,14 +944,14 @@ function DaysSinceOrder(assets, side, orderStatus = "Filled") {
|
|
|
944
944
|
return d;
|
|
945
945
|
}
|
|
946
946
|
/**
|
|
947
|
-
*
|
|
947
|
+
* The number of days since the current strategy last produced an execution artifact. Counts same-strategy order rows, rebalance orders, and launched agents. Range: >= 0 (days), or a large number if the strategy has never fired.
|
|
948
948
|
*/
|
|
949
949
|
function DaysSinceStrategyFired() {
|
|
950
950
|
const d = { type: "DaysSinceStrategyFired" };
|
|
951
951
|
return d;
|
|
952
952
|
}
|
|
953
953
|
/**
|
|
954
|
-
*
|
|
954
|
+
* Calendar days until the asset's next expected earnings report. In backtests the next date is a point-in-time cadence estimate from the last report (no look-ahead); live trading uses the real next scheduled date. Use to time entries and exits around earnings. Range: >= 0 (0 on/after the expected report day; counts down as it nears).
|
|
955
955
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
956
956
|
*/
|
|
957
957
|
function DaysUntilEarnings(asset) {
|
|
@@ -960,7 +960,7 @@ function DaysUntilEarnings(asset) {
|
|
|
960
960
|
return d;
|
|
961
961
|
}
|
|
962
962
|
/**
|
|
963
|
-
*
|
|
963
|
+
* Quotient of indicators.
|
|
964
964
|
*/
|
|
965
965
|
function Divide(left, right) {
|
|
966
966
|
const d = { type: "Divide" };
|
|
@@ -968,7 +968,7 @@ function Divide(left, right) {
|
|
|
968
968
|
return d;
|
|
969
969
|
}
|
|
970
970
|
/**
|
|
971
|
-
*
|
|
971
|
+
* Highest high and lowest low over N bars with a midline. Breaks of either edge are breakout entries; the midline is the first pullback level. Range: Price scale.
|
|
972
972
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
973
973
|
* @param length Length of time
|
|
974
974
|
* @param interval Unit of time
|
|
@@ -982,7 +982,7 @@ function DonchianChannel(asset, length = 20, interval = "Day", line = "upper") {
|
|
|
982
982
|
return d;
|
|
983
983
|
}
|
|
984
984
|
/**
|
|
985
|
-
*
|
|
985
|
+
* Macroeconomic data not tied to a specific asset.
|
|
986
986
|
* @param metric The economic indicator to use
|
|
987
987
|
*/
|
|
988
988
|
function Economic(metric) {
|
|
@@ -1004,7 +1004,7 @@ function ExponentialMovingAverage(asset, length, interval = "Day") {
|
|
|
1004
1004
|
}
|
|
1005
1005
|
exports.EMA = ExponentialMovingAverage;
|
|
1006
1006
|
/**
|
|
1007
|
-
*
|
|
1007
|
+
* Raises an indicator to a specified power.
|
|
1008
1008
|
* @param exponent The exponent to raise the value to
|
|
1009
1009
|
*/
|
|
1010
1010
|
function Exponentiation(operand, exponent = 2) {
|
|
@@ -1014,7 +1014,7 @@ function Exponentiation(operand, exponent = 2) {
|
|
|
1014
1014
|
return d;
|
|
1015
1015
|
}
|
|
1016
1016
|
/**
|
|
1017
|
-
*
|
|
1017
|
+
* A financial metric from a company's statements or derived valuation ratios.
|
|
1018
1018
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1019
1019
|
* @param metric The fundamental metric to use
|
|
1020
1020
|
*/
|
|
@@ -1025,7 +1025,7 @@ function Fundamental(asset, metric) {
|
|
|
1025
1025
|
return d;
|
|
1026
1026
|
}
|
|
1027
1027
|
/**
|
|
1028
|
-
*
|
|
1028
|
+
* The gap size expressed as a percentage of the previous close. Range: Unbounded (percentage).
|
|
1029
1029
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1030
1030
|
*/
|
|
1031
1031
|
function GapPercentage(asset) {
|
|
@@ -1034,7 +1034,7 @@ function GapPercentage(asset) {
|
|
|
1034
1034
|
return d;
|
|
1035
1035
|
}
|
|
1036
1036
|
/**
|
|
1037
|
-
*
|
|
1037
|
+
* The dollar difference between today's opening price and yesterday's closing price. Range: Unbounded.
|
|
1038
1038
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1039
1039
|
*/
|
|
1040
1040
|
function GapSize(asset) {
|
|
@@ -1043,7 +1043,7 @@ function GapSize(asset) {
|
|
|
1043
1043
|
return d;
|
|
1044
1044
|
}
|
|
1045
1045
|
/**
|
|
1046
|
-
*
|
|
1046
|
+
* Heikin-Ashi candles built from COMPLETED one-minute bars in the regular session (9:30-15:59 bar opens; pre-market and after-hours bars are skipped), identically in backtests and live trading. The first bar seeds HA open = (O+C)/2 with its own high, low and close; after that HA close = (O+H+L+C)/4, HA open = (prior HA open + prior HA close)/2, HA high = max(H, HA open, HA close), HA low = min(L, HA open, HA close). The recursion carries across sessions and advances once per new bar. The streak line is the signed length of the current same-color run, counted from the color change (+3 on the third green candle, -3 on the third red); it reads 0 on a doji and for the rest of any run in which a candle shows an opposite-direction wick (a lower wick on green, an upper wick on red). Range: Price scale; streak is a signed integer.
|
|
1047
1047
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1048
1048
|
* @param line Which one-minute Heikin-Ashi value to evaluate. streak is the signed length of the current same-color run (0 once it shows an opposite-direction wick, and on a doji)
|
|
1049
1049
|
*/
|
|
@@ -1054,7 +1054,7 @@ function HeikinAshi(asset, line = "close") {
|
|
|
1054
1054
|
return d;
|
|
1055
1055
|
}
|
|
1056
1056
|
/**
|
|
1057
|
-
*
|
|
1057
|
+
* The highest price reached during the current trading session. Range: > 0.
|
|
1058
1058
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1059
1059
|
*/
|
|
1060
1060
|
function HighOfDay(asset) {
|
|
@@ -1063,7 +1063,7 @@ function HighOfDay(asset) {
|
|
|
1063
1063
|
return d;
|
|
1064
1064
|
}
|
|
1065
1065
|
/**
|
|
1066
|
-
*
|
|
1066
|
+
* Five-line trend system: Tenkan and Kijun midpoints, Senkou A/B cloud bands, and the Chikou lagging line. Lines are evaluated unshifted. Price above the cloud with Tenkan above Kijun is the full bullish alignment. Range: Price scale.
|
|
1067
1067
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1068
1068
|
* @param length Length of time
|
|
1069
1069
|
* @param interval Unit of time
|
|
@@ -1079,7 +1079,7 @@ function IchimokuCloud(asset, length = 9, interval = "Day", spanLength = 52, lin
|
|
|
1079
1079
|
return d;
|
|
1080
1080
|
}
|
|
1081
1081
|
/**
|
|
1082
|
-
*
|
|
1082
|
+
* Constant-maturity at-the-money implied volatility for the underlying, built from the options chain (near-target-DTE expirations, |delta|≈0.50 call/put average, linearly interpolated). Units are annualized decimals (0.25 = 25%). Used on each candidate of a dynamic rebalance over a broad universe (all US stocks, an index or a watchlist), it reads options chains with Greeks for every stock in that universe instead of one underlying, so the run is heavier than with a named ticker or a specific asset list. Range: > 0 (annualized decimal).
|
|
1083
1083
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1084
1084
|
* @param dte Target constant-maturity tenor in calendar days (e.g. 30)
|
|
1085
1085
|
*/
|
|
@@ -1090,7 +1090,7 @@ function ImpliedVolatility(asset, dte = 30) {
|
|
|
1090
1090
|
return d;
|
|
1091
1091
|
}
|
|
1092
1092
|
/**
|
|
1093
|
-
*
|
|
1093
|
+
* Daily level for a market index or benchmark (e.g. VIX, SPX) from hydrated index price data — not a tradable equity price. Range: Unbounded (index points).
|
|
1094
1094
|
* @param metric Ticker key matching hydrated index price data (add more in BigQuery + rehydrate as needed)
|
|
1095
1095
|
*/
|
|
1096
1096
|
function Index(metric = "VIX") {
|
|
@@ -1115,7 +1115,7 @@ function IndicatorAtCondition(operand, condition, selection = "First", clock = "
|
|
|
1115
1115
|
return d;
|
|
1116
1116
|
}
|
|
1117
1117
|
/**
|
|
1118
|
-
*
|
|
1118
|
+
* The value an indicator held at a matching fill of the asset. The entry anchor chooses the fill: LatestFill (the default) follows the most recent matching fill; HoldingEntry preserves the original holding entry when shares are added. The captured level stays fixed instead of rolling forward. In the form, a candidate-bound condition may leave the asset empty and the surrounding action supplies it; SDK code always passes the asset, using CANDIDATE inside a rebalance pipeline.
|
|
1119
1119
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1120
1120
|
* @param side The side of the fill the value is anchored to
|
|
1121
1121
|
* @param orderStatus Matches order events with this status
|
|
@@ -1130,7 +1130,7 @@ function IndicatorAtEntry(operand, asset, side, orderStatus = "Filled", anchor =
|
|
|
1130
1130
|
return d;
|
|
1131
1131
|
}
|
|
1132
1132
|
/**
|
|
1133
|
-
*
|
|
1133
|
+
* Captures the first non-null evaluated indicator value at or after the configured number of minutes after market open. The captured value is then frozen until its next daily reset. A delayed evaluation can capture after the target minute.
|
|
1134
1134
|
* @param minutesAfterOpen The number of minutes after market open to capture the indicator value
|
|
1135
1135
|
*/
|
|
1136
1136
|
function IndicatorAtMinutesAfterOpen(operand, minutesAfterOpen = 30) {
|
|
@@ -1140,7 +1140,7 @@ function IndicatorAtMinutesAfterOpen(operand, minutesAfterOpen = 30) {
|
|
|
1140
1140
|
return d;
|
|
1141
1141
|
}
|
|
1142
1142
|
/**
|
|
1143
|
-
*
|
|
1143
|
+
* Computes the Exponential Moving Average of any other indicator. TradingDay follows the input markets: crypto-only inputs use elapsed 24-hour days, including weekends, just like Day. Stock, option, mixed-market and asset-free expressions use confirmed exchange sessions. The window does not change intraday prices into daily closing prices. TradingMinute counts regular-session minutes the same way, so a 70 TradingMinute window at 9:45 reaches back to 3:06 PM on the prior session (the overnight gap is one step); crypto-only inputs use elapsed minutes. It allows at most 1439 minutes; use TradingDay for longer lookbacks. Indicators read every tick have no TradingMinute value outside regular hours, and windows over a ChartBar keep the value of its latest completed candle.
|
|
1144
1144
|
* @param length Length of time
|
|
1145
1145
|
* @param interval Unit of time
|
|
1146
1146
|
*/
|
|
@@ -1162,7 +1162,7 @@ function IndicatorMaximum(operand, length = 30, interval = "Day") {
|
|
|
1162
1162
|
return d;
|
|
1163
1163
|
}
|
|
1164
1164
|
/**
|
|
1165
|
-
*
|
|
1165
|
+
* Computes the MAD of any indicator over a window. Less sensitive to outliers than standard deviation.
|
|
1166
1166
|
* @param length Length of time
|
|
1167
1167
|
* @param interval Unit of time
|
|
1168
1168
|
*/
|
|
@@ -1184,7 +1184,7 @@ function IndicatorMinimum(operand, length = 30, interval = "Day") {
|
|
|
1184
1184
|
return d;
|
|
1185
1185
|
}
|
|
1186
1186
|
/**
|
|
1187
|
-
*
|
|
1187
|
+
* The percentage change of any indicator over a window.
|
|
1188
1188
|
* @param length Length of time
|
|
1189
1189
|
* @param interval Unit of time
|
|
1190
1190
|
*/
|
|
@@ -1195,7 +1195,7 @@ function IndicatorRateOfChange(operand, length = 30, interval = "Day") {
|
|
|
1195
1195
|
return d;
|
|
1196
1196
|
}
|
|
1197
1197
|
/**
|
|
1198
|
-
*
|
|
1198
|
+
* Computes the Simple Moving Average of any other indicator over a window. TradingDay follows the input markets: crypto-only inputs use elapsed 24-hour days, including weekends, just like Day. Stock, option, mixed-market and asset-free expressions use confirmed exchange sessions. The window does not change intraday prices into daily closing prices. TradingMinute counts regular-session minutes the same way, so a 70 TradingMinute window at 9:45 reaches back to 3:06 PM on the prior session (the overnight gap is one step); crypto-only inputs use elapsed minutes. It allows at most 1439 minutes; use TradingDay for longer lookbacks. Indicators read every tick have no TradingMinute value outside regular hours, and windows over a ChartBar keep the value of its latest completed candle.
|
|
1199
1199
|
* @param length Length of time
|
|
1200
1200
|
* @param interval Unit of time
|
|
1201
1201
|
*/
|
|
@@ -1206,7 +1206,7 @@ function IndicatorSimpleMovingAverage(operand, length = 30, interval = "Day") {
|
|
|
1206
1206
|
return d;
|
|
1207
1207
|
}
|
|
1208
1208
|
/**
|
|
1209
|
-
*
|
|
1209
|
+
* Computes the standard deviation of any indicator over a window.
|
|
1210
1210
|
* @param length Length of time
|
|
1211
1211
|
* @param interval Unit of time
|
|
1212
1212
|
*/
|
|
@@ -1245,14 +1245,14 @@ function IndustryNewsSentiment(industry, measure = "Mean", lookbackDays = 1, inc
|
|
|
1245
1245
|
return d;
|
|
1246
1246
|
}
|
|
1247
1247
|
/**
|
|
1248
|
-
*
|
|
1248
|
+
* The starting value of the portfolio when it was created or when the backtest began. Range: > 0.
|
|
1249
1249
|
*/
|
|
1250
1250
|
function InitialValue() {
|
|
1251
1251
|
const d = { type: "InitialValue" };
|
|
1252
1252
|
return d;
|
|
1253
1253
|
}
|
|
1254
1254
|
/**
|
|
1255
|
-
*
|
|
1255
|
+
* Disclosed purchases (code P, including open-market or private transactions), sales (code S), and a separate exact-owner AwardCount for code A issuer grants or other acquisitions over a trailing publication window. AcquisitionCount combines code P and code A as distinct acquisition signals for modeled follower strategies; awards are not reclassified as purchases or sales and do not prove vested common-share ownership. Exact-owner strategies use versioned common-share, call/put, and issuer-award evidence; exercises and warrants are excluded from tradable purchase signals. A signal becomes eligible when its filing is public, never on an earlier transaction date. Range: Dollars, shares, counts or budget percent; unknown owner/amendment coverage has no value.
|
|
1256
1256
|
* @param asset Pass CANDIDATE in a dynamic rebalance pipeline.
|
|
1257
1257
|
* @param ownerCik Exact nonzero SEC reporting owner CIK, up to 10 digits. Omit for a whole company (with issuerCik) or aggregate activity.
|
|
1258
1258
|
* @param issuerCik Company CIK. With ownerCik, restricts that owner to this company. Alone, every reporting owner's events at this company, a joint filing counted once.
|
|
@@ -1273,7 +1273,7 @@ function InsiderTrades(asset, metric, role, windowDays, ownerCik, issuerCik, ins
|
|
|
1273
1273
|
return d;
|
|
1274
1274
|
}
|
|
1275
1275
|
/**
|
|
1276
|
-
*
|
|
1276
|
+
* Institutional positions in the asset disclosed on SEC Form 13F. Naming a manager follows one institution; an empty manager reads every manager holding the asset (SDK code passes an empty string). Level metrics read the latest quarter whose filing became public on or before the evaluation date; change metrics compare it with the quarter before. Positions are never summed across quarters, and an amended filing replaces the original only from the moment the amendment became public. Range: Counts, shares, dollars or a top-5 share of holdings; 0 when no 13F naming the asset was public within the window.
|
|
1277
1277
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1278
1278
|
* @param manager Optional: a CIK such as 1067983, or part of a manager's name such as Renaissance Technologies. Leave empty for every manager. A CIK is exact; a name can match several firms
|
|
1279
1279
|
* @param metric Managers holding, shares or value held, concentration, or the change since the previous quarter
|
|
@@ -1290,7 +1290,7 @@ function InstitutionalHoldings(asset, manager, metric = "HolderCount", windowDay
|
|
|
1290
1290
|
return d;
|
|
1291
1291
|
}
|
|
1292
1292
|
/**
|
|
1293
|
-
*
|
|
1293
|
+
* Returns 1 if the asset matches a specific symbol. Useful for including specific assets in multi-asset strategies.
|
|
1294
1294
|
* @param matchAsset The specific asset to compare against (ex. UPRO, GLD)
|
|
1295
1295
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1296
1296
|
*/
|
|
@@ -1301,7 +1301,7 @@ function IsAsset(matchAsset, asset) {
|
|
|
1301
1301
|
return d;
|
|
1302
1302
|
}
|
|
1303
1303
|
/**
|
|
1304
|
-
*
|
|
1304
|
+
* Returns 1 if the asset matches Stock, Cryptocurrency, Option or Other, and 0 otherwise. ETFs are Stock assets; use separate stock metadata or a universe filter to select ETFs.
|
|
1305
1305
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1306
1306
|
* @param assetType The asset type to check against
|
|
1307
1307
|
*/
|
|
@@ -1312,7 +1312,7 @@ function IsAssetType(asset, assetType = "Stock") {
|
|
|
1312
1312
|
return d;
|
|
1313
1313
|
}
|
|
1314
1314
|
/**
|
|
1315
|
-
*
|
|
1315
|
+
* Returns 1 if the asset is a member of a specified index, 0 otherwise.
|
|
1316
1316
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1317
1317
|
* @param index The index to check membership against
|
|
1318
1318
|
*/
|
|
@@ -1323,7 +1323,7 @@ function IsIndexMember(asset, index = "SP500") {
|
|
|
1323
1323
|
return d;
|
|
1324
1324
|
}
|
|
1325
1325
|
/**
|
|
1326
|
-
*
|
|
1326
|
+
* Returns 1 if the asset belongs to a specified industry, 0 otherwise. Over 100 categories supported including Artificial Intelligence, Semiconductor, Electric Vehicles, Space Exploration, Healthcare, Biotechnology, Cloud Computing, Cybersecurity, Renewable Energy, and many more.
|
|
1327
1327
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1328
1328
|
* @param industry The industry to check membership against
|
|
1329
1329
|
*/
|
|
@@ -1334,7 +1334,7 @@ function IsIndustry(asset, industry) {
|
|
|
1334
1334
|
return d;
|
|
1335
1335
|
}
|
|
1336
1336
|
/**
|
|
1337
|
-
*
|
|
1337
|
+
* Returns 1 if the asset does NOT match a specific symbol. Useful for excluding specific assets.
|
|
1338
1338
|
* @param matchAsset The specific asset to compare against (ex. UPRO, GLD)
|
|
1339
1339
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1340
1340
|
*/
|
|
@@ -1345,7 +1345,7 @@ function IsNotAsset(matchAsset, asset) {
|
|
|
1345
1345
|
return d;
|
|
1346
1346
|
}
|
|
1347
1347
|
/**
|
|
1348
|
-
*
|
|
1348
|
+
* Constant-maturity ATM implied volatility divided by annualized close-to-close realized volatility (HV) over hvWindow trading days. Values > 1 mean options are pricing more vol than recently realized. Used on each candidate of a dynamic rebalance over a broad universe (all US stocks, an index or a watchlist), it reads options chains with Greeks for every stock in that universe instead of one underlying, so the run is heavier than with a named ticker or a specific asset list. Range: > 0.
|
|
1349
1349
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1350
1350
|
* @param hvWindow Trading days of log-return history for realized volatility
|
|
1351
1351
|
*/
|
|
@@ -1356,7 +1356,7 @@ function IVHVRatio(asset, hvWindow = 20) {
|
|
|
1356
1356
|
return d;
|
|
1357
1357
|
}
|
|
1358
1358
|
/**
|
|
1359
|
-
*
|
|
1359
|
+
* Percent of sessions in the lookback window whose constant-maturity ATM IV was strictly below today's (0–100). Distinct from IV Rank. Used on each candidate of a dynamic rebalance over a broad universe (all US stocks, an index or a watchlist), it reads options chains with Greeks for every stock in that universe instead of one underlying, so the run is heavier than with a named ticker or a specific asset list. Range: 0–100.
|
|
1360
1360
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1361
1361
|
* @param length Length of time
|
|
1362
1362
|
* @param interval Unit of time
|
|
@@ -1368,7 +1368,7 @@ function IVPercentile(asset, length = 252, interval = "Day") {
|
|
|
1368
1368
|
return d;
|
|
1369
1369
|
}
|
|
1370
1370
|
/**
|
|
1371
|
-
*
|
|
1371
|
+
* Where today's constant-maturity ATM IV sits between the lookback window's high and low: (IV − IV_low) / (IV_high − IV_low) × 100. Distinct from IV Percentile. Used on each candidate of a dynamic rebalance over a broad universe (all US stocks, an index or a watchlist), it reads options chains with Greeks for every stock in that universe instead of one underlying, so the run is heavier than with a named ticker or a specific asset list. Range: 0–100.
|
|
1372
1372
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1373
1373
|
* @param length Length of time
|
|
1374
1374
|
* @param interval Unit of time
|
|
@@ -1380,7 +1380,7 @@ function IVRank(asset, length = 252, interval = "Day") {
|
|
|
1380
1380
|
return d;
|
|
1381
1381
|
}
|
|
1382
1382
|
/**
|
|
1383
|
-
*
|
|
1383
|
+
* EMA midline with ATR bands above and below. Tighter than Bollinger in calm tape, so closes outside the bands mean stronger conviction moves. Range: Price scale.
|
|
1384
1384
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1385
1385
|
* @param length Length of time
|
|
1386
1386
|
* @param interval Unit of time
|
|
@@ -1405,7 +1405,7 @@ function LastDividend(asset) {
|
|
|
1405
1405
|
return d;
|
|
1406
1406
|
}
|
|
1407
1407
|
/**
|
|
1408
|
-
*
|
|
1408
|
+
* The execution price of the most recent order matching the specified filters. Range: > 0.
|
|
1409
1409
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1410
1410
|
* @param side Matches order events with this side (buy or sell)
|
|
1411
1411
|
* @param orderStatus Matches order events with this status
|
|
@@ -1418,7 +1418,7 @@ function LastOrderPrice(asset, side, orderStatus = "Filled") {
|
|
|
1418
1418
|
return d;
|
|
1419
1419
|
}
|
|
1420
1420
|
/**
|
|
1421
|
-
*
|
|
1421
|
+
* Logarithm of an indicator with a specified base.
|
|
1422
1422
|
* @param base The base for the logarithm
|
|
1423
1423
|
*/
|
|
1424
1424
|
function Log(operand, base = 10) {
|
|
@@ -1428,7 +1428,7 @@ function Log(operand, base = 10) {
|
|
|
1428
1428
|
return d;
|
|
1429
1429
|
}
|
|
1430
1430
|
/**
|
|
1431
|
-
*
|
|
1431
|
+
* The lowest price reached during the current trading session. Range: > 0.
|
|
1432
1432
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1433
1433
|
*/
|
|
1434
1434
|
function LowOfDay(asset) {
|
|
@@ -1437,7 +1437,7 @@ function LowOfDay(asset) {
|
|
|
1437
1437
|
return d;
|
|
1438
1438
|
}
|
|
1439
1439
|
/**
|
|
1440
|
-
*
|
|
1440
|
+
* The maximum value of two or more indicators. The SDK builder takes exactly two operands; nest it to compare more.
|
|
1441
1441
|
*/
|
|
1442
1442
|
function Max(left, right) {
|
|
1443
1443
|
const d = { type: "Max" };
|
|
@@ -1445,7 +1445,7 @@ function Max(left, right) {
|
|
|
1445
1445
|
return d;
|
|
1446
1446
|
}
|
|
1447
1447
|
/**
|
|
1448
|
-
*
|
|
1448
|
+
* The largest peak-to-trough percentage decline of the asset's price inside the window, reported as a positive number: 10 means a 10% fall from a high to a later low, and 0 means the price never fell below an earlier price in the window. Measures worst-case downside risk. Range: 0 to 100 (percent, never negative).
|
|
1449
1449
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1450
1450
|
* @param length Length of time
|
|
1451
1451
|
* @param interval Unit of time
|
|
@@ -1457,7 +1457,7 @@ function MaxDrawdown(asset, length = 30, interval = "Day") {
|
|
|
1457
1457
|
return d;
|
|
1458
1458
|
}
|
|
1459
1459
|
/**
|
|
1460
|
-
*
|
|
1460
|
+
* The maximum trough-to-peak percentage increase over a window. Range: >= 0 (percentage).
|
|
1461
1461
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1462
1462
|
* @param length Length of time
|
|
1463
1463
|
* @param interval Unit of time
|
|
@@ -1469,7 +1469,7 @@ function MaxDrawup(asset, length = 30, interval = "Day") {
|
|
|
1469
1469
|
return d;
|
|
1470
1470
|
}
|
|
1471
1471
|
/**
|
|
1472
|
-
*
|
|
1472
|
+
* The highest of the asset's observed prices over a window, including the current one. Each observation is the price at that time (a completed day contributes its close, a completed minute its closing price), not an intrabar high. Range: > 0.
|
|
1473
1473
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1474
1474
|
* @param length Length of time
|
|
1475
1475
|
* @param interval Unit of time
|
|
@@ -1481,7 +1481,7 @@ function MaximumPrice(asset, length = 30, interval = "Day") {
|
|
|
1481
1481
|
return d;
|
|
1482
1482
|
}
|
|
1483
1483
|
/**
|
|
1484
|
-
*
|
|
1484
|
+
* The minimum value of two or more indicators. The SDK builder takes exactly two operands; nest it to compare more.
|
|
1485
1485
|
*/
|
|
1486
1486
|
function Min(left, right) {
|
|
1487
1487
|
const d = { type: "Min" };
|
|
@@ -1489,7 +1489,7 @@ function Min(left, right) {
|
|
|
1489
1489
|
return d;
|
|
1490
1490
|
}
|
|
1491
1491
|
/**
|
|
1492
|
-
*
|
|
1492
|
+
* The lowest of the asset's observed prices over a window, including the current one. Each observation is the price at that time (a completed day contributes its close, a completed minute its closing price), not an intrabar low. Range: > 0.
|
|
1493
1493
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1494
1494
|
* @param length Length of time
|
|
1495
1495
|
* @param interval Unit of time
|
|
@@ -1501,7 +1501,7 @@ function MinimumPrice(asset, length = 30, interval = "Day") {
|
|
|
1501
1501
|
return d;
|
|
1502
1502
|
}
|
|
1503
1503
|
/**
|
|
1504
|
-
*
|
|
1504
|
+
* Difference between indicators.
|
|
1505
1505
|
*/
|
|
1506
1506
|
function Minus(left, right) {
|
|
1507
1507
|
const d = { type: "Minus" };
|
|
@@ -1509,7 +1509,7 @@ function Minus(left, right) {
|
|
|
1509
1509
|
return d;
|
|
1510
1510
|
}
|
|
1511
1511
|
/**
|
|
1512
|
-
*
|
|
1512
|
+
* The high of the most recently COMPLETED one-minute bar. The bar that opens at 9:30 is readable from 9:31, identically in backtests and live trading; the forming bar is never used. Not the day's high (use High of Day). Pre-market and after-hours bars count. Strategies using it run on one-minute data. Range: > 0.
|
|
1513
1513
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1514
1514
|
*/
|
|
1515
1515
|
function MinuteBarHigh(asset) {
|
|
@@ -1518,7 +1518,7 @@ function MinuteBarHigh(asset) {
|
|
|
1518
1518
|
return d;
|
|
1519
1519
|
}
|
|
1520
1520
|
/**
|
|
1521
|
-
*
|
|
1521
|
+
* The low of the most recently COMPLETED one-minute bar. The bar that opens at 9:30 is readable from 9:31, identically in backtests and live trading; the forming bar is never used. Not the day's low (use Low of Day). Pre-market and after-hours bars count. Strategies using it run on one-minute data. Range: > 0.
|
|
1522
1522
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1523
1523
|
*/
|
|
1524
1524
|
function MinuteBarLow(asset) {
|
|
@@ -1527,21 +1527,21 @@ function MinuteBarLow(asset) {
|
|
|
1527
1527
|
return d;
|
|
1528
1528
|
}
|
|
1529
1529
|
/**
|
|
1530
|
-
*
|
|
1530
|
+
* Whole minutes since the regular US market open (9:30 AM ET), read from the Eastern clock. The value is not clamped to the session: it is negative before the open and keeps rising above 390 after the 4:00 PM close. Range: 0 to 390 during a regular session; negative before 9:30 AM ET and above 390 after the close.
|
|
1531
1531
|
*/
|
|
1532
1532
|
function MinutesAfterOpen() {
|
|
1533
1533
|
const d = { type: "MinutesAfterOpen" };
|
|
1534
1534
|
return d;
|
|
1535
1535
|
}
|
|
1536
1536
|
/**
|
|
1537
|
-
*
|
|
1537
|
+
* The number of minutes since an AI agent was launched by this strategy. Useful for fine-grained rate-limiting of agent launches within a single day. Range: >= 0.
|
|
1538
1538
|
*/
|
|
1539
1539
|
function MinutesSinceAgent() {
|
|
1540
1540
|
const d = { type: "MinutesSinceAgent" };
|
|
1541
1541
|
return d;
|
|
1542
1542
|
}
|
|
1543
1543
|
/**
|
|
1544
|
-
*
|
|
1544
|
+
* The number of minutes since an alert was triggered. Useful for fine-grained rate-limiting of alerts within a single day. Range: >= 0.
|
|
1545
1545
|
* @param message (Optional) Message to display when the indicator is triggered
|
|
1546
1546
|
*/
|
|
1547
1547
|
function MinutesSinceAlert(message) {
|
|
@@ -1550,7 +1550,7 @@ function MinutesSinceAlert(message) {
|
|
|
1550
1550
|
return d;
|
|
1551
1551
|
}
|
|
1552
1552
|
/**
|
|
1553
|
-
*
|
|
1553
|
+
* The number of minutes since the most recent option order matching the specified filters. Same filters as Days Since Option Order but measured in minutes for intraday strategies. Range: >= 0 (minutes), or a large number if no matching order exists.
|
|
1554
1554
|
* @param underlying Filter by underlying (e.g., AAPL, SPY). Leave empty for all.
|
|
1555
1555
|
* @param optionType Filter by Call or Put. Leave empty for all.
|
|
1556
1556
|
* @param direction Filter by Long or Short. Leave empty for all.
|
|
@@ -1573,7 +1573,7 @@ function MinutesSinceOptionOrder(underlying, optionType, direction, spreadType,
|
|
|
1573
1573
|
return d;
|
|
1574
1574
|
}
|
|
1575
1575
|
/**
|
|
1576
|
-
*
|
|
1576
|
+
* Same as Days Since Order but measured in minutes. Useful for intraday strategies. Range: >= 0 (minutes).
|
|
1577
1577
|
* @param assets Ticker(s) whose orders are counted. One string or an array.
|
|
1578
1578
|
* @param side Buy or Sell
|
|
1579
1579
|
* @param clock Optional elapsed-time clock; omitted retains calendar minutes.
|
|
@@ -1588,14 +1588,14 @@ function MinutesSinceOrder(assets, side, orderStatus = "Filled", clock) {
|
|
|
1588
1588
|
return d;
|
|
1589
1589
|
}
|
|
1590
1590
|
/**
|
|
1591
|
-
*
|
|
1591
|
+
* Whole minutes until the US equity session close, read from the Eastern clock. The close is that day's real session close, so an early-close day counts down to 1:00 PM ET instead of 4:00 PM. The value is not clamped to the session: it is negative after the close and above 390 before the 9:30 AM open. Range: 0 to 390 during a regular session (0 to 210 on a 1:00 PM early close); negative after the close and above 390 before the open.
|
|
1592
1592
|
*/
|
|
1593
1593
|
function MinutesUntilClose() {
|
|
1594
1594
|
const d = { type: "MinutesUntilClose" };
|
|
1595
1595
|
return d;
|
|
1596
1596
|
}
|
|
1597
1597
|
/**
|
|
1598
|
-
*
|
|
1598
|
+
* Volume-weighted RSI: money flow direction over N bars on a 0-100 scale. Above 80 is overbought, below 20 oversold. Requires volume data. Range: 0 to 100.
|
|
1599
1599
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1600
1600
|
* @param length Length of time
|
|
1601
1601
|
* @param interval Unit of time
|
|
@@ -1607,14 +1607,14 @@ function MoneyFlowIndex(asset, length = 14, interval = "Day") {
|
|
|
1607
1607
|
return d;
|
|
1608
1608
|
}
|
|
1609
1609
|
/**
|
|
1610
|
-
*
|
|
1610
|
+
* The current month (1–12).
|
|
1611
1611
|
*/
|
|
1612
1612
|
function Month() {
|
|
1613
1613
|
const d = { type: "Month" };
|
|
1614
1614
|
return d;
|
|
1615
1615
|
}
|
|
1616
1616
|
/**
|
|
1617
|
-
*
|
|
1617
|
+
* MACD line (fast EMA minus slow EMA), its signal EMA, or the histogram (MACD minus signal). Classic trend/momentum indicator. Range: Positive or negative for all three lines, in price units: each is a difference of moving averages, not a price level.
|
|
1618
1618
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1619
1619
|
* @param fastLength Period of the fast EMA
|
|
1620
1620
|
* @param slowLength Period of the slow EMA (must exceed the fast length)
|
|
@@ -1633,7 +1633,7 @@ function MovingAverageConvergenceDivergence(asset, fastLength = 12, slowLength =
|
|
|
1633
1633
|
return d;
|
|
1634
1634
|
}
|
|
1635
1635
|
/**
|
|
1636
|
-
*
|
|
1636
|
+
* Product of indicators.
|
|
1637
1637
|
*/
|
|
1638
1638
|
function Multiply(left, right) {
|
|
1639
1639
|
const d = { type: "Multiply" };
|
|
@@ -1641,7 +1641,7 @@ function Multiply(left, right) {
|
|
|
1641
1641
|
return d;
|
|
1642
1642
|
}
|
|
1643
1643
|
/**
|
|
1644
|
-
*
|
|
1644
|
+
* Negates an indicator's value.
|
|
1645
1645
|
*/
|
|
1646
1646
|
function Negative(operand) {
|
|
1647
1647
|
const d = { type: "Negative" };
|
|
@@ -1649,7 +1649,7 @@ function Negative(operand) {
|
|
|
1649
1649
|
return d;
|
|
1650
1650
|
}
|
|
1651
1651
|
/**
|
|
1652
|
-
*
|
|
1652
|
+
* True when a newly public Form 4 version matches the selected owner, issuer, role, instrument and action and awaits a strategy decision. Exact-owner corrections count as new versions. A company CIK without an owner watches every reporting owner at that company, and a joint filing fires once. A handled event does not fire again on later price ticks; unverified owner coverage has no value, and a company is only as covered as its least-covered matching owner. Range: 1 while a public Form 4 version awaits a decision; otherwise 0.
|
|
1653
1653
|
* @param ownerCik Exact SEC reporting owner CIK. Omit for a whole company (with issuerCik) or aggregate Form 4 activity.
|
|
1654
1654
|
* @param issuerCik Company CIK. With ownerCik, restricts that owner; alone, every reporting owner at this company, a joint filing once.
|
|
1655
1655
|
* @param role The reporting owner's role.
|
|
@@ -1668,7 +1668,7 @@ function NewInsiderDisclosure(ownerCik, issuerCik, role = "Any", instrument = "E
|
|
|
1668
1668
|
return d;
|
|
1669
1669
|
}
|
|
1670
1670
|
/**
|
|
1671
|
-
*
|
|
1671
|
+
* True when an exact manager CIK has a newly public 13F filing or amendment this strategy has not handled. Each accession creates one decision; later price ticks do not repeat it. The current InstitutionalHoldings book still sets target positions. Range: 1 while a public filing awaits a decision; otherwise 0.
|
|
1672
1672
|
* @param manager Exact numeric SEC manager CIK. A new 13F accession, including an amendment, triggers one decision.
|
|
1673
1673
|
*/
|
|
1674
1674
|
function NewInstitutionalFiling(manager) {
|
|
@@ -1677,7 +1677,7 @@ function NewInstitutionalFiling(manager) {
|
|
|
1677
1677
|
return d;
|
|
1678
1678
|
}
|
|
1679
1679
|
/**
|
|
1680
|
-
*
|
|
1680
|
+
* True when a selected member has a newly public equity or option trade disclosure that this strategy has not handled. Corrections count when they become public. A handled disclosure does not fire again on later price ticks. Range: 1 while a new disclosure awaits a decision; otherwise 0.
|
|
1681
1681
|
* @param memberId Exact Bioguide member ID, such as P000197.
|
|
1682
1682
|
* @param instrument Equity or option disclosures, never both for a public bot arm.
|
|
1683
1683
|
* @param disclosureAction Which newly public trade sides trigger a decision.
|
|
@@ -1703,14 +1703,14 @@ function NewsSentiment(asset, measure = "Mean", lookbackDays = 1) {
|
|
|
1703
1703
|
return d;
|
|
1704
1704
|
}
|
|
1705
1705
|
/**
|
|
1706
|
-
*
|
|
1706
|
+
* True on the first evaluated trading tick of an ISO week until the strategy makes a decision. A no-order decision still consumes that week, and live portfolios persist the decision through a restart. Use with an option disclosure trigger for modeled maintenance. Range: 1 while this week's first decision is pending; otherwise 0.
|
|
1707
1707
|
*/
|
|
1708
1708
|
function NewTradingWeek() {
|
|
1709
1709
|
const d = { type: "NewTradingWeek" };
|
|
1710
1710
|
return d;
|
|
1711
1711
|
}
|
|
1712
1712
|
/**
|
|
1713
|
-
*
|
|
1713
|
+
* Running total of signed volume: adds the bar's volume on up closes, subtracts on down closes. Rising OBV with flat price is accumulation. Range: Unbounded (cumulative).
|
|
1714
1714
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1715
1715
|
* @param interval Bar interval the volume is accumulated on
|
|
1716
1716
|
*/
|
|
@@ -1721,7 +1721,7 @@ function OnBalanceVolume(asset, interval = "Day") {
|
|
|
1721
1721
|
return d;
|
|
1722
1722
|
}
|
|
1723
1723
|
/**
|
|
1724
|
-
*
|
|
1724
|
+
* The price of an asset at market open. Range: > 0.
|
|
1725
1725
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1726
1726
|
*/
|
|
1727
1727
|
function OpeningPrice(asset) {
|
|
@@ -1730,7 +1730,7 @@ function OpeningPrice(asset) {
|
|
|
1730
1730
|
return d;
|
|
1731
1731
|
}
|
|
1732
1732
|
/**
|
|
1733
|
-
*
|
|
1733
|
+
* Returns the total collateral locked across option spreads matching the filter. Range: 0 to ∞ (dollars).
|
|
1734
1734
|
* @param underlying Filter by underlying (e.g., AAPL, SPY). Leave empty for all.
|
|
1735
1735
|
* @param optionType Filter by Call or Put. Leave empty for all.
|
|
1736
1736
|
* @param direction Filter by Long or Short. Leave empty for all.
|
|
@@ -1745,7 +1745,7 @@ function OptionCollateral(underlying, optionType, direction, spreadType) {
|
|
|
1745
1745
|
return d;
|
|
1746
1746
|
}
|
|
1747
1747
|
/**
|
|
1748
|
-
*
|
|
1748
|
+
* Returns the minimum or maximum days since entry across option spreads matching the filter. Range: 0 to ∞.
|
|
1749
1749
|
* @param underlying Filter by underlying (e.g., AAPL, SPY). Leave empty for all.
|
|
1750
1750
|
* @param optionType Filter by Call or Put. Leave empty for all.
|
|
1751
1751
|
* @param direction Filter by Long or Short. Leave empty for all.
|
|
@@ -1762,7 +1762,7 @@ function OptionDaysHeld(underlying, optionType, direction, spreadType, minOrMax
|
|
|
1762
1762
|
return d;
|
|
1763
1763
|
}
|
|
1764
1764
|
/**
|
|
1765
|
-
*
|
|
1765
|
+
* Returns the minimum or maximum days to expiration across option spreads matching the filter. Range: 0 to 365+.
|
|
1766
1766
|
* @param underlying Filter by underlying (e.g., AAPL, SPY). Leave empty for all.
|
|
1767
1767
|
* @param optionType Filter by Call or Put. Leave empty for all.
|
|
1768
1768
|
* @param direction Filter by Long or Short. Leave empty for all.
|
|
@@ -1779,14 +1779,14 @@ function OptionDaysToExpiration(underlying, optionType, direction, spreadType, m
|
|
|
1779
1779
|
return d;
|
|
1780
1780
|
}
|
|
1781
1781
|
/**
|
|
1782
|
-
*
|
|
1782
|
+
* Sum of absolute option leg marks divided by portfolio value (percent). Matches gross deployment audits. Unfiltered portfolio-wide only. Range: 0% to ∞.
|
|
1783
1783
|
*/
|
|
1784
1784
|
function OptionGrossExposurePercent() {
|
|
1785
1785
|
const d = { type: "OptionGrossExposurePercent" };
|
|
1786
1786
|
return d;
|
|
1787
1787
|
}
|
|
1788
1788
|
/**
|
|
1789
|
-
*
|
|
1789
|
+
* Returns the number of open option contract positions/legs matching the filter criteria. Portfolio-wide (no underlying, option type, direction, or spread filters): open legs plus legs reserved by earlier true OpenOption signals in the same tick's strategy loop. Filtered counts (e.g. per ticker) use open legs only. Use Option Spread Count for multi-leg spread groups. Range: 0 to ∞.
|
|
1790
1790
|
* @param underlying Filter by underlying (e.g., AAPL, SPY). Leave empty for all.
|
|
1791
1791
|
* @param optionType Filter by Call or Put. Leave empty for all.
|
|
1792
1792
|
* @param direction Filter by Long or Short. Leave empty for all.
|
|
@@ -1801,7 +1801,7 @@ function OptionPositionCount(underlying, optionType, direction, spreadType) {
|
|
|
1801
1801
|
return d;
|
|
1802
1802
|
}
|
|
1803
1803
|
/**
|
|
1804
|
-
*
|
|
1804
|
+
* Peak-to-current drawdown of the aggregated P&L percentage across option spreads matching the filter. Stateful counterpart of the Option Position P&L% indicator (OptionPositionPercentChange): while that indicator returns the current P&L percentage, this one tracks the highest value observed and returns how far the position has fallen from that peak. Resets when no matching spreads remain so a fresh entry starts from a clean peak. Range: >= 0 (percentage points of P&L).
|
|
1805
1805
|
* @param underlying Filter by underlying (e.g., AAPL, SPY). Leave empty for all.
|
|
1806
1806
|
* @param optionType Filter by Call or Put. Leave empty for all.
|
|
1807
1807
|
* @param direction Filter by Long or Short. Leave empty for all.
|
|
@@ -1816,7 +1816,7 @@ function OptionPositionMaxDrawdown(underlying, optionType, direction, spreadType
|
|
|
1816
1816
|
return d;
|
|
1817
1817
|
}
|
|
1818
1818
|
/**
|
|
1819
|
-
*
|
|
1819
|
+
* Returns the weighted average P&L percentage across option spreads matching the filter. Range: -100% to ∞.
|
|
1820
1820
|
* @param underlying Filter by underlying (e.g., AAPL, SPY). Leave empty for all.
|
|
1821
1821
|
* @param optionType Filter by Call or Put. Leave empty for all.
|
|
1822
1822
|
* @param direction Filter by Long or Short. Leave empty for all.
|
|
@@ -1831,7 +1831,7 @@ function OptionPositionPercentChange(underlying, optionType, direction, spreadTy
|
|
|
1831
1831
|
return d;
|
|
1832
1832
|
}
|
|
1833
1833
|
/**
|
|
1834
|
-
*
|
|
1834
|
+
* Returns the total market value of option spreads matching the filter criteria. Range: 0 to ∞ (dollars).
|
|
1835
1835
|
* @param underlying Filter by underlying (e.g., AAPL, SPY). Leave empty for all.
|
|
1836
1836
|
* @param optionType Filter by Call or Put. Leave empty for all.
|
|
1837
1837
|
* @param direction Filter by Long or Short. Leave empty for all.
|
|
@@ -1846,7 +1846,7 @@ function OptionPositionValue(underlying, optionType, direction, spreadType) {
|
|
|
1846
1846
|
return d;
|
|
1847
1847
|
}
|
|
1848
1848
|
/**
|
|
1849
|
-
*
|
|
1849
|
+
* Returns the net realized P&L in dollars from CLOSED option positions matching the filter, long and short alike. Losing closes count as negative. Measures closes only and subtracts nothing for premium already spent. Lookback Days limits it to closes within that many days of the evaluation date; omit it for the whole life of the book. Range: -∞ to ∞ (dollars).
|
|
1850
1850
|
* @param underlying Filter by underlying (e.g., AAPL, SPY). Leave empty for all.
|
|
1851
1851
|
* @param optionType Filter by Call or Put. Leave empty for all.
|
|
1852
1852
|
* @param direction Filter by Long or Short. Leave empty for all.
|
|
@@ -1864,7 +1864,7 @@ function OptionRealizedPnL(underlying, optionType, direction, spreadType, lookba
|
|
|
1864
1864
|
return d;
|
|
1865
1865
|
}
|
|
1866
1866
|
/**
|
|
1867
|
-
*
|
|
1867
|
+
* Returns realized option premium still available to spend: net realized P&L from closed short option positions, minus premium already spent by opens sized with Percent of Realized Premium. Proceeds from closing long options are not added back. This is the balance that allocation sizes against. It goes negative when closed shorts lost money, and a negative balance funds nothing. Lookback Days limits it to activity within that many days of the evaluation date; omit it for the whole life of the book. Range: -∞ to ∞ (dollars).
|
|
1868
1868
|
* @param underlying Filter by underlying (e.g., AAPL, SPY). Leave empty for all.
|
|
1869
1869
|
* @param lookbackDays Only count activity within this many days of the evaluation date. Leave empty for the whole life of the book.
|
|
1870
1870
|
*/
|
|
@@ -1876,7 +1876,7 @@ function OptionRealizedPremium(underlying, lookbackDays) {
|
|
|
1876
1876
|
return d;
|
|
1877
1877
|
}
|
|
1878
1878
|
/**
|
|
1879
|
-
*
|
|
1879
|
+
* Returns the number of distinct economic open multi-leg option spreads matching the filter criteria, deduplicating equal economic spread keys. Does not count standalone single-leg option positions. Range: 0 to ∞.
|
|
1880
1880
|
* @param underlying Filter by underlying (e.g., AAPL, SPY). Leave empty for all.
|
|
1881
1881
|
* @param optionType Filter by Call or Put. Leave empty for all.
|
|
1882
1882
|
* @param direction Filter by Long or Short. Leave empty for all.
|
|
@@ -1891,7 +1891,7 @@ function OptionSpreadCount(underlying, optionType, direction, spreadType) {
|
|
|
1891
1891
|
return d;
|
|
1892
1892
|
}
|
|
1893
1893
|
/**
|
|
1894
|
-
*
|
|
1894
|
+
* Returns the net price per share paid or collected to open the option spreads matching the filter: positive for a net debit, negative for a net credit. Several matching spreads average by contracts. Has no value when no matching spread is open. Use it as an option limit amount to price one spread off another spread's fill; wrap a credit spread's price in Absolute Value first, because a limit must be positive. Range: -∞ to ∞ (dollars per share).
|
|
1895
1895
|
* @param underlying Filter by underlying (e.g., AAPL, SPY). Leave empty for all.
|
|
1896
1896
|
* @param optionType Filter by Call or Put. Leave empty for all.
|
|
1897
1897
|
* @param direction Filter by Long or Short. Leave empty for all.
|
|
@@ -1906,7 +1906,7 @@ function OptionSpreadEntryPrice(underlying, optionType, direction, spreadType) {
|
|
|
1906
1906
|
return d;
|
|
1907
1907
|
}
|
|
1908
1908
|
/**
|
|
1909
|
-
*
|
|
1909
|
+
* Returns the total unrealized P&L in dollars across option spreads matching the filter. Range: -∞ to ∞ (dollars).
|
|
1910
1910
|
* @param underlying Filter by underlying (e.g., AAPL, SPY). Leave empty for all.
|
|
1911
1911
|
* @param optionType Filter by Call or Put. Leave empty for all.
|
|
1912
1912
|
* @param direction Filter by Long or Short. Leave empty for all.
|
|
@@ -1921,7 +1921,7 @@ function OptionUnrealizedPnL(underlying, optionType, direction, spreadType) {
|
|
|
1921
1921
|
return d;
|
|
1922
1922
|
}
|
|
1923
1923
|
/**
|
|
1924
|
-
*
|
|
1924
|
+
* Trailing stop-and-reverse level that accelerates toward price as the trend extends. Price crossing the SAR flips the trend. Range: Price scale.
|
|
1925
1925
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1926
1926
|
* @param interval Bar interval the SAR trails on
|
|
1927
1927
|
* @param step AF increment per new extreme
|
|
@@ -1936,7 +1936,7 @@ function ParabolicSar(asset, interval = "Day", step = 0.02, maximum = 0.2) {
|
|
|
1936
1936
|
return d;
|
|
1937
1937
|
}
|
|
1938
1938
|
/**
|
|
1939
|
-
*
|
|
1939
|
+
* Sum of two or more indicators. The SDK builder takes exactly two operands; nest it to add more.
|
|
1940
1940
|
*/
|
|
1941
1941
|
function Plus(left, right) {
|
|
1942
1942
|
const d = { type: "Plus" };
|
|
@@ -1944,7 +1944,7 @@ function Plus(left, right) {
|
|
|
1944
1944
|
return d;
|
|
1945
1945
|
}
|
|
1946
1946
|
/**
|
|
1947
|
-
*
|
|
1947
|
+
* A member's publicly known equity or option purchase dollars divided by the sum of both, across all disclosed tickers. Event versions enter only when public. Unclassified instruments are excluded. purchaseScope defaults to AllPurchases for historical flow. RemainingLots sums surviving original purchase costs after reported full sales and exercises, excluding unresolved ticker buckets. Unknown partial quantities retain their estimate. Neither setting is current market value or verified holdings. Range: 0 to 100 percent; zero before a qualifying purchase.
|
|
1948
1948
|
* @param memberId Bioguide member id, for example P000197. The share uses the member's whole public purchase record.
|
|
1949
1949
|
* @param instrument Which side of the equity/option purchase mix to return, as a percent from 0 to 100.
|
|
1950
1950
|
* @param amountBasis Estimate for disclosed purchase ranges. Midpoint is the default.
|
|
@@ -1959,7 +1959,7 @@ function PoliticalPurchaseShare(memberId, instrument = "Equity", amountBasis = "
|
|
|
1959
1959
|
return d;
|
|
1960
1960
|
}
|
|
1961
1961
|
/**
|
|
1962
|
-
*
|
|
1962
|
+
* Trades by members of Congress in the asset, from the unified House and Senate disclosure lake, over a trailing window. A trade counts from the moment its report became public, never its trade date, and an amended report changes a value only from the moment the amendment became public. Amount metrics can use the lower, midpoint, or upper end of every disclosed range. Equity disclosures are the default; confirmed option disclosures can be selected separately for numeric activity. Held requires Equity and reads the member's whole public record instead: 1 while their latest equity disclosure for the asset is a purchase or partial sale, 0 after a full sale. Held is a disclosure signal, not verified holdings or share quantity. RemainingBuyAmount reads the full public history and sums original purchase ranges of remaining lots after full sales and exercises. Unknown partial quantities retain their purchase amount estimate; sale proceeds are never subtracted. This is estimated remaining cost, not current market value. Printed expirations identify lots but do not implicitly end modeled renewal exposure. Range: Disclosed amount-range values or counts over the window, or 1/0 for Held; 0 when no matching trade was disclosed.
|
|
1963
1963
|
* @param asset Pass CANDIDATE inside a rebalance pipeline to bind each stock.
|
|
1964
1964
|
* @param filer Member full or last name. Pass an empty string for all members.
|
|
1965
1965
|
* @param metric Amount-range aggregate, event count, distinct purchasing members, RemainingBuyAmount (surviving original purchase amounts; ignores window; unknown partial quantities retained), or Held: 1 while the member still holds the asset (latest public disclosure is a purchase or partial sale), ignoring the window.
|
|
@@ -1982,7 +1982,7 @@ function PoliticalTrades(asset, filer, metric = "BuyAmount", windowDays = 90, am
|
|
|
1982
1982
|
return d;
|
|
1983
1983
|
}
|
|
1984
1984
|
/**
|
|
1985
|
-
*
|
|
1985
|
+
* The total current value of your portfolio (cash + all positions). Range: >= 0.
|
|
1986
1986
|
*/
|
|
1987
1987
|
function PortfolioValue() {
|
|
1988
1988
|
const d = { type: "PortfolioValue" };
|
|
@@ -1998,7 +1998,7 @@ function PositionEntryPrice(asset) {
|
|
|
1998
1998
|
return d;
|
|
1999
1999
|
}
|
|
2000
2000
|
/**
|
|
2001
|
-
*
|
|
2001
|
+
* The maximum percentage decline in the position's unrealized P&L from its peak. Aggregates the stock or crypto holding plus all option spreads on that underlying. Returns 0 at a new high water mark; rises as P&L falls below the peak, so it is never negative. Range: >= 0 (percentage points of P&L).
|
|
2002
2002
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
2003
2003
|
*/
|
|
2004
2004
|
function PositionMaxDrawdown(asset) {
|
|
@@ -2007,7 +2007,7 @@ function PositionMaxDrawdown(asset) {
|
|
|
2007
2007
|
return d;
|
|
2008
2008
|
}
|
|
2009
2009
|
/**
|
|
2010
|
-
*
|
|
2010
|
+
* The percentage increase of the asset's current market price from the lowest price observed by this indicator. Share purchases and sales do not change the calculation; it does not use position cost basis. Range: >= 0 (percentage).
|
|
2011
2011
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
2012
2012
|
*/
|
|
2013
2013
|
function PositionMaxDrawup(asset) {
|
|
@@ -2034,7 +2034,7 @@ function PositionPeakPrice(asset) {
|
|
|
2034
2034
|
return d;
|
|
2035
2035
|
}
|
|
2036
2036
|
/**
|
|
2037
|
-
*
|
|
2037
|
+
* How much your position has gained or lost as a percentage since you opened it. Range: Unbounded (percentage).
|
|
2038
2038
|
* @param assets Ticker name (ex. SPY, BTC)
|
|
2039
2039
|
*/
|
|
2040
2040
|
function PositionPercentChange(assets) {
|
|
@@ -2043,7 +2043,7 @@ function PositionPercentChange(assets) {
|
|
|
2043
2043
|
return d;
|
|
2044
2044
|
}
|
|
2045
2045
|
/**
|
|
2046
|
-
*
|
|
2046
|
+
* The current dollar value of your position in one or more assets. Range: >= 0.
|
|
2047
2047
|
* @param assets Ticker name (ex. SPY, BTC)
|
|
2048
2048
|
*/
|
|
2049
2049
|
function PositionValue(assets) {
|
|
@@ -2052,7 +2052,7 @@ function PositionValue(assets) {
|
|
|
2052
2052
|
return d;
|
|
2053
2053
|
}
|
|
2054
2054
|
/**
|
|
2055
|
-
*
|
|
2055
|
+
* The closing price from the previous trading session. It already has a one-session offset; wrapping it in Indicator Window Ago adds another lag rather than selecting that same previous close. Range: > 0.
|
|
2056
2056
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
2057
2057
|
*/
|
|
2058
2058
|
function PreviousClosingPrice(asset) {
|
|
@@ -2061,7 +2061,7 @@ function PreviousClosingPrice(asset) {
|
|
|
2061
2061
|
return d;
|
|
2062
2062
|
}
|
|
2063
2063
|
/**
|
|
2064
|
-
*
|
|
2064
|
+
* The current market price of any asset. Range: > 0.
|
|
2065
2065
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
2066
2066
|
*/
|
|
2067
2067
|
function Price(asset) {
|
|
@@ -2070,7 +2070,7 @@ function Price(asset) {
|
|
|
2070
2070
|
return d;
|
|
2071
2071
|
}
|
|
2072
2072
|
/**
|
|
2073
|
-
*
|
|
2073
|
+
* The dollar change in price since market open. Range: Unbounded.
|
|
2074
2074
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
2075
2075
|
*/
|
|
2076
2076
|
function PriceChangeSinceOpen(asset) {
|
|
@@ -2079,7 +2079,7 @@ function PriceChangeSinceOpen(asset) {
|
|
|
2079
2079
|
return d;
|
|
2080
2080
|
}
|
|
2081
2081
|
/**
|
|
2082
|
-
*
|
|
2082
|
+
* The mean absolute deviation of an asset's price over a window. Similar to standard deviation but less sensitive to outliers. Range: >= 0.
|
|
2083
2083
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
2084
2084
|
* @param length Length of time
|
|
2085
2085
|
* @param interval Unit of time
|
|
@@ -2091,7 +2091,7 @@ function PriceMeanAbsoluteDeviation(asset, length = 30, interval = "Day") {
|
|
|
2091
2091
|
return d;
|
|
2092
2092
|
}
|
|
2093
2093
|
/**
|
|
2094
|
-
*
|
|
2094
|
+
* Measures the percentage change in price between the current price and the price N periods ago. Range: Unbounded (percentage).
|
|
2095
2095
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
2096
2096
|
* @param length Length of time
|
|
2097
2097
|
* @param interval Unit of time
|
|
@@ -2103,7 +2103,7 @@ function PriceRateOfChange(asset, length = 30, interval = "Day") {
|
|
|
2103
2103
|
return d;
|
|
2104
2104
|
}
|
|
2105
2105
|
/**
|
|
2106
|
-
*
|
|
2106
|
+
* The standard deviation of an asset's closing price over a window. Measures price volatility. Range: >= 0.
|
|
2107
2107
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
2108
2108
|
* @param length Length of time
|
|
2109
2109
|
* @param interval Unit of time
|
|
@@ -2116,7 +2116,7 @@ function PriceStandardDeviation(asset, length = 30, interval = "Day") {
|
|
|
2116
2116
|
}
|
|
2117
2117
|
exports.PriceStdDev = PriceStandardDeviation;
|
|
2118
2118
|
/**
|
|
2119
|
-
*
|
|
2119
|
+
* Exposes the allocation plan that a DynamicRebalance or RebalanceOption action is about to execute, so the strategy condition can decide whether that plan is worthwhile. Range: Drift and turnover are portfolio fractions; cost and benefit metrics are dollar amounts.
|
|
2120
2120
|
* @param metric Reads the prospective plan calculated by DynamicRebalance or RebalanceOption before the strategy condition runs.
|
|
2121
2121
|
*/
|
|
2122
2122
|
function RebalanceDecisionMetric(metric = "netBenefit") {
|
|
@@ -2125,7 +2125,7 @@ function RebalanceDecisionMetric(metric = "netBenefit") {
|
|
|
2125
2125
|
return d;
|
|
2126
2126
|
}
|
|
2127
2127
|
/**
|
|
2128
|
-
*
|
|
2128
|
+
* Measures the speed and magnitude of recent price changes. Oscillates between 0 and 100. Range: 0 to 100.
|
|
2129
2129
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
2130
2130
|
* @param length Length of time
|
|
2131
2131
|
* @param interval Unit of time
|
|
@@ -2138,7 +2138,7 @@ function RelativeStrengthIndex(asset, length = 30, interval = "Day") {
|
|
|
2138
2138
|
}
|
|
2139
2139
|
exports.RSI = RelativeStrengthIndex;
|
|
2140
2140
|
/**
|
|
2141
|
-
*
|
|
2141
|
+
* Current bar volume divided by the average volume of the trailing N completed bars. 1.0 means the bar is trading exactly its recent pace. Range: >= 0 (ratio around 1.0).
|
|
2142
2142
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
2143
2143
|
* @param length Length of time
|
|
2144
2144
|
* @param interval Unit of time
|
|
@@ -2163,7 +2163,7 @@ function SimpleMovingAverage(asset, length = 30, interval = "Day") {
|
|
|
2163
2163
|
}
|
|
2164
2164
|
exports.SMA = SimpleMovingAverage;
|
|
2165
2165
|
/**
|
|
2166
|
-
*
|
|
2166
|
+
* Square root of an indicator.
|
|
2167
2167
|
*/
|
|
2168
2168
|
function SquareRoot(operand) {
|
|
2169
2169
|
const d = { type: "SquareRoot" };
|
|
@@ -2171,7 +2171,7 @@ function SquareRoot(operand) {
|
|
|
2171
2171
|
return d;
|
|
2172
2172
|
}
|
|
2173
2173
|
/**
|
|
2174
|
-
*
|
|
2174
|
+
* Momentum oscillator comparing the close to the high-low range over N bars, with %K smoothing and a %D signal average. Readings above 80 are overbought, below 20 oversold. Range: 0 to 100.
|
|
2175
2175
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
2176
2176
|
* @param length Length of time
|
|
2177
2177
|
* @param interval Unit of time
|
|
@@ -2189,7 +2189,7 @@ function Stochastic(asset, length = 14, interval = "Day", smoothK = 3, smoothD =
|
|
|
2189
2189
|
return d;
|
|
2190
2190
|
}
|
|
2191
2191
|
/**
|
|
2192
|
-
* StockReport
|
|
2192
|
+
* AI stock report rating: a fundamental-strength score from 1 to 5, higher is stronger, synthesizing revenue growth, profitability, balance sheet health, valuation and competitive positioning. Point-in-time: a backtest reads the rating in effect on each date. Works on a named ticker and on CANDIDATE inside a rebalance filter, rank or weight, e.g. gte(StockReport(CANDIDATE), Value(3.5)) for fundamentally strong stocks.
|
|
2193
2193
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
2194
2194
|
*/
|
|
2195
2195
|
function StockReport(asset) {
|
|
@@ -2198,7 +2198,7 @@ function StockReport(asset) {
|
|
|
2198
2198
|
return d;
|
|
2199
2199
|
}
|
|
2200
2200
|
/**
|
|
2201
|
-
*
|
|
2201
|
+
* The total dollar amount across all matching orders within a window. Range: >= 0.
|
|
2202
2202
|
* @param side Matches order events with this side (buy or sell)
|
|
2203
2203
|
* @param orderStatus Matches order events with this status
|
|
2204
2204
|
* @param length Length of time
|
|
@@ -2214,7 +2214,7 @@ function SumOrderAmount(side, orderStatus = "Filled", length = 1, interval = "Da
|
|
|
2214
2214
|
return d;
|
|
2215
2215
|
}
|
|
2216
2216
|
/**
|
|
2217
|
-
*
|
|
2217
|
+
* The total number of shares across all matching orders within a window. Range: >= 0.
|
|
2218
2218
|
* @param side Matches order events with this side (buy or sell)
|
|
2219
2219
|
* @param orderStatus Matches order events with this status
|
|
2220
2220
|
* @param length Length of time
|
|
@@ -2230,7 +2230,7 @@ function SumOrderQuantity(side, orderStatus = "Filled", length = 1, interval = "
|
|
|
2230
2230
|
return d;
|
|
2231
2231
|
}
|
|
2232
2232
|
/**
|
|
2233
|
-
*
|
|
2233
|
+
* ATR trailing band that ratchets with the trend and flips sides on a close through it. The direction line reads +1 in an uptrend, -1 in a downtrend. Range: Price scale (value); +1 / -1 (direction).
|
|
2234
2234
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
2235
2235
|
* @param length Length of time
|
|
2236
2236
|
* @param interval Unit of time
|
|
@@ -2246,7 +2246,7 @@ function Supertrend(asset, length = 10, interval = "Day", multiplier = 3, line =
|
|
|
2246
2246
|
return d;
|
|
2247
2247
|
}
|
|
2248
2248
|
/**
|
|
2249
|
-
*
|
|
2249
|
+
* The sum of the last N accepted observations of the inner indicator. Generic inputs append when the value changes; source-backed inputs use their own observation identities. Length counts retained observations rather than every evaluation tick.
|
|
2250
2250
|
* @param length Length of the rolling window
|
|
2251
2251
|
*/
|
|
2252
2252
|
function TrailingSum(operand, length = 4) {
|
|
@@ -2256,7 +2256,7 @@ function TrailingSum(operand, length = 4) {
|
|
|
2256
2256
|
return d;
|
|
2257
2257
|
}
|
|
2258
2258
|
/**
|
|
2259
|
-
*
|
|
2259
|
+
* The greatest of: current high minus low, |high − previous close|, or |low − previous close|. Measures single-period volatility. Range: >= 0.
|
|
2260
2260
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
2261
2261
|
*/
|
|
2262
2262
|
function TrueRange(asset) {
|
|
@@ -2265,7 +2265,7 @@ function TrueRange(asset) {
|
|
|
2265
2265
|
return d;
|
|
2266
2266
|
}
|
|
2267
2267
|
/**
|
|
2268
|
-
*
|
|
2268
|
+
* The current percentage decline of the asset's market price from the highest price observed by this indicator. Tracks the underlying price independently of position state. Range: 0 to 100 (percentage).
|
|
2269
2269
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
2270
2270
|
*/
|
|
2271
2271
|
function UnderlyingMaxDrawdown(asset) {
|
|
@@ -2274,7 +2274,7 @@ function UnderlyingMaxDrawdown(asset) {
|
|
|
2274
2274
|
return d;
|
|
2275
2275
|
}
|
|
2276
2276
|
/**
|
|
2277
|
-
*
|
|
2277
|
+
* A fixed numeric value. Useful as one side of a comparison.
|
|
2278
2278
|
* @param value Constant value
|
|
2279
2279
|
*/
|
|
2280
2280
|
function Value(value = 0) {
|
|
@@ -2283,7 +2283,7 @@ function Value(value = 0) {
|
|
|
2283
2283
|
return d;
|
|
2284
2284
|
}
|
|
2285
2285
|
/**
|
|
2286
|
-
* Volume
|
|
2286
|
+
* Trading volume for the asset. It is the Fundamental indicator with its metric preset to Volume, on the same pipeline and data sources. Keep the metric at Volume: any other metric returns that fundamental metric instead of volume. Range: >= 0.
|
|
2287
2287
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
2288
2288
|
* @param metric The fundamental metric to use
|
|
2289
2289
|
*/
|
|
@@ -2294,7 +2294,7 @@ function Volume(asset, metric = "volume") {
|
|
|
2294
2294
|
return d;
|
|
2295
2295
|
}
|
|
2296
2296
|
/**
|
|
2297
|
-
*
|
|
2297
|
+
* The average price weighted by volume throughout the trading session. A key intraday benchmark. Range: > 0.
|
|
2298
2298
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
2299
2299
|
*/
|
|
2300
2300
|
function VWAP(asset) {
|
|
@@ -2303,7 +2303,7 @@ function VWAP(asset) {
|
|
|
2303
2303
|
return d;
|
|
2304
2304
|
}
|
|
2305
2305
|
/**
|
|
2306
|
-
*
|
|
2306
|
+
* Momentum oscillator placing the close within the high-low range over N bars, on a -100 to 0 scale. Above -20 is overbought, below -80 oversold. Range: -100 to 0.
|
|
2307
2307
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
2308
2308
|
* @param length Length of time
|
|
2309
2309
|
* @param interval Unit of time
|
|
@@ -2315,7 +2315,7 @@ function WilliamsR(asset, length = 14, interval = "Day") {
|
|
|
2315
2315
|
return d;
|
|
2316
2316
|
}
|
|
2317
2317
|
/**
|
|
2318
|
-
*
|
|
2318
|
+
* The current year.
|
|
2319
2319
|
*/
|
|
2320
2320
|
function Year() {
|
|
2321
2321
|
const d = { type: "Year" };
|