Technical Indicator API

It would be nice to have REST API to technical indicators. SMA and bollinger bands are my favorites. My math is ok but I don’t trust myself completely writing these. I use another service which is going start charging. It would be nice if Alpaca offered this.
Thank you.

As long as you have access to bars data, technicals like MAs and Bands are fairly easily to calculate and verify calculations on a site like tradingview…

Would you mind giving me some pseudocode on howe to achieve this?
Thank you.

What language are you working in? I would imagine there are existing libraries for this.

Java. I looked but couldn’t find anything yet.

I just found a library. When I was searching before I must have put in the wrong query. Thanks for pushing my blindness aside.

function 50MA (listOfBars) {
totalClosingPrice = 0;
listOfBars.foreach((x, index) => {
totalClosingPrice += x.closingPrice
if(index = 50){ break }
return (totalClosingPrice / 50)

here is a some psuedo-javascript example of taking in a list of bars(with your specified time frame) and returning a 50MA.

Look at anything TA-Lib based,

Agree that it would reduce the entry barriers if API could support indicators next to prices. Timeseries is a harder problems than it looks .

I used following python code the get ‘pandas’ output format.

df = api.alpha_vantage.techindicators(techindicator=‘RSI’, output_format=‘pandas’, symbol=‘AAPL’, interval=‘1min’, time_period=myperiod, series_type=‘close’)

But the output format is ‘json’. What is wrong? Please help!

What worked for me is to change the out put format to json

tsla_sma = api.alpha_vantage.techindicators(techindicator=‘SMA’,symbol=‘TSLA’, interval=‘60min’, time_period=‘20’, series_type=‘close’,output_format=‘json’)
tsla_sma_data = tsla_sma.pop(‘Technical Analysis: SMA’)
tsla_sma_meta = tsla_sma.pop(‘Meta Data’)

Once you got your dictionarys split out then convert them to a dataframe

tsla_sma_data_df = pd.DataFrame.from_dict(tsla_sma_data,orient=‘index’,dtype=‘float64’)