Skip to content

Commit

Permalink
add more indicators (#199)
Browse files Browse the repository at this point in the history
* add standard deviation, BB %B, and ALMA indicators
  • Loading branch information
DaveSkender authored Feb 22, 2022
1 parent 9d18a8a commit d492ca3
Show file tree
Hide file tree
Showing 15 changed files with 291 additions and 111 deletions.
2 changes: 1 addition & 1 deletion Client/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<mat-toolbar class="toolbar noselect">
<h1 class="no-wrap">
<a href="https://github.com/DaveSkender/Stock.Charts/">
Stock.Chart
Stock.Charts
</a>
</h1>
<div class="filler"></div>
Expand Down
16 changes: 6 additions & 10 deletions Client/src/app/app.component.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
@import "./styles";

mat-toolbar {
padding: 0 8px;

.item {
margin-left: 8px;
}
color: $color-primary-700 !important;
padding: 0 9px;
}

.edit-button {
Expand All @@ -15,14 +12,13 @@ mat-toolbar {
}

.footer {
padding: 0 8px 8px 8px;
padding: 0 9px 9px 8px;
text-align: center;
color: unset;

a {
&:hover {
color: "red";
}

&:active,
&:hover,
&:visited {
color: unset;
}
Expand Down
7 changes: 3 additions & 4 deletions Client/src/app/chart/chart.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- loading -->
<div *ngIf="loading">
<div *ngIf="cs.loading">

<div style="margin-top:175px;text-align:center;font-family:Roboto,Arial,sans-serif;font-size:12px;">
<p><img src="../assets/spinner.gif" alt="logging in" height="25"><br>WAKING UP DEMO. STANDBY</p>
Expand All @@ -8,10 +8,9 @@
</div>

<!-- CHART (MAIN OVERLAY) -->
<div id="chart-overlay" class="chart-overlay-container">
<div id="chart-overlay" class="chart-overlay-container" [hidden]="cs.loading">
<canvas id="chartOverlay"></canvas>
</div>


<!-- CHART (OSCILLATORS) -->
<div id="oscillators-zone"></div>
<div id="oscillators-zone" [hidden]="cs.loading"></div>
2 changes: 1 addition & 1 deletion Client/src/app/chart/chart.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// max-width: 850px;
height: 50vh;

@media (max-height: 800px){
@media (max-height: 700px){
height: 40vh;
}

Expand Down
5 changes: 1 addition & 4 deletions Client/src/app/chart/chart.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@ export class ChartComponent implements OnInit {
public readonly cs: ChartService
) { }

loading = true;

// STARTUP OPERATIONS
// STARTUP OPERATIONS
ngOnInit() {
this.startup();
}

startup() {
this.cs.loadCharts();
this.loading = false;
}
}
1 change: 0 additions & 1 deletion Client/src/app/chart/chart.models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export interface IndicatorParamConfig {
displayName: string;
paramName: string;
dataType: string;
order: number;
defaultValue: number;
minimum: number;
maximum: number;
Expand Down
21 changes: 16 additions & 5 deletions Client/src/app/chart/chart.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class ChartService {
listings: IndicatorListing[] = [];
selections: IndicatorSelection[] = [];
chartOverlay: Chart;
loading = true;

// CHART CONFIGURATIONS
baseConfig() {
Expand Down Expand Up @@ -574,7 +575,10 @@ export class ChartService {
error: (e: HttpErrorResponse) => { console.log(e); }
});
},
error: (e: HttpErrorResponse) => { console.log(e); }
error: (e: HttpErrorResponse) => { console.log(e); },
complete: () => {
this.loading = false;
}
});
}

Expand Down Expand Up @@ -677,18 +681,25 @@ export class ChartService {
});
}
else { // add defaults
const def1 = this.defaultSelection("EMA");
const def1 = this.defaultSelection("LINEAR");
def1.params.find(x => x.paramName == "lookbackPeriods").value = 50;
this.addSelection(def1, false);

const def2 = this.defaultSelection("BB");
this.addSelection(def2, false);

const def3 = this.defaultSelection("STO");
const def3 = this.defaultSelection("RSI");
def3.params.find(x => x.paramName == "lookbackPeriods").value = 5;
this.addSelection(def3, false);

const def4 = this.defaultSelection("RSI");
def4.params.find(x => x.paramName == "lookbackPeriods").value = 5;
const def4 = this.defaultSelection("ADX");
this.addSelection(def4, false);

const def5 = this.defaultSelection("SUPERTREND");
this.addSelection(def5, false);

const def6 = this.defaultSelection("MACD");
this.addSelection(def6, false);
}
}

Expand Down
14 changes: 8 additions & 6 deletions Client/src/app/chart/picker/pick-list.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,21 @@
</mat-slide-toggle>
</div>

<mat-nav-list>

<mat-action-list>
<mat-toolbar class="noselect" *ngIf="selections.length>0">
indicators selected
</mat-toolbar>
<a mat-list-item *ngFor="let selection of selections" matTooltip="click to remove this indicator"
(click)="removeSelection($event, selection.ucid)">
<button mat-list-item *ngFor="let selection of selections">
<span mat-line>{{selection.label}}</span>
<button mat-mini-fab color="accent">
<div class="filler"></div>
<button mat-icon-button color="accent" (click)="removeSelection($event, selection.ucid)"
matTooltip="remove this indicator">
<mat-icon>delete_forever</mat-icon>
</button>
</a>
</button>
</mat-action-list>

<mat-nav-list>
<mat-toolbar class="noselect">
add new indicator
<div class="filler"></div>
Expand Down
2 changes: 1 addition & 1 deletion Client/src/app/chart/picker/pick-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class PickListComponent {

listings: IndicatorListing[];
selections: IndicatorSelection[];
toggleColor = "warn";
toggleColor = "accent";

constructor(
public ts: StyleService,
Expand Down
32 changes: 17 additions & 15 deletions Client/src/app/styles-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,6 @@
@include mat.core();
// ref: https://www.materialpalette.com

// Define a light theme
$light-primary: mat.define-palette(mat.$grey-palette);
$light-accent: mat.define-palette(mat.$blue-gray-palette);
$light-warn: mat.define-palette(mat.$deep-orange-palette);
$light-theme: mat.define-light-theme(
(
color: (
primary: $light-primary,
accent: $light-accent,
warn: $light-warn,
),
)
);

// Define a dark theme
$dark-primary: mat.define-palette(mat.$grey-palette, 900);
$dark-accent: mat.define-palette(mat.$blue-gray-palette, 900);
Expand All @@ -34,7 +20,22 @@ $dark-theme: mat.define-dark-theme(
)
);

// Define a light theme
$light-primary: mat.define-palette(mat.$grey-palette);
$light-accent: mat.define-palette(mat.$blue-gray-palette);
$light-warn: mat.define-palette(mat.$deep-orange-palette);
$light-theme: mat.define-light-theme(
(
color: (
primary: $light-primary,
accent: $light-accent,
warn: $light-warn,
),
)
);

// Apply the dark theme by default
@include mat.core-theme($dark-theme);
@include mat.all-component-themes($dark-theme);

// angular extensions theming
Expand All @@ -60,7 +61,7 @@ $color-accent-800: mat.get-color-from-palette($dark-accent, 800);

.dark-theme {
color: $color-primary-500;
background-color: $color-primary;
background-color: $color-primary !important;
min-height: 100vh;
}

Expand All @@ -75,4 +76,5 @@ $color-accent-800: mat.get-color-from-palette($dark-accent, 800);
$color-warn: mat.get-color-from-palette($light-warn, 900);

background-color: "white" !important;
min-height: 100vh;
}
11 changes: 5 additions & 6 deletions Client/src/app/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ body {
// TOOLBAR
mat-toolbar {
font-family: Google Sans, Roboto, Arial, Helvetica, sans-serif;
color: $color-primary-700 !important;
// color: $color-primary-700 !important;

a {
text-decoration: none;
Expand All @@ -49,11 +49,11 @@ mat-toolbar {
color: $color-primary-500 !important;
}
}
}

.filler {
flex: 1 1 auto;
text-align: center;
}
.filler {
flex: 1 1 auto;
text-align: center;
}

mat-chip-list {
Expand Down Expand Up @@ -86,7 +86,6 @@ mat-radio-group {
padding: 16px;
}


// COMMON CONTROLS
.radio-button {
margin: 5px;
Expand Down
Loading

0 comments on commit d492ca3

Please sign in to comment.