technicalindicators
                                
                                
                                
                                    technicalindicators copied to clipboard
                            
                            
                            
                        Argument of type '{ period: any; prices: any; }' is not assignable to parameter of type 'MAInput'
I want to use technicalindicators in my Angular app written in TypeScript, but don't know how to import and use it?
What I want to do is calculating SMA(Simple Moving Averages) of an array.
EDIT:
I have installed technicalindicators module using npm i --save technicalindicators command. Then I imported it like this:
import {sma} from 'technicalindicators';
Then I tried to use it like this:
var prices = [1,2,3,4,5,6,7,8,9,10,12,13,15];
var period = 10;
  doSMA(period , prices){
    console.log('sma result is:' , sma({period, prices}));
  }
But I get this error message:
Argument of type '{ period: any; prices: any; }' is not assignable to parameter of type 'MAInput'
The class MAInput defined as:
class MAInput {
    period: number;
    values: number[];
}
You either need to change the prices variable name to "values" or explicitly pass the price array to "values" property:
doSMA(period, prices) {
    console.log('sma result is:' , sma({period, values: prices}));
}
                                    
                                    
                                    
                                
The class MAInput defined as:
class MAInput { period: number; values: number[]; }You either need to change the prices variable name to "values" or explicitly pass the price array to "values" property:
doSMA(period, prices) { console.log('sma result is:' , sma({period, values: prices})); }
Thank you very much!