Skip to content

Commit

Permalink
refactor: Remove "isStable" override
Browse files Browse the repository at this point in the history
  • Loading branch information
bennycode committed Nov 14, 2021
1 parent 9c4a6d0 commit 77901cf
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 33 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Thanks for your contribution!
Please check the following to make sure your contribution follows our guideline when adding a new indicator.
You can find a great example here:
https://github.com/bennycode/trading-signals/pull/361/files
https://github.com/bennycode/trading-signals/commit/9c4a6d02bcecdde6dbe5b568c6ec547512164364
-->

## Checklist for new indicators
Expand Down
4 changes: 0 additions & 4 deletions src/AC/AC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ export class AC extends BigIndicatorSeries {
this.momentum = new MOM(1);
}

override get isStable(): boolean {
return this.result !== undefined;
}

override update(low: BigSource, high: BigSource): void | Big {
const ao = this.ao.update(low, high);
if (ao) {
Expand Down
4 changes: 0 additions & 4 deletions src/AO/AO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ export class AO extends BigIndicatorSeries {
this.long = new SMA(longInterval);
}

override get isStable(): boolean {
return this.result !== undefined;
}

override update(low: BigSource, high: BigSource): void | Big {
const candleSum = new Big(low).add(high);
const medianPrice = candleSum.div(2);
Expand Down
8 changes: 0 additions & 8 deletions src/CCI/CCI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ export class CCI extends BigIndicatorSeries {
this.sma = new SMA(this.interval);
}

get isStable(): boolean {
return this.result !== undefined;
}

update(candle: HighLowClose): void | Big {
const typicalPrice = this.cacheTypicalPrice(candle);
this.sma.update(typicalPrice);
Expand Down Expand Up @@ -68,10 +64,6 @@ export class FasterCCI extends NumberIndicatorSeries {
this.sma = new FasterSMA(this.interval);
}

override get isStable(): boolean {
return this.result !== undefined;
}

override update(candle: HighLowCloseNumbers): void | number {
const typicalPrice = this.cacheTypicalPrice(candle);
this.sma.update(typicalPrice);
Expand Down
8 changes: 0 additions & 8 deletions src/MAD/MAD.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ export class MAD extends BigIndicatorSeries {
super();
}

override get isStable(): boolean {
return this.result !== undefined;
}

override update(price: BigSource): void {
this.prices.push(price);

Expand Down Expand Up @@ -52,10 +48,6 @@ export class FasterMAD extends NumberIndicatorSeries {
super();
}

override get isStable(): boolean {
return this.result !== undefined;
}

override update(price: number): void {
this.prices.push(price);

Expand Down
4 changes: 0 additions & 4 deletions src/MOM/MOM.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,4 @@ export class MOM extends BigIndicatorSeries {
this.setResult(new Big(value).minus(this.history[0]));
}
}

override get isStable(): boolean {
return this.result !== undefined;
}
}
4 changes: 0 additions & 4 deletions src/ROC/ROC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ export class ROC extends BigIndicatorSeries {
this.interval = interval;
}

override get isStable(): boolean {
return this.result !== undefined;
}

override update(price: BigSource): Big | void {
this.priceHistory.push(price);
if (this.priceHistory.length <= this.interval) {
Expand Down

0 comments on commit 77901cf

Please sign in to comment.