Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use the library #4

Open
avrezvanov opened this issue Dec 29, 2020 · 3 comments
Open

How to use the library #4

avrezvanov opened this issue Dec 29, 2020 · 3 comments

Comments

@avrezvanov
Copy link

How to use the library.
For example the Stochastic indicator.

public static RetCode Stoch (
double [] inHigh, double [] inLow, double [] inClose, int startIdx, int endIdx, double [] outSlowK, double [] outSlowD, out int outBegIdx, out int outNbElement, MAType optInSlowKMAType = MAType.Sma, MAType optInSlowDM .Sma, int optInFastKPeriod = 5, int optInSlowKPeriod = 3, int
optInSlowDPeriod = 3);

The first three parameters (inHigh, inLow, inClose) are clear without explanation, but what the rest of the parameters (startIdx, endIdx, outSlowK, outSlowD, outBegIdx, outNbElement) mean is not clear.

You can give an example of use Stochatic.

@HollandRisley
Copy link

Hi @hmG3, I also would love to know how to use this library. Can you point me to any example code to just do a Simple Moving Average or RSI for example.. Thanks! Is there a reference guide or WIKI that you can point me to?

@HollandRisley
Copy link

Hi, for anyone trying to work this out, as there is no documentation that I could see, I thought I'd post a code snippet that is working for me. This successfully calculates a 21 EMA:

`

        // Calculate EMA 21 period

       var closesArray = closes.ToArray();

        int outBegIdx = 0;
        int outNbElement = 0;

        double[] outarray = new double[closesArray.Count()-20];

        try
        {
            TALib.Core.Ma(closesArray, 0, closesArray.Count()-1, outarray, out outBegIdx, out outNbElement, Core.MAType.Ema, 21);
        }
        catch (Exception ex)
        {
            Console.WriteLine($"exception calculating EMA 21: " + ex.Message);
        }

        var i = 0;
        var outCount = 0;
        foreach( FullMarketData dataItem in fullMarketData)
        {
            if (i >= outBegIdx)
            {
                dataItem.EMA21 = outarray[outCount];
                Console.WriteLine($"{dataItem.Timestamp} - EMA8: { dataItem.EMA21 } Close: {dataItem.Close}");
                outCount++;
            } else
            {
                Console.WriteLine($"{dataItem.Timestamp} - no data");
            }

            i++;
        }

`

Repository owner deleted a comment Jan 1, 2024
Repository owner deleted a comment from s-ikeda141104 Jan 28, 2024
Repository owner deleted a comment from s-ikeda141104 Jan 28, 2024
@corysimmons
Copy link

Well, GitHub had a good run.

Repository owner deleted a comment from Jcillo507 Feb 23, 2024
Repository owner deleted a comment from andrewluetgers Feb 23, 2024
@github-staff github-staff deleted a comment from 0legR Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@corysimmons @HollandRisley @avrezvanov and others