anandanand84 / technicalindicators

A javascript technical indicators written in typescript with pattern recognition right in the browser
MIT License
2.15k stars 557 forks source link

Error: Uncaught SyntaxError: Invalid regular expression on loading index.html #133

Closed KashyapCKotak closed 6 years ago

KashyapCKotak commented 6 years ago

**I downloaded this from npm as instructed and wrote this in index.html:

in browser and got this error in esprima.js:**

image

I am new to node and have no idea whats going on. how can I solve this issue? Please help :)

anandanand84 commented 6 years ago

I am not sure can you show me an github example. This packages is not dependent on esprima.js or softmax.js

KashyapCKotak commented 6 years ago

Thanks for your prompt response :) The above issue was resolved when I replaced with https://unpkg.com/technicalindicators@1.1.11/dist/browser.js. Not sure why it didn't work through packages downloaded from npm. I didn't perform the bower install step. Hope that was not a problem.

I wanted to know one more thing: When I pass data to MACD (SMA), which has 61 data points, only 36 MACD data points are returned. Shouldn't it be 61 data points returned? or am I missing something?

The code I am using to test is what you provided at https://tonicdev.com/anandaravindan/macd. Thanks

KashyapCKotak commented 6 years ago

Can anyone please reply to my question above? I am really confused.

anandanand84 commented 6 years ago

If you pass 61 data points and you set the period to 25 you will get only 36 data, it is because to calculate on data point of sma you need 25 data points. So you will always get 61 - period number of data points back. if you want you can prepend 0 or null in front