anandanand84 / technicalindicators

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

Add support for the Parabolic Stop and Reverse indicator (PSAR) #68

Closed lteacher closed 7 years ago

lteacher commented 7 years ago

Hi,

I wanted to try and implement this indicator. I have based the logic on the interpretation from the Tulip Inidicators library.

Let me know your thoughts. Currently it doesn't seem that this indicator exists here so I figure its better than not having it.

anandanand84 commented 7 years ago

@lteacher Sure I'll verify and merge. Quick question, where did you take the test inputs and expected out?

lteacher commented 7 years ago

Yeah sorry I was planning on adding a comment on that. Actually the tests are not really good or accurate. I had a lot of trouble verifying the results.

Initially I used the results from the other library but the results are slightly out as that doesn't return the first calculation which means that it does't increment the acceleration either till next extreme point.

Anyways maybe could use a bit more testing and verification to ensure the values can be verified as the output is used in the expect so obviously thats not really a valid test at all as its not even verified against any other calculation.

anandanand84 commented 7 years ago

@lteacher Thank you for contributing to this repository.

The tests were not consistent with what is in http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:parabolic_sar, but it is close and also stock charts implementation does not return equal number of outputs. I tried this in chart shown below and it looked good, so merged it we can revisit it later and update the tests if necessary.

screen shot 2017-08-25 at 11 55 41 am

lteacher commented 7 years ago

Ok no worries. Just a note at your image, looks good but noticed that the max is usually .2 but you have it on .02 which is the same as the step increment so it isn't showing the decay one would usually expect.

Also on the readme link there is an accidental * character messing up the markdown link.

anandanand84 commented 7 years ago

yeah noticed after taking the screenshot.