nexustrade 1.20.0 → 1.22.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,11 +4,15 @@ 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;
|
|
8
|
+
exports.AverageDirectionalIndex = AverageDirectionalIndex;
|
|
7
9
|
exports.AverageTrueRange = AverageTrueRange;
|
|
8
10
|
exports.BearishFairValueGap = BearishFairValueGap;
|
|
9
11
|
exports.BollingerBand = BollingerBand;
|
|
10
12
|
exports.BullishFairValueGap = BullishFairValueGap;
|
|
11
13
|
exports.BuyingPower = BuyingPower;
|
|
14
|
+
exports.ChaikinMoneyFlow = ChaikinMoneyFlow;
|
|
15
|
+
exports.CommodityChannelIndex = CommodityChannelIndex;
|
|
12
16
|
exports.CompoundAnnualGrowthRate = CompoundAnnualGrowthRate;
|
|
13
17
|
exports.ConsecutiveTrue = ConsecutiveTrue;
|
|
14
18
|
exports.CountTrue = CountTrue;
|
|
@@ -30,6 +34,7 @@ exports.DaysSinceStrategyFired = DaysSinceStrategyFired;
|
|
|
30
34
|
exports.DaysSinceTransaction = DaysSinceTransaction;
|
|
31
35
|
exports.DaysUntilEarnings = DaysUntilEarnings;
|
|
32
36
|
exports.Divide = Divide;
|
|
37
|
+
exports.DonchianChannel = DonchianChannel;
|
|
33
38
|
exports.Economic = Economic;
|
|
34
39
|
exports.ExponentialMovingAverage = ExponentialMovingAverage;
|
|
35
40
|
exports.Exponentiation = Exponentiation;
|
|
@@ -37,6 +42,7 @@ exports.Fundamental = Fundamental;
|
|
|
37
42
|
exports.GapPercentage = GapPercentage;
|
|
38
43
|
exports.GapSize = GapSize;
|
|
39
44
|
exports.HighOfDay = HighOfDay;
|
|
45
|
+
exports.IchimokuCloud = IchimokuCloud;
|
|
40
46
|
exports.ImpliedVolatility = ImpliedVolatility;
|
|
41
47
|
exports.Index = Index;
|
|
42
48
|
exports.IndicatorAtEntry = IndicatorAtEntry;
|
|
@@ -57,6 +63,7 @@ exports.IsNotAsset = IsNotAsset;
|
|
|
57
63
|
exports.IVHVRatio = IVHVRatio;
|
|
58
64
|
exports.IVPercentile = IVPercentile;
|
|
59
65
|
exports.IVRank = IVRank;
|
|
66
|
+
exports.KeltnerChannel = KeltnerChannel;
|
|
60
67
|
exports.LastOrderPrice = LastOrderPrice;
|
|
61
68
|
exports.Log = Log;
|
|
62
69
|
exports.LowOfDay = LowOfDay;
|
|
@@ -73,9 +80,12 @@ exports.MinutesSinceAlert = MinutesSinceAlert;
|
|
|
73
80
|
exports.MinutesSinceOptionOrder = MinutesSinceOptionOrder;
|
|
74
81
|
exports.MinutesSinceOrder = MinutesSinceOrder;
|
|
75
82
|
exports.MinutesUntilClose = MinutesUntilClose;
|
|
83
|
+
exports.MoneyFlowIndex = MoneyFlowIndex;
|
|
76
84
|
exports.Month = Month;
|
|
85
|
+
exports.MovingAverageConvergenceDivergence = MovingAverageConvergenceDivergence;
|
|
77
86
|
exports.Multiply = Multiply;
|
|
78
87
|
exports.Negative = Negative;
|
|
88
|
+
exports.OnBalanceVolume = OnBalanceVolume;
|
|
79
89
|
exports.OpeningPrice = OpeningPrice;
|
|
80
90
|
exports.OptionCollateral = OptionCollateral;
|
|
81
91
|
exports.OptionDaysHeld = OptionDaysHeld;
|
|
@@ -90,6 +100,7 @@ exports.OptionRealizedPremium = OptionRealizedPremium;
|
|
|
90
100
|
exports.OptionSpreadCount = OptionSpreadCount;
|
|
91
101
|
exports.OptionSpreadEntryPrice = OptionSpreadEntryPrice;
|
|
92
102
|
exports.OptionUnrealizedPnL = OptionUnrealizedPnL;
|
|
103
|
+
exports.ParabolicSar = ParabolicSar;
|
|
93
104
|
exports.Plus = Plus;
|
|
94
105
|
exports.PoliticalTrades = PoliticalTrades;
|
|
95
106
|
exports.PortfolioValue = PortfolioValue;
|
|
@@ -105,17 +116,21 @@ exports.PriceRateOfChange = PriceRateOfChange;
|
|
|
105
116
|
exports.PriceStandardDeviation = PriceStandardDeviation;
|
|
106
117
|
exports.RebalanceDecisionMetric = RebalanceDecisionMetric;
|
|
107
118
|
exports.RelativeStrengthIndex = RelativeStrengthIndex;
|
|
119
|
+
exports.RelativeVolume = RelativeVolume;
|
|
108
120
|
exports.SimpleMovingAverage = SimpleMovingAverage;
|
|
109
121
|
exports.SquareRoot = SquareRoot;
|
|
122
|
+
exports.Stochastic = Stochastic;
|
|
110
123
|
exports.StockReport = StockReport;
|
|
111
124
|
exports.SumOrderAmount = SumOrderAmount;
|
|
112
125
|
exports.SumOrderQuantity = SumOrderQuantity;
|
|
126
|
+
exports.Supertrend = Supertrend;
|
|
113
127
|
exports.TrailingSum = TrailingSum;
|
|
114
128
|
exports.TrueRange = TrueRange;
|
|
115
129
|
exports.UnderlyingMaxDrawdown = UnderlyingMaxDrawdown;
|
|
116
130
|
exports.Value = Value;
|
|
117
131
|
exports.Volume = Volume;
|
|
118
132
|
exports.VWAP = VWAP;
|
|
133
|
+
exports.WilliamsR = WilliamsR;
|
|
119
134
|
exports.Year = Year;
|
|
120
135
|
const portfolio_ts_1 = require("../portfolio.js");
|
|
121
136
|
exports.CANDIDATE = { __candidate: true };
|
|
@@ -497,6 +512,31 @@ function AbsoluteValue(operand) {
|
|
|
497
512
|
d.indicators = [operand];
|
|
498
513
|
return d;
|
|
499
514
|
}
|
|
515
|
+
/**
|
|
516
|
+
* AccumulationDistribution indicator.
|
|
517
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
518
|
+
* @param interval Bar interval the line is accumulated on
|
|
519
|
+
*/
|
|
520
|
+
function AccumulationDistribution(asset, interval = "Day") {
|
|
521
|
+
const d = { type: "AccumulationDistribution" };
|
|
522
|
+
setAsset(d, "targetAsset", asset);
|
|
523
|
+
d["interval"] = interval;
|
|
524
|
+
return d;
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* AverageDirectionalIndex indicator.
|
|
528
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
529
|
+
* @param length Length of time
|
|
530
|
+
* @param interval Unit of time
|
|
531
|
+
* @param line Which ADX-system line to evaluate
|
|
532
|
+
*/
|
|
533
|
+
function AverageDirectionalIndex(asset, length = 14, interval = "Day", line = "adx") {
|
|
534
|
+
const d = { type: "AverageDirectionalIndex" };
|
|
535
|
+
setAsset(d, "targetAsset", asset);
|
|
536
|
+
d["line"] = line;
|
|
537
|
+
d.window = { length: length, interval: interval };
|
|
538
|
+
return d;
|
|
539
|
+
}
|
|
500
540
|
/**
|
|
501
541
|
* AverageTrueRange indicator.
|
|
502
542
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -549,6 +589,32 @@ function BuyingPower() {
|
|
|
549
589
|
const d = { type: "BuyingPower" };
|
|
550
590
|
return d;
|
|
551
591
|
}
|
|
592
|
+
/**
|
|
593
|
+
* ChaikinMoneyFlow indicator.
|
|
594
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
595
|
+
* @param length Length of time
|
|
596
|
+
* @param interval Unit of time
|
|
597
|
+
*/
|
|
598
|
+
function ChaikinMoneyFlow(asset, length = 20, interval = "Day") {
|
|
599
|
+
const d = { type: "ChaikinMoneyFlow" };
|
|
600
|
+
setAsset(d, "targetAsset", asset);
|
|
601
|
+
d.window = { length: length, interval: interval };
|
|
602
|
+
return d;
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* CommodityChannelIndex indicator.
|
|
606
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
607
|
+
* @param length Length of time
|
|
608
|
+
* @param interval Unit of time
|
|
609
|
+
* @param constant Divisor scaling the mean deviation
|
|
610
|
+
*/
|
|
611
|
+
function CommodityChannelIndex(asset, length = 20, interval = "Day", constant = 0.015) {
|
|
612
|
+
const d = { type: "CommodityChannelIndex" };
|
|
613
|
+
setAsset(d, "targetAsset", asset);
|
|
614
|
+
d["constant"] = constant;
|
|
615
|
+
d.window = { length: length, interval: interval };
|
|
616
|
+
return d;
|
|
617
|
+
}
|
|
552
618
|
/**
|
|
553
619
|
* CompoundAnnualGrowthRate indicator.
|
|
554
620
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -750,6 +816,20 @@ function Divide(left, right) {
|
|
|
750
816
|
d.indicators = [left, right];
|
|
751
817
|
return d;
|
|
752
818
|
}
|
|
819
|
+
/**
|
|
820
|
+
* DonchianChannel indicator.
|
|
821
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
822
|
+
* @param length Length of time
|
|
823
|
+
* @param interval Unit of time
|
|
824
|
+
* @param line Which Donchian line to evaluate
|
|
825
|
+
*/
|
|
826
|
+
function DonchianChannel(asset, length = 20, interval = "Day", line = "upper") {
|
|
827
|
+
const d = { type: "DonchianChannel" };
|
|
828
|
+
setAsset(d, "targetAsset", asset);
|
|
829
|
+
d["line"] = line;
|
|
830
|
+
d.window = { length: length, interval: interval };
|
|
831
|
+
return d;
|
|
832
|
+
}
|
|
753
833
|
/**
|
|
754
834
|
* Economic indicator.
|
|
755
835
|
* @param metric The economic indicator to use
|
|
@@ -820,6 +900,22 @@ function HighOfDay(asset) {
|
|
|
820
900
|
setAsset(d, "targetAsset", asset);
|
|
821
901
|
return d;
|
|
822
902
|
}
|
|
903
|
+
/**
|
|
904
|
+
* IchimokuCloud indicator.
|
|
905
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
906
|
+
* @param length Length of time
|
|
907
|
+
* @param interval Unit of time
|
|
908
|
+
* @param spanLength Senkou B lookback in bars (Kijun scales from conversion)
|
|
909
|
+
* @param line Which Ichimoku line to evaluate (unshifted)
|
|
910
|
+
*/
|
|
911
|
+
function IchimokuCloud(asset, length = 9, interval = "Day", spanLength = 52, line = "tenkan") {
|
|
912
|
+
const d = { type: "IchimokuCloud" };
|
|
913
|
+
setAsset(d, "targetAsset", asset);
|
|
914
|
+
d["spanLength"] = spanLength;
|
|
915
|
+
d["line"] = line;
|
|
916
|
+
d.window = { length: length, interval: interval };
|
|
917
|
+
return d;
|
|
918
|
+
}
|
|
823
919
|
/**
|
|
824
920
|
* ImpliedVolatility indicator.
|
|
825
921
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -1042,6 +1138,22 @@ function IVRank(asset, length = 252, interval = "Day") {
|
|
|
1042
1138
|
d.window = { length: length, interval: interval };
|
|
1043
1139
|
return d;
|
|
1044
1140
|
}
|
|
1141
|
+
/**
|
|
1142
|
+
* KeltnerChannel indicator.
|
|
1143
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1144
|
+
* @param length Length of time
|
|
1145
|
+
* @param interval Unit of time
|
|
1146
|
+
* @param multiplier How many ATRs from the EMA midline
|
|
1147
|
+
* @param line Which Keltner line to evaluate
|
|
1148
|
+
*/
|
|
1149
|
+
function KeltnerChannel(asset, length = 20, interval = "Day", multiplier = 2, line = "middle") {
|
|
1150
|
+
const d = { type: "KeltnerChannel" };
|
|
1151
|
+
setAsset(d, "targetAsset", asset);
|
|
1152
|
+
d["multiplier"] = multiplier;
|
|
1153
|
+
d["line"] = line;
|
|
1154
|
+
d.window = { length: length, interval: interval };
|
|
1155
|
+
return d;
|
|
1156
|
+
}
|
|
1045
1157
|
/**
|
|
1046
1158
|
* LastOrderPrice indicator.
|
|
1047
1159
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -1211,6 +1323,18 @@ function MinutesUntilClose() {
|
|
|
1211
1323
|
const d = { type: "MinutesUntilClose" };
|
|
1212
1324
|
return d;
|
|
1213
1325
|
}
|
|
1326
|
+
/**
|
|
1327
|
+
* MoneyFlowIndex indicator.
|
|
1328
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1329
|
+
* @param length Length of time
|
|
1330
|
+
* @param interval Unit of time
|
|
1331
|
+
*/
|
|
1332
|
+
function MoneyFlowIndex(asset, length = 14, interval = "Day") {
|
|
1333
|
+
const d = { type: "MoneyFlowIndex" };
|
|
1334
|
+
setAsset(d, "targetAsset", asset);
|
|
1335
|
+
d.window = { length: length, interval: interval };
|
|
1336
|
+
return d;
|
|
1337
|
+
}
|
|
1214
1338
|
/**
|
|
1215
1339
|
* Month indicator.
|
|
1216
1340
|
*/
|
|
@@ -1218,6 +1342,25 @@ function Month() {
|
|
|
1218
1342
|
const d = { type: "Month" };
|
|
1219
1343
|
return d;
|
|
1220
1344
|
}
|
|
1345
|
+
/**
|
|
1346
|
+
* MovingAverageConvergenceDivergence indicator.
|
|
1347
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1348
|
+
* @param fastLength Period of the fast EMA
|
|
1349
|
+
* @param slowLength Period of the slow EMA (must exceed the fast length)
|
|
1350
|
+
* @param signalLength Period of the EMA applied to the MACD line
|
|
1351
|
+
* @param interval Bar interval the MACD is computed on
|
|
1352
|
+
* @param line Which MACD line to evaluate
|
|
1353
|
+
*/
|
|
1354
|
+
function MovingAverageConvergenceDivergence(asset, fastLength = 12, slowLength = 26, signalLength = 9, interval = "Day", line = "macd") {
|
|
1355
|
+
const d = { type: "MovingAverageConvergenceDivergence" };
|
|
1356
|
+
setAsset(d, "targetAsset", asset);
|
|
1357
|
+
d["fastLength"] = fastLength;
|
|
1358
|
+
d["slowLength"] = slowLength;
|
|
1359
|
+
d["signalLength"] = signalLength;
|
|
1360
|
+
d["interval"] = interval;
|
|
1361
|
+
d["line"] = line;
|
|
1362
|
+
return d;
|
|
1363
|
+
}
|
|
1221
1364
|
/**
|
|
1222
1365
|
* Multiply indicator.
|
|
1223
1366
|
*/
|
|
@@ -1234,6 +1377,17 @@ function Negative(operand) {
|
|
|
1234
1377
|
d.indicators = [operand];
|
|
1235
1378
|
return d;
|
|
1236
1379
|
}
|
|
1380
|
+
/**
|
|
1381
|
+
* OnBalanceVolume indicator.
|
|
1382
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1383
|
+
* @param interval Bar interval the volume is accumulated on
|
|
1384
|
+
*/
|
|
1385
|
+
function OnBalanceVolume(asset, interval = "Day") {
|
|
1386
|
+
const d = { type: "OnBalanceVolume" };
|
|
1387
|
+
setAsset(d, "targetAsset", asset);
|
|
1388
|
+
d["interval"] = interval;
|
|
1389
|
+
return d;
|
|
1390
|
+
}
|
|
1237
1391
|
/**
|
|
1238
1392
|
* OpeningPrice indicator.
|
|
1239
1393
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -1434,6 +1588,21 @@ function OptionUnrealizedPnL(underlying, optionType, direction, spreadType) {
|
|
|
1434
1588
|
d["spreadType"] = spreadType;
|
|
1435
1589
|
return d;
|
|
1436
1590
|
}
|
|
1591
|
+
/**
|
|
1592
|
+
* ParabolicSar indicator.
|
|
1593
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1594
|
+
* @param interval Bar interval the SAR trails on
|
|
1595
|
+
* @param step AF increment per new extreme
|
|
1596
|
+
* @param maximum AF cap
|
|
1597
|
+
*/
|
|
1598
|
+
function ParabolicSar(asset, interval = "Day", step = 0.02, maximum = 0.2) {
|
|
1599
|
+
const d = { type: "ParabolicSar" };
|
|
1600
|
+
setAsset(d, "targetAsset", asset);
|
|
1601
|
+
d["interval"] = interval;
|
|
1602
|
+
d["step"] = step;
|
|
1603
|
+
d["maximum"] = maximum;
|
|
1604
|
+
return d;
|
|
1605
|
+
}
|
|
1437
1606
|
/**
|
|
1438
1607
|
* Plus indicator.
|
|
1439
1608
|
*/
|
|
@@ -1592,6 +1761,18 @@ function RelativeStrengthIndex(asset, length = 30, interval = "Day") {
|
|
|
1592
1761
|
return d;
|
|
1593
1762
|
}
|
|
1594
1763
|
exports.RSI = RelativeStrengthIndex;
|
|
1764
|
+
/**
|
|
1765
|
+
* RelativeVolume indicator.
|
|
1766
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1767
|
+
* @param length Length of time
|
|
1768
|
+
* @param interval Unit of time
|
|
1769
|
+
*/
|
|
1770
|
+
function RelativeVolume(asset, length = 14, interval = "Day") {
|
|
1771
|
+
const d = { type: "RelativeVolume" };
|
|
1772
|
+
setAsset(d, "targetAsset", asset);
|
|
1773
|
+
d.window = { length: length, interval: interval };
|
|
1774
|
+
return d;
|
|
1775
|
+
}
|
|
1595
1776
|
/**
|
|
1596
1777
|
* SimpleMovingAverage indicator.
|
|
1597
1778
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -1613,6 +1794,24 @@ function SquareRoot(operand) {
|
|
|
1613
1794
|
d.indicators = [operand];
|
|
1614
1795
|
return d;
|
|
1615
1796
|
}
|
|
1797
|
+
/**
|
|
1798
|
+
* Stochastic indicator.
|
|
1799
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1800
|
+
* @param length Length of time
|
|
1801
|
+
* @param interval Unit of time
|
|
1802
|
+
* @param smoothK Moving-average length applied to raw %K
|
|
1803
|
+
* @param smoothD Moving-average length applied to smoothed %K
|
|
1804
|
+
* @param line Which stochastic line to evaluate
|
|
1805
|
+
*/
|
|
1806
|
+
function Stochastic(asset, length = 14, interval = "Day", smoothK = 3, smoothD = 3, line = "k") {
|
|
1807
|
+
const d = { type: "Stochastic" };
|
|
1808
|
+
setAsset(d, "targetAsset", asset);
|
|
1809
|
+
d["smoothK"] = smoothK;
|
|
1810
|
+
d["smoothD"] = smoothD;
|
|
1811
|
+
d["line"] = line;
|
|
1812
|
+
d.window = { length: length, interval: interval };
|
|
1813
|
+
return d;
|
|
1814
|
+
}
|
|
1616
1815
|
/**
|
|
1617
1816
|
* StockReport indicator.
|
|
1618
1817
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -1654,6 +1853,22 @@ function SumOrderQuantity(side, orderStatus = "Filled", length = 1, interval = "
|
|
|
1654
1853
|
d.window = { length: length, interval: interval };
|
|
1655
1854
|
return d;
|
|
1656
1855
|
}
|
|
1856
|
+
/**
|
|
1857
|
+
* Supertrend indicator.
|
|
1858
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1859
|
+
* @param length Length of time
|
|
1860
|
+
* @param interval Unit of time
|
|
1861
|
+
* @param multiplier How many ATRs from HL2
|
|
1862
|
+
* @param line Band value or trend direction (+1 up, -1 down)
|
|
1863
|
+
*/
|
|
1864
|
+
function Supertrend(asset, length = 10, interval = "Day", multiplier = 3, line = "value") {
|
|
1865
|
+
const d = { type: "Supertrend" };
|
|
1866
|
+
setAsset(d, "targetAsset", asset);
|
|
1867
|
+
d["multiplier"] = multiplier;
|
|
1868
|
+
d["line"] = line;
|
|
1869
|
+
d.window = { length: length, interval: interval };
|
|
1870
|
+
return d;
|
|
1871
|
+
}
|
|
1657
1872
|
/**
|
|
1658
1873
|
* TrailingSum indicator.
|
|
1659
1874
|
* @param length Length of the rolling window
|
|
@@ -1711,6 +1926,18 @@ function VWAP(asset) {
|
|
|
1711
1926
|
setAsset(d, "targetAsset", asset);
|
|
1712
1927
|
return d;
|
|
1713
1928
|
}
|
|
1929
|
+
/**
|
|
1930
|
+
* WilliamsR indicator.
|
|
1931
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1932
|
+
* @param length Length of time
|
|
1933
|
+
* @param interval Unit of time
|
|
1934
|
+
*/
|
|
1935
|
+
function WilliamsR(asset, length = 14, interval = "Day") {
|
|
1936
|
+
const d = { type: "WilliamsR" };
|
|
1937
|
+
setAsset(d, "targetAsset", asset);
|
|
1938
|
+
d.window = { length: length, interval: interval };
|
|
1939
|
+
return d;
|
|
1940
|
+
}
|
|
1714
1941
|
/**
|
|
1715
1942
|
* Year indicator.
|
|
1716
1943
|
*/
|
|
@@ -678,6 +678,20 @@ 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;
|
|
687
|
+
/**
|
|
688
|
+
* AverageDirectionalIndex indicator.
|
|
689
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
690
|
+
* @param length Length of time
|
|
691
|
+
* @param interval Unit of time
|
|
692
|
+
* @param line Which ADX-system line to evaluate
|
|
693
|
+
*/
|
|
694
|
+
export declare function AverageDirectionalIndex(asset: AssetArg, length?: number, interval?: Interval, line?: "adx" | "plusDi" | "minusDi"): Indicator;
|
|
681
695
|
/**
|
|
682
696
|
* AverageTrueRange indicator.
|
|
683
697
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -708,6 +722,21 @@ export declare function BullishFairValueGap(asset: AssetArg): Indicator;
|
|
|
708
722
|
* BuyingPower indicator.
|
|
709
723
|
*/
|
|
710
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;
|
|
711
740
|
/**
|
|
712
741
|
* CompoundAnnualGrowthRate indicator.
|
|
713
742
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -818,6 +847,14 @@ export declare function DaysUntilEarnings(asset: AssetArg): Indicator;
|
|
|
818
847
|
* Divide indicator.
|
|
819
848
|
*/
|
|
820
849
|
export declare function Divide(left: Indicator, right: Indicator): Indicator;
|
|
850
|
+
/**
|
|
851
|
+
* DonchianChannel indicator.
|
|
852
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
853
|
+
* @param length Length of time
|
|
854
|
+
* @param interval Unit of time
|
|
855
|
+
* @param line Which Donchian line to evaluate
|
|
856
|
+
*/
|
|
857
|
+
export declare function DonchianChannel(asset: AssetArg, length?: number, interval?: Interval, line?: "upper" | "lower" | "middle"): Indicator;
|
|
821
858
|
/**
|
|
822
859
|
* Economic indicator.
|
|
823
860
|
* @param metric The economic indicator to use
|
|
@@ -857,6 +894,15 @@ export declare function GapSize(asset: AssetArg): Indicator;
|
|
|
857
894
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
858
895
|
*/
|
|
859
896
|
export declare function HighOfDay(asset: AssetArg): Indicator;
|
|
897
|
+
/**
|
|
898
|
+
* IchimokuCloud indicator.
|
|
899
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
900
|
+
* @param length Length of time
|
|
901
|
+
* @param interval Unit of time
|
|
902
|
+
* @param spanLength Senkou B lookback in bars (Kijun scales from conversion)
|
|
903
|
+
* @param line Which Ichimoku line to evaluate (unshifted)
|
|
904
|
+
*/
|
|
905
|
+
export declare function IchimokuCloud(asset: AssetArg, length?: number, interval?: Interval, spanLength?: number, line?: "tenkan" | "kijun" | "senkouA" | "senkouB" | "chikou"): Indicator;
|
|
860
906
|
/**
|
|
861
907
|
* ImpliedVolatility indicator.
|
|
862
908
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -978,6 +1024,15 @@ export declare function IVPercentile(asset: AssetArg, length?: number, interval?
|
|
|
978
1024
|
* @param interval Unit of time
|
|
979
1025
|
*/
|
|
980
1026
|
export declare function IVRank(asset: AssetArg, length?: number, interval?: Interval): Indicator;
|
|
1027
|
+
/**
|
|
1028
|
+
* KeltnerChannel indicator.
|
|
1029
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1030
|
+
* @param length Length of time
|
|
1031
|
+
* @param interval Unit of time
|
|
1032
|
+
* @param multiplier How many ATRs from the EMA midline
|
|
1033
|
+
* @param line Which Keltner line to evaluate
|
|
1034
|
+
*/
|
|
1035
|
+
export declare function KeltnerChannel(asset: AssetArg, length?: number, interval?: Interval, multiplier?: number, line?: "upper" | "middle" | "lower"): Indicator;
|
|
981
1036
|
/**
|
|
982
1037
|
* LastOrderPrice indicator.
|
|
983
1038
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -1070,10 +1125,27 @@ export declare function MinutesSinceOrder(assets: AssetArg | AssetArg[], side: S
|
|
|
1070
1125
|
* MinutesUntilClose indicator.
|
|
1071
1126
|
*/
|
|
1072
1127
|
export declare function MinutesUntilClose(): Indicator;
|
|
1128
|
+
/**
|
|
1129
|
+
* MoneyFlowIndex indicator.
|
|
1130
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1131
|
+
* @param length Length of time
|
|
1132
|
+
* @param interval Unit of time
|
|
1133
|
+
*/
|
|
1134
|
+
export declare function MoneyFlowIndex(asset: AssetArg, length?: number, interval?: Interval): Indicator;
|
|
1073
1135
|
/**
|
|
1074
1136
|
* Month indicator.
|
|
1075
1137
|
*/
|
|
1076
1138
|
export declare function Month(): Indicator;
|
|
1139
|
+
/**
|
|
1140
|
+
* MovingAverageConvergenceDivergence indicator.
|
|
1141
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1142
|
+
* @param fastLength Period of the fast EMA
|
|
1143
|
+
* @param slowLength Period of the slow EMA (must exceed the fast length)
|
|
1144
|
+
* @param signalLength Period of the EMA applied to the MACD line
|
|
1145
|
+
* @param interval Bar interval the MACD is computed on
|
|
1146
|
+
* @param line Which MACD line to evaluate
|
|
1147
|
+
*/
|
|
1148
|
+
export declare function MovingAverageConvergenceDivergence(asset: AssetArg, fastLength?: number, slowLength?: number, signalLength?: number, interval?: Interval, line?: "macd" | "signal" | "histogram"): Indicator;
|
|
1077
1149
|
/**
|
|
1078
1150
|
* Multiply indicator.
|
|
1079
1151
|
*/
|
|
@@ -1082,6 +1154,12 @@ export declare function Multiply(left: Indicator, right: Indicator): Indicator;
|
|
|
1082
1154
|
* Negative indicator.
|
|
1083
1155
|
*/
|
|
1084
1156
|
export declare function Negative(operand: Indicator): Indicator;
|
|
1157
|
+
/**
|
|
1158
|
+
* OnBalanceVolume indicator.
|
|
1159
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1160
|
+
* @param interval Bar interval the volume is accumulated on
|
|
1161
|
+
*/
|
|
1162
|
+
export declare function OnBalanceVolume(asset: AssetArg, interval?: Interval): Indicator;
|
|
1085
1163
|
/**
|
|
1086
1164
|
* OpeningPrice indicator.
|
|
1087
1165
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -1188,6 +1266,14 @@ export declare function OptionSpreadEntryPrice(underlying: string, optionType: O
|
|
|
1188
1266
|
* @param spreadType Filter by spread type. Leave empty for all.
|
|
1189
1267
|
*/
|
|
1190
1268
|
export declare function OptionUnrealizedPnL(underlying: string, optionType: OptionType, direction: OptionDirection, spreadType: OptionSpreadType): Indicator;
|
|
1269
|
+
/**
|
|
1270
|
+
* ParabolicSar indicator.
|
|
1271
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1272
|
+
* @param interval Bar interval the SAR trails on
|
|
1273
|
+
* @param step AF increment per new extreme
|
|
1274
|
+
* @param maximum AF cap
|
|
1275
|
+
*/
|
|
1276
|
+
export declare function ParabolicSar(asset: AssetArg, interval?: Interval, step?: number, maximum?: number): Indicator;
|
|
1191
1277
|
/**
|
|
1192
1278
|
* Plus indicator.
|
|
1193
1279
|
*/
|
|
@@ -1277,6 +1363,13 @@ export declare function RebalanceDecisionMetric(metric?: "allocationDrift" | "pl
|
|
|
1277
1363
|
*/
|
|
1278
1364
|
export declare function RelativeStrengthIndex(asset: AssetArg, length?: number, interval?: Interval): Indicator;
|
|
1279
1365
|
export declare const RSI: typeof RelativeStrengthIndex;
|
|
1366
|
+
/**
|
|
1367
|
+
* RelativeVolume indicator.
|
|
1368
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1369
|
+
* @param length Length of time
|
|
1370
|
+
* @param interval Unit of time
|
|
1371
|
+
*/
|
|
1372
|
+
export declare function RelativeVolume(asset: AssetArg, length?: number, interval?: Interval): Indicator;
|
|
1280
1373
|
/**
|
|
1281
1374
|
* SimpleMovingAverage indicator.
|
|
1282
1375
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -1289,6 +1382,16 @@ export declare const SMA: typeof SimpleMovingAverage;
|
|
|
1289
1382
|
* SquareRoot indicator.
|
|
1290
1383
|
*/
|
|
1291
1384
|
export declare function SquareRoot(operand: Indicator): Indicator;
|
|
1385
|
+
/**
|
|
1386
|
+
* Stochastic indicator.
|
|
1387
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1388
|
+
* @param length Length of time
|
|
1389
|
+
* @param interval Unit of time
|
|
1390
|
+
* @param smoothK Moving-average length applied to raw %K
|
|
1391
|
+
* @param smoothD Moving-average length applied to smoothed %K
|
|
1392
|
+
* @param line Which stochastic line to evaluate
|
|
1393
|
+
*/
|
|
1394
|
+
export declare function Stochastic(asset: AssetArg, length?: number, interval?: Interval, smoothK?: number, smoothD?: number, line?: "k" | "d"): Indicator;
|
|
1292
1395
|
/**
|
|
1293
1396
|
* StockReport indicator.
|
|
1294
1397
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -1312,6 +1415,15 @@ export declare function SumOrderAmount(side: Side, orderStatus?: OrderStatus, le
|
|
|
1312
1415
|
* @param assets Ticker name (ex. SPY, BTC)
|
|
1313
1416
|
*/
|
|
1314
1417
|
export declare function SumOrderQuantity(side: Side, orderStatus?: OrderStatus, length?: number, interval?: Interval, assets?: AssetArg | AssetArg[]): Indicator;
|
|
1418
|
+
/**
|
|
1419
|
+
* Supertrend indicator.
|
|
1420
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1421
|
+
* @param length Length of time
|
|
1422
|
+
* @param interval Unit of time
|
|
1423
|
+
* @param multiplier How many ATRs from HL2
|
|
1424
|
+
* @param line Band value or trend direction (+1 up, -1 down)
|
|
1425
|
+
*/
|
|
1426
|
+
export declare function Supertrend(asset: AssetArg, length?: number, interval?: Interval, multiplier?: number, line?: "value" | "direction"): Indicator;
|
|
1315
1427
|
/**
|
|
1316
1428
|
* TrailingSum indicator.
|
|
1317
1429
|
* @param length Length of the rolling window
|
|
@@ -1343,6 +1455,13 @@ export declare function Volume(asset: AssetArg, metric?: FundamentalMetric): Ind
|
|
|
1343
1455
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
1344
1456
|
*/
|
|
1345
1457
|
export declare function VWAP(asset: AssetArg): Indicator;
|
|
1458
|
+
/**
|
|
1459
|
+
* WilliamsR indicator.
|
|
1460
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1461
|
+
* @param length Length of time
|
|
1462
|
+
* @param interval Unit of time
|
|
1463
|
+
*/
|
|
1464
|
+
export declare function WilliamsR(asset: AssetArg, length?: number, interval?: Interval): Indicator;
|
|
1346
1465
|
/**
|
|
1347
1466
|
* Year indicator.
|
|
1348
1467
|
*/
|
|
@@ -322,6 +322,31 @@ 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
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* AverageDirectionalIndex indicator.
|
|
338
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
339
|
+
* @param length Length of time
|
|
340
|
+
* @param interval Unit of time
|
|
341
|
+
* @param line Which ADX-system line to evaluate
|
|
342
|
+
*/
|
|
343
|
+
export function AverageDirectionalIndex(asset, length = 14, interval = "Day", line = "adx") {
|
|
344
|
+
const d = { type: "AverageDirectionalIndex" };
|
|
345
|
+
setAsset(d, "targetAsset", asset);
|
|
346
|
+
d["line"] = line;
|
|
347
|
+
d.window = { length: length, interval: interval };
|
|
348
|
+
return d;
|
|
349
|
+
}
|
|
325
350
|
/**
|
|
326
351
|
* AverageTrueRange indicator.
|
|
327
352
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -374,6 +399,32 @@ export function BuyingPower() {
|
|
|
374
399
|
const d = { type: "BuyingPower" };
|
|
375
400
|
return d;
|
|
376
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
|
+
}
|
|
377
428
|
/**
|
|
378
429
|
* CompoundAnnualGrowthRate indicator.
|
|
379
430
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -575,6 +626,20 @@ export function Divide(left, right) {
|
|
|
575
626
|
d.indicators = [left, right];
|
|
576
627
|
return d;
|
|
577
628
|
}
|
|
629
|
+
/**
|
|
630
|
+
* DonchianChannel indicator.
|
|
631
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
632
|
+
* @param length Length of time
|
|
633
|
+
* @param interval Unit of time
|
|
634
|
+
* @param line Which Donchian line to evaluate
|
|
635
|
+
*/
|
|
636
|
+
export function DonchianChannel(asset, length = 20, interval = "Day", line = "upper") {
|
|
637
|
+
const d = { type: "DonchianChannel" };
|
|
638
|
+
setAsset(d, "targetAsset", asset);
|
|
639
|
+
d["line"] = line;
|
|
640
|
+
d.window = { length: length, interval: interval };
|
|
641
|
+
return d;
|
|
642
|
+
}
|
|
578
643
|
/**
|
|
579
644
|
* Economic indicator.
|
|
580
645
|
* @param metric The economic indicator to use
|
|
@@ -645,6 +710,22 @@ export function HighOfDay(asset) {
|
|
|
645
710
|
setAsset(d, "targetAsset", asset);
|
|
646
711
|
return d;
|
|
647
712
|
}
|
|
713
|
+
/**
|
|
714
|
+
* IchimokuCloud indicator.
|
|
715
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
716
|
+
* @param length Length of time
|
|
717
|
+
* @param interval Unit of time
|
|
718
|
+
* @param spanLength Senkou B lookback in bars (Kijun scales from conversion)
|
|
719
|
+
* @param line Which Ichimoku line to evaluate (unshifted)
|
|
720
|
+
*/
|
|
721
|
+
export function IchimokuCloud(asset, length = 9, interval = "Day", spanLength = 52, line = "tenkan") {
|
|
722
|
+
const d = { type: "IchimokuCloud" };
|
|
723
|
+
setAsset(d, "targetAsset", asset);
|
|
724
|
+
d["spanLength"] = spanLength;
|
|
725
|
+
d["line"] = line;
|
|
726
|
+
d.window = { length: length, interval: interval };
|
|
727
|
+
return d;
|
|
728
|
+
}
|
|
648
729
|
/**
|
|
649
730
|
* ImpliedVolatility indicator.
|
|
650
731
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -867,6 +948,22 @@ export function IVRank(asset, length = 252, interval = "Day") {
|
|
|
867
948
|
d.window = { length: length, interval: interval };
|
|
868
949
|
return d;
|
|
869
950
|
}
|
|
951
|
+
/**
|
|
952
|
+
* KeltnerChannel indicator.
|
|
953
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
954
|
+
* @param length Length of time
|
|
955
|
+
* @param interval Unit of time
|
|
956
|
+
* @param multiplier How many ATRs from the EMA midline
|
|
957
|
+
* @param line Which Keltner line to evaluate
|
|
958
|
+
*/
|
|
959
|
+
export function KeltnerChannel(asset, length = 20, interval = "Day", multiplier = 2, line = "middle") {
|
|
960
|
+
const d = { type: "KeltnerChannel" };
|
|
961
|
+
setAsset(d, "targetAsset", asset);
|
|
962
|
+
d["multiplier"] = multiplier;
|
|
963
|
+
d["line"] = line;
|
|
964
|
+
d.window = { length: length, interval: interval };
|
|
965
|
+
return d;
|
|
966
|
+
}
|
|
870
967
|
/**
|
|
871
968
|
* LastOrderPrice indicator.
|
|
872
969
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -1036,6 +1133,18 @@ export function MinutesUntilClose() {
|
|
|
1036
1133
|
const d = { type: "MinutesUntilClose" };
|
|
1037
1134
|
return d;
|
|
1038
1135
|
}
|
|
1136
|
+
/**
|
|
1137
|
+
* MoneyFlowIndex indicator.
|
|
1138
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1139
|
+
* @param length Length of time
|
|
1140
|
+
* @param interval Unit of time
|
|
1141
|
+
*/
|
|
1142
|
+
export function MoneyFlowIndex(asset, length = 14, interval = "Day") {
|
|
1143
|
+
const d = { type: "MoneyFlowIndex" };
|
|
1144
|
+
setAsset(d, "targetAsset", asset);
|
|
1145
|
+
d.window = { length: length, interval: interval };
|
|
1146
|
+
return d;
|
|
1147
|
+
}
|
|
1039
1148
|
/**
|
|
1040
1149
|
* Month indicator.
|
|
1041
1150
|
*/
|
|
@@ -1043,6 +1152,25 @@ export function Month() {
|
|
|
1043
1152
|
const d = { type: "Month" };
|
|
1044
1153
|
return d;
|
|
1045
1154
|
}
|
|
1155
|
+
/**
|
|
1156
|
+
* MovingAverageConvergenceDivergence indicator.
|
|
1157
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1158
|
+
* @param fastLength Period of the fast EMA
|
|
1159
|
+
* @param slowLength Period of the slow EMA (must exceed the fast length)
|
|
1160
|
+
* @param signalLength Period of the EMA applied to the MACD line
|
|
1161
|
+
* @param interval Bar interval the MACD is computed on
|
|
1162
|
+
* @param line Which MACD line to evaluate
|
|
1163
|
+
*/
|
|
1164
|
+
export function MovingAverageConvergenceDivergence(asset, fastLength = 12, slowLength = 26, signalLength = 9, interval = "Day", line = "macd") {
|
|
1165
|
+
const d = { type: "MovingAverageConvergenceDivergence" };
|
|
1166
|
+
setAsset(d, "targetAsset", asset);
|
|
1167
|
+
d["fastLength"] = fastLength;
|
|
1168
|
+
d["slowLength"] = slowLength;
|
|
1169
|
+
d["signalLength"] = signalLength;
|
|
1170
|
+
d["interval"] = interval;
|
|
1171
|
+
d["line"] = line;
|
|
1172
|
+
return d;
|
|
1173
|
+
}
|
|
1046
1174
|
/**
|
|
1047
1175
|
* Multiply indicator.
|
|
1048
1176
|
*/
|
|
@@ -1059,6 +1187,17 @@ export function Negative(operand) {
|
|
|
1059
1187
|
d.indicators = [operand];
|
|
1060
1188
|
return d;
|
|
1061
1189
|
}
|
|
1190
|
+
/**
|
|
1191
|
+
* OnBalanceVolume indicator.
|
|
1192
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1193
|
+
* @param interval Bar interval the volume is accumulated on
|
|
1194
|
+
*/
|
|
1195
|
+
export function OnBalanceVolume(asset, interval = "Day") {
|
|
1196
|
+
const d = { type: "OnBalanceVolume" };
|
|
1197
|
+
setAsset(d, "targetAsset", asset);
|
|
1198
|
+
d["interval"] = interval;
|
|
1199
|
+
return d;
|
|
1200
|
+
}
|
|
1062
1201
|
/**
|
|
1063
1202
|
* OpeningPrice indicator.
|
|
1064
1203
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -1259,6 +1398,21 @@ export function OptionUnrealizedPnL(underlying, optionType, direction, spreadTyp
|
|
|
1259
1398
|
d["spreadType"] = spreadType;
|
|
1260
1399
|
return d;
|
|
1261
1400
|
}
|
|
1401
|
+
/**
|
|
1402
|
+
* ParabolicSar indicator.
|
|
1403
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1404
|
+
* @param interval Bar interval the SAR trails on
|
|
1405
|
+
* @param step AF increment per new extreme
|
|
1406
|
+
* @param maximum AF cap
|
|
1407
|
+
*/
|
|
1408
|
+
export function ParabolicSar(asset, interval = "Day", step = 0.02, maximum = 0.2) {
|
|
1409
|
+
const d = { type: "ParabolicSar" };
|
|
1410
|
+
setAsset(d, "targetAsset", asset);
|
|
1411
|
+
d["interval"] = interval;
|
|
1412
|
+
d["step"] = step;
|
|
1413
|
+
d["maximum"] = maximum;
|
|
1414
|
+
return d;
|
|
1415
|
+
}
|
|
1262
1416
|
/**
|
|
1263
1417
|
* Plus indicator.
|
|
1264
1418
|
*/
|
|
@@ -1417,6 +1571,18 @@ export function RelativeStrengthIndex(asset, length = 30, interval = "Day") {
|
|
|
1417
1571
|
return d;
|
|
1418
1572
|
}
|
|
1419
1573
|
export const RSI = RelativeStrengthIndex;
|
|
1574
|
+
/**
|
|
1575
|
+
* RelativeVolume indicator.
|
|
1576
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1577
|
+
* @param length Length of time
|
|
1578
|
+
* @param interval Unit of time
|
|
1579
|
+
*/
|
|
1580
|
+
export function RelativeVolume(asset, length = 14, interval = "Day") {
|
|
1581
|
+
const d = { type: "RelativeVolume" };
|
|
1582
|
+
setAsset(d, "targetAsset", asset);
|
|
1583
|
+
d.window = { length: length, interval: interval };
|
|
1584
|
+
return d;
|
|
1585
|
+
}
|
|
1420
1586
|
/**
|
|
1421
1587
|
* SimpleMovingAverage indicator.
|
|
1422
1588
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -1438,6 +1604,24 @@ export function SquareRoot(operand) {
|
|
|
1438
1604
|
d.indicators = [operand];
|
|
1439
1605
|
return d;
|
|
1440
1606
|
}
|
|
1607
|
+
/**
|
|
1608
|
+
* Stochastic indicator.
|
|
1609
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1610
|
+
* @param length Length of time
|
|
1611
|
+
* @param interval Unit of time
|
|
1612
|
+
* @param smoothK Moving-average length applied to raw %K
|
|
1613
|
+
* @param smoothD Moving-average length applied to smoothed %K
|
|
1614
|
+
* @param line Which stochastic line to evaluate
|
|
1615
|
+
*/
|
|
1616
|
+
export function Stochastic(asset, length = 14, interval = "Day", smoothK = 3, smoothD = 3, line = "k") {
|
|
1617
|
+
const d = { type: "Stochastic" };
|
|
1618
|
+
setAsset(d, "targetAsset", asset);
|
|
1619
|
+
d["smoothK"] = smoothK;
|
|
1620
|
+
d["smoothD"] = smoothD;
|
|
1621
|
+
d["line"] = line;
|
|
1622
|
+
d.window = { length: length, interval: interval };
|
|
1623
|
+
return d;
|
|
1624
|
+
}
|
|
1441
1625
|
/**
|
|
1442
1626
|
* StockReport indicator.
|
|
1443
1627
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -1479,6 +1663,22 @@ export function SumOrderQuantity(side, orderStatus = "Filled", length = 1, inter
|
|
|
1479
1663
|
d.window = { length: length, interval: interval };
|
|
1480
1664
|
return d;
|
|
1481
1665
|
}
|
|
1666
|
+
/**
|
|
1667
|
+
* Supertrend indicator.
|
|
1668
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1669
|
+
* @param length Length of time
|
|
1670
|
+
* @param interval Unit of time
|
|
1671
|
+
* @param multiplier How many ATRs from HL2
|
|
1672
|
+
* @param line Band value or trend direction (+1 up, -1 down)
|
|
1673
|
+
*/
|
|
1674
|
+
export function Supertrend(asset, length = 10, interval = "Day", multiplier = 3, line = "value") {
|
|
1675
|
+
const d = { type: "Supertrend" };
|
|
1676
|
+
setAsset(d, "targetAsset", asset);
|
|
1677
|
+
d["multiplier"] = multiplier;
|
|
1678
|
+
d["line"] = line;
|
|
1679
|
+
d.window = { length: length, interval: interval };
|
|
1680
|
+
return d;
|
|
1681
|
+
}
|
|
1482
1682
|
/**
|
|
1483
1683
|
* TrailingSum indicator.
|
|
1484
1684
|
* @param length Length of the rolling window
|
|
@@ -1536,6 +1736,18 @@ export function VWAP(asset) {
|
|
|
1536
1736
|
setAsset(d, "targetAsset", asset);
|
|
1537
1737
|
return d;
|
|
1538
1738
|
}
|
|
1739
|
+
/**
|
|
1740
|
+
* WilliamsR indicator.
|
|
1741
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1742
|
+
* @param length Length of time
|
|
1743
|
+
* @param interval Unit of time
|
|
1744
|
+
*/
|
|
1745
|
+
export function WilliamsR(asset, length = 14, interval = "Day") {
|
|
1746
|
+
const d = { type: "WilliamsR" };
|
|
1747
|
+
setAsset(d, "targetAsset", asset);
|
|
1748
|
+
d.window = { length: length, interval: interval };
|
|
1749
|
+
return d;
|
|
1750
|
+
}
|
|
1539
1751
|
/**
|
|
1540
1752
|
* Year indicator.
|
|
1541
1753
|
*/
|