nexustrade 1.21.0 → 1.23.0

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.
@@ -4,14 +4,18 @@ exports.currentLimit = exports.limitOrder = exports.closeOption = exports.greeks
4
4
  exports.geneUniversePipelineFilter = exports.geneSelectTopLimit = exports.geneMaxSpreadPct = exports.geneDteBracket = exports.geneStrikeDistance = exports.geneOptionDelta = exports.geneExposurePolicy = exports.geneAllocationPolicy = exports.geneStructureKind = exports.geneStopLossPct = exports.geneTakeProfitPct = exports.geneRollTriggerDte = exports.geneDeploymentPct = exports.geneTotalBudgetPct = exports.geneAllocationPct = exports.geneBuyingPowerPct = exports.geneRankSignal = exports.geneConditionThreshold = exports.geneConditionWindowLength = exports.geneEntryCooldownDays = exports.geneReplaceExitCondition = exports.geneExitCondition = exports.geneReplaceEntryCondition = exports.geneEntryCondition = exports.geneSubject = exports.optimization = exports.walkForward = exports.backtest = exports.SMA = exports.RSI = exports.PriceStdDev = exports.EMA = exports.BBand = exports.portfolio = exports.sessionFlatten = exports.strategy = exports.goodForMinutes = exports.goodForDay = exports.minimumNetCredit = exports.maximumNetDebit = exports.unitPriceLimit = void 0;
5
5
  exports.universe = universe;
6
6
  exports.AbsoluteValue = AbsoluteValue;
7
+ exports.AccumulationDistribution = AccumulationDistribution;
7
8
  exports.AverageDirectionalIndex = AverageDirectionalIndex;
8
9
  exports.AverageTrueRange = AverageTrueRange;
9
10
  exports.BearishFairValueGap = BearishFairValueGap;
10
11
  exports.BollingerBand = BollingerBand;
11
12
  exports.BullishFairValueGap = BullishFairValueGap;
12
13
  exports.BuyingPower = BuyingPower;
14
+ exports.ChaikinMoneyFlow = ChaikinMoneyFlow;
15
+ exports.CommodityChannelIndex = CommodityChannelIndex;
13
16
  exports.CompoundAnnualGrowthRate = CompoundAnnualGrowthRate;
14
17
  exports.ConsecutiveTrue = ConsecutiveTrue;
18
+ exports.Correlation = Correlation;
15
19
  exports.CountTrue = CountTrue;
16
20
  exports.CrossAbove = CrossAbove;
17
21
  exports.CrossBelow = CrossBelow;
@@ -31,6 +35,7 @@ exports.DaysSinceStrategyFired = DaysSinceStrategyFired;
31
35
  exports.DaysSinceTransaction = DaysSinceTransaction;
32
36
  exports.DaysUntilEarnings = DaysUntilEarnings;
33
37
  exports.Divide = Divide;
38
+ exports.DonchianChannel = DonchianChannel;
34
39
  exports.Economic = Economic;
35
40
  exports.ExponentialMovingAverage = ExponentialMovingAverage;
36
41
  exports.Exponentiation = Exponentiation;
@@ -38,6 +43,7 @@ exports.Fundamental = Fundamental;
38
43
  exports.GapPercentage = GapPercentage;
39
44
  exports.GapSize = GapSize;
40
45
  exports.HighOfDay = HighOfDay;
46
+ exports.IchimokuCloud = IchimokuCloud;
41
47
  exports.ImpliedVolatility = ImpliedVolatility;
42
48
  exports.Index = Index;
43
49
  exports.IndicatorAtEntry = IndicatorAtEntry;
@@ -58,6 +64,7 @@ exports.IsNotAsset = IsNotAsset;
58
64
  exports.IVHVRatio = IVHVRatio;
59
65
  exports.IVPercentile = IVPercentile;
60
66
  exports.IVRank = IVRank;
67
+ exports.KeltnerChannel = KeltnerChannel;
61
68
  exports.LastOrderPrice = LastOrderPrice;
62
69
  exports.Log = Log;
63
70
  exports.LowOfDay = LowOfDay;
@@ -74,10 +81,12 @@ exports.MinutesSinceAlert = MinutesSinceAlert;
74
81
  exports.MinutesSinceOptionOrder = MinutesSinceOptionOrder;
75
82
  exports.MinutesSinceOrder = MinutesSinceOrder;
76
83
  exports.MinutesUntilClose = MinutesUntilClose;
84
+ exports.MoneyFlowIndex = MoneyFlowIndex;
77
85
  exports.Month = Month;
78
86
  exports.MovingAverageConvergenceDivergence = MovingAverageConvergenceDivergence;
79
87
  exports.Multiply = Multiply;
80
88
  exports.Negative = Negative;
89
+ exports.OnBalanceVolume = OnBalanceVolume;
81
90
  exports.OpeningPrice = OpeningPrice;
82
91
  exports.OptionCollateral = OptionCollateral;
83
92
  exports.OptionDaysHeld = OptionDaysHeld;
@@ -92,6 +101,7 @@ exports.OptionRealizedPremium = OptionRealizedPremium;
92
101
  exports.OptionSpreadCount = OptionSpreadCount;
93
102
  exports.OptionSpreadEntryPrice = OptionSpreadEntryPrice;
94
103
  exports.OptionUnrealizedPnL = OptionUnrealizedPnL;
104
+ exports.ParabolicSar = ParabolicSar;
95
105
  exports.Plus = Plus;
96
106
  exports.PoliticalTrades = PoliticalTrades;
97
107
  exports.PortfolioValue = PortfolioValue;
@@ -110,15 +120,18 @@ exports.RelativeStrengthIndex = RelativeStrengthIndex;
110
120
  exports.RelativeVolume = RelativeVolume;
111
121
  exports.SimpleMovingAverage = SimpleMovingAverage;
112
122
  exports.SquareRoot = SquareRoot;
123
+ exports.Stochastic = Stochastic;
113
124
  exports.StockReport = StockReport;
114
125
  exports.SumOrderAmount = SumOrderAmount;
115
126
  exports.SumOrderQuantity = SumOrderQuantity;
127
+ exports.Supertrend = Supertrend;
116
128
  exports.TrailingSum = TrailingSum;
117
129
  exports.TrueRange = TrueRange;
118
130
  exports.UnderlyingMaxDrawdown = UnderlyingMaxDrawdown;
119
131
  exports.Value = Value;
120
132
  exports.Volume = Volume;
121
133
  exports.VWAP = VWAP;
134
+ exports.WilliamsR = WilliamsR;
122
135
  exports.Year = Year;
123
136
  const portfolio_ts_1 = require("../portfolio.js");
124
137
  exports.CANDIDATE = { __candidate: true };
@@ -500,6 +513,17 @@ function AbsoluteValue(operand) {
500
513
  d.indicators = [operand];
501
514
  return d;
502
515
  }
516
+ /**
517
+ * AccumulationDistribution indicator.
518
+ * @param asset Ticker name (ex. SPY, BTC)
519
+ * @param interval Bar interval the line is accumulated on
520
+ */
521
+ function AccumulationDistribution(asset, interval = "Day") {
522
+ const d = { type: "AccumulationDistribution" };
523
+ setAsset(d, "targetAsset", asset);
524
+ d["interval"] = interval;
525
+ return d;
526
+ }
503
527
  /**
504
528
  * AverageDirectionalIndex indicator.
505
529
  * @param asset Ticker name (ex. SPY, BTC)
@@ -566,6 +590,32 @@ function BuyingPower() {
566
590
  const d = { type: "BuyingPower" };
567
591
  return d;
568
592
  }
593
+ /**
594
+ * ChaikinMoneyFlow indicator.
595
+ * @param asset Ticker name (ex. SPY, BTC)
596
+ * @param length Length of time
597
+ * @param interval Unit of time
598
+ */
599
+ function ChaikinMoneyFlow(asset, length = 20, interval = "Day") {
600
+ const d = { type: "ChaikinMoneyFlow" };
601
+ setAsset(d, "targetAsset", asset);
602
+ d.window = { length: length, interval: interval };
603
+ return d;
604
+ }
605
+ /**
606
+ * CommodityChannelIndex indicator.
607
+ * @param asset Ticker name (ex. SPY, BTC)
608
+ * @param length Length of time
609
+ * @param interval Unit of time
610
+ * @param constant Divisor scaling the mean deviation
611
+ */
612
+ function CommodityChannelIndex(asset, length = 20, interval = "Day", constant = 0.015) {
613
+ const d = { type: "CommodityChannelIndex" };
614
+ setAsset(d, "targetAsset", asset);
615
+ d["constant"] = constant;
616
+ d.window = { length: length, interval: interval };
617
+ return d;
618
+ }
569
619
  /**
570
620
  * CompoundAnnualGrowthRate indicator.
571
621
  * @param asset Ticker name (ex. SPY, BTC)
@@ -591,6 +641,18 @@ function ConsecutiveTrue(condition, length = 1, interval = "Day") {
591
641
  d.window = { length: length, interval: interval };
592
642
  return d;
593
643
  }
644
+ /**
645
+ * Correlation indicator.
646
+ * @param operands Sub-indicators this compound operates on.
647
+ * @param length Length of time
648
+ * @param interval Unit of time
649
+ */
650
+ function Correlation(operands, length = 60, interval = "Day") {
651
+ const d = { type: "Correlation" };
652
+ d.indicators = operands;
653
+ d.window = { length: length, interval: interval };
654
+ return d;
655
+ }
594
656
  /**
595
657
  * CountTrue indicator.
596
658
  * @param condition Condition evaluated over the window.
@@ -767,6 +829,20 @@ function Divide(left, right) {
767
829
  d.indicators = [left, right];
768
830
  return d;
769
831
  }
832
+ /**
833
+ * DonchianChannel indicator.
834
+ * @param asset Ticker name (ex. SPY, BTC)
835
+ * @param length Length of time
836
+ * @param interval Unit of time
837
+ * @param line Which Donchian line to evaluate
838
+ */
839
+ function DonchianChannel(asset, length = 20, interval = "Day", line = "upper") {
840
+ const d = { type: "DonchianChannel" };
841
+ setAsset(d, "targetAsset", asset);
842
+ d["line"] = line;
843
+ d.window = { length: length, interval: interval };
844
+ return d;
845
+ }
770
846
  /**
771
847
  * Economic indicator.
772
848
  * @param metric The economic indicator to use
@@ -837,6 +913,22 @@ function HighOfDay(asset) {
837
913
  setAsset(d, "targetAsset", asset);
838
914
  return d;
839
915
  }
916
+ /**
917
+ * IchimokuCloud indicator.
918
+ * @param asset Ticker name (ex. SPY, BTC)
919
+ * @param length Length of time
920
+ * @param interval Unit of time
921
+ * @param spanLength Senkou B lookback in bars (Kijun scales from conversion)
922
+ * @param line Which Ichimoku line to evaluate (unshifted)
923
+ */
924
+ function IchimokuCloud(asset, length = 9, interval = "Day", spanLength = 52, line = "tenkan") {
925
+ const d = { type: "IchimokuCloud" };
926
+ setAsset(d, "targetAsset", asset);
927
+ d["spanLength"] = spanLength;
928
+ d["line"] = line;
929
+ d.window = { length: length, interval: interval };
930
+ return d;
931
+ }
840
932
  /**
841
933
  * ImpliedVolatility indicator.
842
934
  * @param asset Ticker name (ex. SPY, BTC)
@@ -1059,6 +1151,22 @@ function IVRank(asset, length = 252, interval = "Day") {
1059
1151
  d.window = { length: length, interval: interval };
1060
1152
  return d;
1061
1153
  }
1154
+ /**
1155
+ * KeltnerChannel indicator.
1156
+ * @param asset Ticker name (ex. SPY, BTC)
1157
+ * @param length Length of time
1158
+ * @param interval Unit of time
1159
+ * @param multiplier How many ATRs from the EMA midline
1160
+ * @param line Which Keltner line to evaluate
1161
+ */
1162
+ function KeltnerChannel(asset, length = 20, interval = "Day", multiplier = 2, line = "middle") {
1163
+ const d = { type: "KeltnerChannel" };
1164
+ setAsset(d, "targetAsset", asset);
1165
+ d["multiplier"] = multiplier;
1166
+ d["line"] = line;
1167
+ d.window = { length: length, interval: interval };
1168
+ return d;
1169
+ }
1062
1170
  /**
1063
1171
  * LastOrderPrice indicator.
1064
1172
  * @param asset Ticker name (ex. SPY, BTC)
@@ -1228,6 +1336,18 @@ function MinutesUntilClose() {
1228
1336
  const d = { type: "MinutesUntilClose" };
1229
1337
  return d;
1230
1338
  }
1339
+ /**
1340
+ * MoneyFlowIndex indicator.
1341
+ * @param asset Ticker name (ex. SPY, BTC)
1342
+ * @param length Length of time
1343
+ * @param interval Unit of time
1344
+ */
1345
+ function MoneyFlowIndex(asset, length = 14, interval = "Day") {
1346
+ const d = { type: "MoneyFlowIndex" };
1347
+ setAsset(d, "targetAsset", asset);
1348
+ d.window = { length: length, interval: interval };
1349
+ return d;
1350
+ }
1231
1351
  /**
1232
1352
  * Month indicator.
1233
1353
  */
@@ -1270,6 +1390,17 @@ function Negative(operand) {
1270
1390
  d.indicators = [operand];
1271
1391
  return d;
1272
1392
  }
1393
+ /**
1394
+ * OnBalanceVolume indicator.
1395
+ * @param asset Ticker name (ex. SPY, BTC)
1396
+ * @param interval Bar interval the volume is accumulated on
1397
+ */
1398
+ function OnBalanceVolume(asset, interval = "Day") {
1399
+ const d = { type: "OnBalanceVolume" };
1400
+ setAsset(d, "targetAsset", asset);
1401
+ d["interval"] = interval;
1402
+ return d;
1403
+ }
1273
1404
  /**
1274
1405
  * OpeningPrice indicator.
1275
1406
  * @param asset Ticker name (ex. SPY, BTC)
@@ -1470,6 +1601,21 @@ function OptionUnrealizedPnL(underlying, optionType, direction, spreadType) {
1470
1601
  d["spreadType"] = spreadType;
1471
1602
  return d;
1472
1603
  }
1604
+ /**
1605
+ * ParabolicSar indicator.
1606
+ * @param asset Ticker name (ex. SPY, BTC)
1607
+ * @param interval Bar interval the SAR trails on
1608
+ * @param step AF increment per new extreme
1609
+ * @param maximum AF cap
1610
+ */
1611
+ function ParabolicSar(asset, interval = "Day", step = 0.02, maximum = 0.2) {
1612
+ const d = { type: "ParabolicSar" };
1613
+ setAsset(d, "targetAsset", asset);
1614
+ d["interval"] = interval;
1615
+ d["step"] = step;
1616
+ d["maximum"] = maximum;
1617
+ return d;
1618
+ }
1473
1619
  /**
1474
1620
  * Plus indicator.
1475
1621
  */
@@ -1661,6 +1807,24 @@ function SquareRoot(operand) {
1661
1807
  d.indicators = [operand];
1662
1808
  return d;
1663
1809
  }
1810
+ /**
1811
+ * Stochastic indicator.
1812
+ * @param asset Ticker name (ex. SPY, BTC)
1813
+ * @param length Length of time
1814
+ * @param interval Unit of time
1815
+ * @param smoothK Moving-average length applied to raw %K
1816
+ * @param smoothD Moving-average length applied to smoothed %K
1817
+ * @param line Which stochastic line to evaluate
1818
+ */
1819
+ function Stochastic(asset, length = 14, interval = "Day", smoothK = 3, smoothD = 3, line = "k") {
1820
+ const d = { type: "Stochastic" };
1821
+ setAsset(d, "targetAsset", asset);
1822
+ d["smoothK"] = smoothK;
1823
+ d["smoothD"] = smoothD;
1824
+ d["line"] = line;
1825
+ d.window = { length: length, interval: interval };
1826
+ return d;
1827
+ }
1664
1828
  /**
1665
1829
  * StockReport indicator.
1666
1830
  * @param asset Ticker name (ex. SPY, BTC)
@@ -1702,6 +1866,22 @@ function SumOrderQuantity(side, orderStatus = "Filled", length = 1, interval = "
1702
1866
  d.window = { length: length, interval: interval };
1703
1867
  return d;
1704
1868
  }
1869
+ /**
1870
+ * Supertrend indicator.
1871
+ * @param asset Ticker name (ex. SPY, BTC)
1872
+ * @param length Length of time
1873
+ * @param interval Unit of time
1874
+ * @param multiplier How many ATRs from HL2
1875
+ * @param line Band value or trend direction (+1 up, -1 down)
1876
+ */
1877
+ function Supertrend(asset, length = 10, interval = "Day", multiplier = 3, line = "value") {
1878
+ const d = { type: "Supertrend" };
1879
+ setAsset(d, "targetAsset", asset);
1880
+ d["multiplier"] = multiplier;
1881
+ d["line"] = line;
1882
+ d.window = { length: length, interval: interval };
1883
+ return d;
1884
+ }
1705
1885
  /**
1706
1886
  * TrailingSum indicator.
1707
1887
  * @param length Length of the rolling window
@@ -1759,6 +1939,18 @@ function VWAP(asset) {
1759
1939
  setAsset(d, "targetAsset", asset);
1760
1940
  return d;
1761
1941
  }
1942
+ /**
1943
+ * WilliamsR indicator.
1944
+ * @param asset Ticker name (ex. SPY, BTC)
1945
+ * @param length Length of time
1946
+ * @param interval Unit of time
1947
+ */
1948
+ function WilliamsR(asset, length = 14, interval = "Day") {
1949
+ const d = { type: "WilliamsR" };
1950
+ setAsset(d, "targetAsset", asset);
1951
+ d.window = { length: length, interval: interval };
1952
+ return d;
1953
+ }
1762
1954
  /**
1763
1955
  * Year indicator.
1764
1956
  */
@@ -678,6 +678,12 @@ export declare const portfolio: (name: string, strategies: Strategy[], options?:
678
678
  * AbsoluteValue indicator.
679
679
  */
680
680
  export declare function AbsoluteValue(operand: Indicator): Indicator;
681
+ /**
682
+ * AccumulationDistribution indicator.
683
+ * @param asset Ticker name (ex. SPY, BTC)
684
+ * @param interval Bar interval the line is accumulated on
685
+ */
686
+ export declare function AccumulationDistribution(asset: AssetArg, interval?: Interval): Indicator;
681
687
  /**
682
688
  * AverageDirectionalIndex indicator.
683
689
  * @param asset Ticker name (ex. SPY, BTC)
@@ -716,6 +722,21 @@ export declare function BullishFairValueGap(asset: AssetArg): Indicator;
716
722
  * BuyingPower indicator.
717
723
  */
718
724
  export declare function BuyingPower(): Indicator;
725
+ /**
726
+ * ChaikinMoneyFlow indicator.
727
+ * @param asset Ticker name (ex. SPY, BTC)
728
+ * @param length Length of time
729
+ * @param interval Unit of time
730
+ */
731
+ export declare function ChaikinMoneyFlow(asset: AssetArg, length?: number, interval?: Interval): Indicator;
732
+ /**
733
+ * CommodityChannelIndex indicator.
734
+ * @param asset Ticker name (ex. SPY, BTC)
735
+ * @param length Length of time
736
+ * @param interval Unit of time
737
+ * @param constant Divisor scaling the mean deviation
738
+ */
739
+ export declare function CommodityChannelIndex(asset: AssetArg, length?: number, interval?: Interval, constant?: number): Indicator;
719
740
  /**
720
741
  * CompoundAnnualGrowthRate indicator.
721
742
  * @param asset Ticker name (ex. SPY, BTC)
@@ -730,6 +751,13 @@ export declare function CompoundAnnualGrowthRate(asset: AssetArg, metric: Fundam
730
751
  * @param interval Unit of time
731
752
  */
732
753
  export declare function ConsecutiveTrue(condition: Condition, length?: number, interval?: Interval): Indicator;
754
+ /**
755
+ * Correlation indicator.
756
+ * @param operands Sub-indicators this compound operates on.
757
+ * @param length Length of time
758
+ * @param interval Unit of time
759
+ */
760
+ export declare function Correlation(operands: Indicator[], length?: number, interval?: Interval): Indicator;
733
761
  /**
734
762
  * CountTrue indicator.
735
763
  * @param condition Condition evaluated over the window.
@@ -826,6 +854,14 @@ export declare function DaysUntilEarnings(asset: AssetArg): Indicator;
826
854
  * Divide indicator.
827
855
  */
828
856
  export declare function Divide(left: Indicator, right: Indicator): Indicator;
857
+ /**
858
+ * DonchianChannel indicator.
859
+ * @param asset Ticker name (ex. SPY, BTC)
860
+ * @param length Length of time
861
+ * @param interval Unit of time
862
+ * @param line Which Donchian line to evaluate
863
+ */
864
+ export declare function DonchianChannel(asset: AssetArg, length?: number, interval?: Interval, line?: "upper" | "lower" | "middle"): Indicator;
829
865
  /**
830
866
  * Economic indicator.
831
867
  * @param metric The economic indicator to use
@@ -865,6 +901,15 @@ export declare function GapSize(asset: AssetArg): Indicator;
865
901
  * @param asset Ticker name (ex. SPY, BTC)
866
902
  */
867
903
  export declare function HighOfDay(asset: AssetArg): Indicator;
904
+ /**
905
+ * IchimokuCloud indicator.
906
+ * @param asset Ticker name (ex. SPY, BTC)
907
+ * @param length Length of time
908
+ * @param interval Unit of time
909
+ * @param spanLength Senkou B lookback in bars (Kijun scales from conversion)
910
+ * @param line Which Ichimoku line to evaluate (unshifted)
911
+ */
912
+ export declare function IchimokuCloud(asset: AssetArg, length?: number, interval?: Interval, spanLength?: number, line?: "tenkan" | "kijun" | "senkouA" | "senkouB" | "chikou"): Indicator;
868
913
  /**
869
914
  * ImpliedVolatility indicator.
870
915
  * @param asset Ticker name (ex. SPY, BTC)
@@ -986,6 +1031,15 @@ export declare function IVPercentile(asset: AssetArg, length?: number, interval?
986
1031
  * @param interval Unit of time
987
1032
  */
988
1033
  export declare function IVRank(asset: AssetArg, length?: number, interval?: Interval): Indicator;
1034
+ /**
1035
+ * KeltnerChannel indicator.
1036
+ * @param asset Ticker name (ex. SPY, BTC)
1037
+ * @param length Length of time
1038
+ * @param interval Unit of time
1039
+ * @param multiplier How many ATRs from the EMA midline
1040
+ * @param line Which Keltner line to evaluate
1041
+ */
1042
+ export declare function KeltnerChannel(asset: AssetArg, length?: number, interval?: Interval, multiplier?: number, line?: "upper" | "middle" | "lower"): Indicator;
989
1043
  /**
990
1044
  * LastOrderPrice indicator.
991
1045
  * @param asset Ticker name (ex. SPY, BTC)
@@ -1078,6 +1132,13 @@ export declare function MinutesSinceOrder(assets: AssetArg | AssetArg[], side: S
1078
1132
  * MinutesUntilClose indicator.
1079
1133
  */
1080
1134
  export declare function MinutesUntilClose(): Indicator;
1135
+ /**
1136
+ * MoneyFlowIndex indicator.
1137
+ * @param asset Ticker name (ex. SPY, BTC)
1138
+ * @param length Length of time
1139
+ * @param interval Unit of time
1140
+ */
1141
+ export declare function MoneyFlowIndex(asset: AssetArg, length?: number, interval?: Interval): Indicator;
1081
1142
  /**
1082
1143
  * Month indicator.
1083
1144
  */
@@ -1100,6 +1161,12 @@ export declare function Multiply(left: Indicator, right: Indicator): Indicator;
1100
1161
  * Negative indicator.
1101
1162
  */
1102
1163
  export declare function Negative(operand: Indicator): Indicator;
1164
+ /**
1165
+ * OnBalanceVolume indicator.
1166
+ * @param asset Ticker name (ex. SPY, BTC)
1167
+ * @param interval Bar interval the volume is accumulated on
1168
+ */
1169
+ export declare function OnBalanceVolume(asset: AssetArg, interval?: Interval): Indicator;
1103
1170
  /**
1104
1171
  * OpeningPrice indicator.
1105
1172
  * @param asset Ticker name (ex. SPY, BTC)
@@ -1206,6 +1273,14 @@ export declare function OptionSpreadEntryPrice(underlying: string, optionType: O
1206
1273
  * @param spreadType Filter by spread type. Leave empty for all.
1207
1274
  */
1208
1275
  export declare function OptionUnrealizedPnL(underlying: string, optionType: OptionType, direction: OptionDirection, spreadType: OptionSpreadType): Indicator;
1276
+ /**
1277
+ * ParabolicSar indicator.
1278
+ * @param asset Ticker name (ex. SPY, BTC)
1279
+ * @param interval Bar interval the SAR trails on
1280
+ * @param step AF increment per new extreme
1281
+ * @param maximum AF cap
1282
+ */
1283
+ export declare function ParabolicSar(asset: AssetArg, interval?: Interval, step?: number, maximum?: number): Indicator;
1209
1284
  /**
1210
1285
  * Plus indicator.
1211
1286
  */
@@ -1314,6 +1389,16 @@ export declare const SMA: typeof SimpleMovingAverage;
1314
1389
  * SquareRoot indicator.
1315
1390
  */
1316
1391
  export declare function SquareRoot(operand: Indicator): Indicator;
1392
+ /**
1393
+ * Stochastic indicator.
1394
+ * @param asset Ticker name (ex. SPY, BTC)
1395
+ * @param length Length of time
1396
+ * @param interval Unit of time
1397
+ * @param smoothK Moving-average length applied to raw %K
1398
+ * @param smoothD Moving-average length applied to smoothed %K
1399
+ * @param line Which stochastic line to evaluate
1400
+ */
1401
+ export declare function Stochastic(asset: AssetArg, length?: number, interval?: Interval, smoothK?: number, smoothD?: number, line?: "k" | "d"): Indicator;
1317
1402
  /**
1318
1403
  * StockReport indicator.
1319
1404
  * @param asset Ticker name (ex. SPY, BTC)
@@ -1337,6 +1422,15 @@ export declare function SumOrderAmount(side: Side, orderStatus?: OrderStatus, le
1337
1422
  * @param assets Ticker name (ex. SPY, BTC)
1338
1423
  */
1339
1424
  export declare function SumOrderQuantity(side: Side, orderStatus?: OrderStatus, length?: number, interval?: Interval, assets?: AssetArg | AssetArg[]): Indicator;
1425
+ /**
1426
+ * Supertrend indicator.
1427
+ * @param asset Ticker name (ex. SPY, BTC)
1428
+ * @param length Length of time
1429
+ * @param interval Unit of time
1430
+ * @param multiplier How many ATRs from HL2
1431
+ * @param line Band value or trend direction (+1 up, -1 down)
1432
+ */
1433
+ export declare function Supertrend(asset: AssetArg, length?: number, interval?: Interval, multiplier?: number, line?: "value" | "direction"): Indicator;
1340
1434
  /**
1341
1435
  * TrailingSum indicator.
1342
1436
  * @param length Length of the rolling window
@@ -1368,11 +1462,18 @@ export declare function Volume(asset: AssetArg, metric?: FundamentalMetric): Ind
1368
1462
  * @param asset Ticker name (ex. SPY, BTC)
1369
1463
  */
1370
1464
  export declare function VWAP(asset: AssetArg): Indicator;
1465
+ /**
1466
+ * WilliamsR indicator.
1467
+ * @param asset Ticker name (ex. SPY, BTC)
1468
+ * @param length Length of time
1469
+ * @param interval Unit of time
1470
+ */
1471
+ export declare function WilliamsR(asset: AssetArg, length?: number, interval?: Interval): Indicator;
1371
1472
  /**
1372
1473
  * Year indicator.
1373
1474
  */
1374
1475
  export declare function Year(): Indicator;
1375
- export type FitnessFunction = "sharpeRatio" | "sortinoRatio" | "maxDrawdown" | "avgDrawdown" | "percentChange" | "dollarsSold" | "ulcerPerformanceIndex" | "participationRate" | "distinctUnderlyingsTraded" | "medianDeployment";
1476
+ export type FitnessFunction = "sharpeRatio" | "sortinoRatio" | "winRate" | "profitFactor" | "calmarRatio" | "maxDrawdown" | "avgDrawdown" | "percentChange" | "dollarsSold" | "ulcerPerformanceIndex" | "participationRate" | "distinctUnderlyingsTraded" | "medianDeployment";
1376
1477
  export interface FeeAmount {
1377
1478
  amount: number;
1378
1479
  type: "percent" | "dollars";
@@ -1459,7 +1560,7 @@ export interface WalkForwardConfig {
1459
1560
  trainingPercent?: number;
1460
1561
  /** Inner rolling window overlap percent (default 50). Range 0..95. */
1461
1562
  windowOverlapPercent?: number;
1462
- fitnessFunctions?: ("sharpeRatio" | "sortinoRatio" | "maxDrawdown" | "avgDrawdown" | "percentChange" | "dollarsSold" | "ulcerPerformanceIndex" | "participationRate" | "distinctUnderlyingsTraded" | "medianDeployment")[];
1563
+ fitnessFunctions?: ("sharpeRatio" | "sortinoRatio" | "winRate" | "profitFactor" | "calmarRatio" | "maxDrawdown" | "avgDrawdown" | "percentChange" | "dollarsSold" | "ulcerPerformanceIndex" | "participationRate" | "distinctUnderlyingsTraded" | "medianDeployment")[];
1463
1564
  /** Winner selection policy (objectives, constraints, tieBreakers). Applies to sweep leaderboard and fold winner selection. For GA WF, also sets NSGA-II activity constraints when fold_selection_policy is omitted. */
1464
1565
  selectionPolicy?: SelectionPolicy;
1465
1566
  /** Explicit fold winner selection policy. Overrides selection_policy for fold winner pick. When set, train→validation degradation penalty defaults to 0.5 unless degradation_penalty is set. */
@@ -1501,8 +1602,8 @@ export interface OptimizationConfig {
1501
1602
  startDate: string;
1502
1603
  /** Optimization end date (ISO format, e.g. 2024-12-31). Minute selected range plus minute-indicator warmup cannot exceed 730 days of minute data. */
1503
1604
  endDate: string;
1504
- /** Fitness functions: sharpeRatio, sortinoRatio, maxDrawdown, avgDrawdown, percentChange, dollarsSold, ulcerPerformanceIndex, participationRate, distinctUnderlyingsTraded, medianDeployment */
1505
- fitnessFunctions?: ("sharpeRatio" | "sortinoRatio" | "maxDrawdown" | "avgDrawdown" | "percentChange" | "dollarsSold" | "ulcerPerformanceIndex" | "participationRate" | "distinctUnderlyingsTraded" | "medianDeployment")[];
1605
+ /** Fitness functions: sharpeRatio, sortinoRatio, winRate, profitFactor, calmarRatio, maxDrawdown, avgDrawdown, percentChange, dollarsSold, ulcerPerformanceIndex, participationRate, distinctUnderlyingsTraded, medianDeployment */
1606
+ fitnessFunctions?: ("sharpeRatio" | "sortinoRatio" | "winRate" | "profitFactor" | "calmarRatio" | "maxDrawdown" | "avgDrawdown" | "percentChange" | "dollarsSold" | "ulcerPerformanceIndex" | "participationRate" | "distinctUnderlyingsTraded" | "medianDeployment")[];
1506
1607
  /** Population size for genetic algorithm (default 6, range 3-12) Range 3..12. */
1507
1608
  populationSize?: number;
1508
1609
  /** Number of generations (default 6, max 10) Range 1..10. */
@@ -322,6 +322,17 @@ export function AbsoluteValue(operand) {
322
322
  d.indicators = [operand];
323
323
  return d;
324
324
  }
325
+ /**
326
+ * AccumulationDistribution indicator.
327
+ * @param asset Ticker name (ex. SPY, BTC)
328
+ * @param interval Bar interval the line is accumulated on
329
+ */
330
+ export function AccumulationDistribution(asset, interval = "Day") {
331
+ const d = { type: "AccumulationDistribution" };
332
+ setAsset(d, "targetAsset", asset);
333
+ d["interval"] = interval;
334
+ return d;
335
+ }
325
336
  /**
326
337
  * AverageDirectionalIndex indicator.
327
338
  * @param asset Ticker name (ex. SPY, BTC)
@@ -388,6 +399,32 @@ export function BuyingPower() {
388
399
  const d = { type: "BuyingPower" };
389
400
  return d;
390
401
  }
402
+ /**
403
+ * ChaikinMoneyFlow indicator.
404
+ * @param asset Ticker name (ex. SPY, BTC)
405
+ * @param length Length of time
406
+ * @param interval Unit of time
407
+ */
408
+ export function ChaikinMoneyFlow(asset, length = 20, interval = "Day") {
409
+ const d = { type: "ChaikinMoneyFlow" };
410
+ setAsset(d, "targetAsset", asset);
411
+ d.window = { length: length, interval: interval };
412
+ return d;
413
+ }
414
+ /**
415
+ * CommodityChannelIndex indicator.
416
+ * @param asset Ticker name (ex. SPY, BTC)
417
+ * @param length Length of time
418
+ * @param interval Unit of time
419
+ * @param constant Divisor scaling the mean deviation
420
+ */
421
+ export function CommodityChannelIndex(asset, length = 20, interval = "Day", constant = 0.015) {
422
+ const d = { type: "CommodityChannelIndex" };
423
+ setAsset(d, "targetAsset", asset);
424
+ d["constant"] = constant;
425
+ d.window = { length: length, interval: interval };
426
+ return d;
427
+ }
391
428
  /**
392
429
  * CompoundAnnualGrowthRate indicator.
393
430
  * @param asset Ticker name (ex. SPY, BTC)
@@ -413,6 +450,18 @@ export function ConsecutiveTrue(condition, length = 1, interval = "Day") {
413
450
  d.window = { length: length, interval: interval };
414
451
  return d;
415
452
  }
453
+ /**
454
+ * Correlation indicator.
455
+ * @param operands Sub-indicators this compound operates on.
456
+ * @param length Length of time
457
+ * @param interval Unit of time
458
+ */
459
+ export function Correlation(operands, length = 60, interval = "Day") {
460
+ const d = { type: "Correlation" };
461
+ d.indicators = operands;
462
+ d.window = { length: length, interval: interval };
463
+ return d;
464
+ }
416
465
  /**
417
466
  * CountTrue indicator.
418
467
  * @param condition Condition evaluated over the window.
@@ -589,6 +638,20 @@ export function Divide(left, right) {
589
638
  d.indicators = [left, right];
590
639
  return d;
591
640
  }
641
+ /**
642
+ * DonchianChannel indicator.
643
+ * @param asset Ticker name (ex. SPY, BTC)
644
+ * @param length Length of time
645
+ * @param interval Unit of time
646
+ * @param line Which Donchian line to evaluate
647
+ */
648
+ export function DonchianChannel(asset, length = 20, interval = "Day", line = "upper") {
649
+ const d = { type: "DonchianChannel" };
650
+ setAsset(d, "targetAsset", asset);
651
+ d["line"] = line;
652
+ d.window = { length: length, interval: interval };
653
+ return d;
654
+ }
592
655
  /**
593
656
  * Economic indicator.
594
657
  * @param metric The economic indicator to use
@@ -659,6 +722,22 @@ export function HighOfDay(asset) {
659
722
  setAsset(d, "targetAsset", asset);
660
723
  return d;
661
724
  }
725
+ /**
726
+ * IchimokuCloud indicator.
727
+ * @param asset Ticker name (ex. SPY, BTC)
728
+ * @param length Length of time
729
+ * @param interval Unit of time
730
+ * @param spanLength Senkou B lookback in bars (Kijun scales from conversion)
731
+ * @param line Which Ichimoku line to evaluate (unshifted)
732
+ */
733
+ export function IchimokuCloud(asset, length = 9, interval = "Day", spanLength = 52, line = "tenkan") {
734
+ const d = { type: "IchimokuCloud" };
735
+ setAsset(d, "targetAsset", asset);
736
+ d["spanLength"] = spanLength;
737
+ d["line"] = line;
738
+ d.window = { length: length, interval: interval };
739
+ return d;
740
+ }
662
741
  /**
663
742
  * ImpliedVolatility indicator.
664
743
  * @param asset Ticker name (ex. SPY, BTC)
@@ -881,6 +960,22 @@ export function IVRank(asset, length = 252, interval = "Day") {
881
960
  d.window = { length: length, interval: interval };
882
961
  return d;
883
962
  }
963
+ /**
964
+ * KeltnerChannel indicator.
965
+ * @param asset Ticker name (ex. SPY, BTC)
966
+ * @param length Length of time
967
+ * @param interval Unit of time
968
+ * @param multiplier How many ATRs from the EMA midline
969
+ * @param line Which Keltner line to evaluate
970
+ */
971
+ export function KeltnerChannel(asset, length = 20, interval = "Day", multiplier = 2, line = "middle") {
972
+ const d = { type: "KeltnerChannel" };
973
+ setAsset(d, "targetAsset", asset);
974
+ d["multiplier"] = multiplier;
975
+ d["line"] = line;
976
+ d.window = { length: length, interval: interval };
977
+ return d;
978
+ }
884
979
  /**
885
980
  * LastOrderPrice indicator.
886
981
  * @param asset Ticker name (ex. SPY, BTC)
@@ -1050,6 +1145,18 @@ export function MinutesUntilClose() {
1050
1145
  const d = { type: "MinutesUntilClose" };
1051
1146
  return d;
1052
1147
  }
1148
+ /**
1149
+ * MoneyFlowIndex indicator.
1150
+ * @param asset Ticker name (ex. SPY, BTC)
1151
+ * @param length Length of time
1152
+ * @param interval Unit of time
1153
+ */
1154
+ export function MoneyFlowIndex(asset, length = 14, interval = "Day") {
1155
+ const d = { type: "MoneyFlowIndex" };
1156
+ setAsset(d, "targetAsset", asset);
1157
+ d.window = { length: length, interval: interval };
1158
+ return d;
1159
+ }
1053
1160
  /**
1054
1161
  * Month indicator.
1055
1162
  */
@@ -1092,6 +1199,17 @@ export function Negative(operand) {
1092
1199
  d.indicators = [operand];
1093
1200
  return d;
1094
1201
  }
1202
+ /**
1203
+ * OnBalanceVolume indicator.
1204
+ * @param asset Ticker name (ex. SPY, BTC)
1205
+ * @param interval Bar interval the volume is accumulated on
1206
+ */
1207
+ export function OnBalanceVolume(asset, interval = "Day") {
1208
+ const d = { type: "OnBalanceVolume" };
1209
+ setAsset(d, "targetAsset", asset);
1210
+ d["interval"] = interval;
1211
+ return d;
1212
+ }
1095
1213
  /**
1096
1214
  * OpeningPrice indicator.
1097
1215
  * @param asset Ticker name (ex. SPY, BTC)
@@ -1292,6 +1410,21 @@ export function OptionUnrealizedPnL(underlying, optionType, direction, spreadTyp
1292
1410
  d["spreadType"] = spreadType;
1293
1411
  return d;
1294
1412
  }
1413
+ /**
1414
+ * ParabolicSar indicator.
1415
+ * @param asset Ticker name (ex. SPY, BTC)
1416
+ * @param interval Bar interval the SAR trails on
1417
+ * @param step AF increment per new extreme
1418
+ * @param maximum AF cap
1419
+ */
1420
+ export function ParabolicSar(asset, interval = "Day", step = 0.02, maximum = 0.2) {
1421
+ const d = { type: "ParabolicSar" };
1422
+ setAsset(d, "targetAsset", asset);
1423
+ d["interval"] = interval;
1424
+ d["step"] = step;
1425
+ d["maximum"] = maximum;
1426
+ return d;
1427
+ }
1295
1428
  /**
1296
1429
  * Plus indicator.
1297
1430
  */
@@ -1483,6 +1616,24 @@ export function SquareRoot(operand) {
1483
1616
  d.indicators = [operand];
1484
1617
  return d;
1485
1618
  }
1619
+ /**
1620
+ * Stochastic indicator.
1621
+ * @param asset Ticker name (ex. SPY, BTC)
1622
+ * @param length Length of time
1623
+ * @param interval Unit of time
1624
+ * @param smoothK Moving-average length applied to raw %K
1625
+ * @param smoothD Moving-average length applied to smoothed %K
1626
+ * @param line Which stochastic line to evaluate
1627
+ */
1628
+ export function Stochastic(asset, length = 14, interval = "Day", smoothK = 3, smoothD = 3, line = "k") {
1629
+ const d = { type: "Stochastic" };
1630
+ setAsset(d, "targetAsset", asset);
1631
+ d["smoothK"] = smoothK;
1632
+ d["smoothD"] = smoothD;
1633
+ d["line"] = line;
1634
+ d.window = { length: length, interval: interval };
1635
+ return d;
1636
+ }
1486
1637
  /**
1487
1638
  * StockReport indicator.
1488
1639
  * @param asset Ticker name (ex. SPY, BTC)
@@ -1524,6 +1675,22 @@ export function SumOrderQuantity(side, orderStatus = "Filled", length = 1, inter
1524
1675
  d.window = { length: length, interval: interval };
1525
1676
  return d;
1526
1677
  }
1678
+ /**
1679
+ * Supertrend indicator.
1680
+ * @param asset Ticker name (ex. SPY, BTC)
1681
+ * @param length Length of time
1682
+ * @param interval Unit of time
1683
+ * @param multiplier How many ATRs from HL2
1684
+ * @param line Band value or trend direction (+1 up, -1 down)
1685
+ */
1686
+ export function Supertrend(asset, length = 10, interval = "Day", multiplier = 3, line = "value") {
1687
+ const d = { type: "Supertrend" };
1688
+ setAsset(d, "targetAsset", asset);
1689
+ d["multiplier"] = multiplier;
1690
+ d["line"] = line;
1691
+ d.window = { length: length, interval: interval };
1692
+ return d;
1693
+ }
1527
1694
  /**
1528
1695
  * TrailingSum indicator.
1529
1696
  * @param length Length of the rolling window
@@ -1581,6 +1748,18 @@ export function VWAP(asset) {
1581
1748
  setAsset(d, "targetAsset", asset);
1582
1749
  return d;
1583
1750
  }
1751
+ /**
1752
+ * WilliamsR indicator.
1753
+ * @param asset Ticker name (ex. SPY, BTC)
1754
+ * @param length Length of time
1755
+ * @param interval Unit of time
1756
+ */
1757
+ export function WilliamsR(asset, length = 14, interval = "Day") {
1758
+ const d = { type: "WilliamsR" };
1759
+ setAsset(d, "targetAsset", asset);
1760
+ d.window = { length: length, interval: interval };
1761
+ return d;
1762
+ }
1584
1763
  /**
1585
1764
  * Year indicator.
1586
1765
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexustrade",
3
- "version": "1.21.0",
3
+ "version": "1.23.0",
4
4
  "description": "Typed TypeScript SDK for NexusTrade portfolio authoring, backtesting, and optimization",
5
5
  "license": "MIT",
6
6
  "author": "Starks Technology",