Script Engine: Access to financial functions/Indicators
AwooOOoo opened this issue · 9 comments
Is your feature request related to a problem? Please describe.
Expose interface to the financial functions/Indicators that are available in the chart window.
Describe the solution you'd like
There are a lot of great functions/indicators drop-down in the chart window that I don't want to have to reinvent to build trading algorithms around so it would be good if there was a way to take advantage of them via the scripting interface. Perhaps we can expose a bunch of function handles you could call with their associated parameters.
First expose an indicators object;
{
accumulationDistribution: <function object>,
advanceDeclineLine: <function object>,
advanceDeclineRatio: <function object>,
...
...
}
Each function would take 1 'parameters' object which contains all of the parameters for that function. The description of the parameters for each function would be described in documentation.
Documentation
Bollinger Bands Indicator:
A Bollinger Band® is a technical analysis tool defined by a set of trendlines plotted two standard deviations (positively and negatively) away from a simple moving average (SMA) of a security's price, but which can be adjusted to user preferences.
Reference: [https://www.investopedia.com/terms/a/accumulationdistribution.asp]Input Parameters:
The bollinger bands indicator takes the following parameters as inputs.{ resolution: 'SAME_AS_SYMBOL', length: 20, source: 'close', stdDev: 2, offset: '0.0' }
Output:
The bollinger bans indicator returns the following structure.{ upperBandValue: '0.5714', lowerBandValue: '0.5523' }
Calling:
var bb = indicators.bollingerBands; // grabs the function handle var result = bb({resolution: 'SAME_AS_SYMBOL', length: 20, source: 'close', stdDev: 2, offset: '0.0'});
The indicator would have access to all of the historic data so that the indicator provides a valid response for the specific inputs.
Describe alternatives you've considered
It may be better to create an instance of the indicator and provide a callback so it is persistent as opposed to essentially creating it with each call which would likely use a lot more resources
@all-contributors add @AwooOOoo for feature requests
I couldn't determine any contributions to add, did you specify any contributions?
Please make sure to use valid contribution names.
@all-contributors add @AwooOOoo for ideas
I've put up a pull request to add @AwooOOoo! 🎉
@badgerwithagun,
Thanks for the add's. I wasn't familiar with the whole emoji / contributor thing and that getting added to channels could be automated. I'll try and remember that for future posts.
No need to do anything! I just add people when they make contributions.
Currently working on integrating https://github.com/ta4j/ta4j so we have programmatic access to indicators etc.
Any objections to this package or do you have any other preferences?
I believe there's already an issue open (a very early one) covering this.
No objections