Giter Club home page Giter Club logo

Comments (6)

haybb avatar haybb commented on August 15, 2024 1

Hello Daniel,
Thank a lot for all of this explanations
I've understand what I have to do
It will be done within the next few days
Hugo

from mplfinance.

DanielGoldfarb avatar DanielGoldfarb commented on August 15, 2024

Presently there is no way. We can look into possibly having mpf.plot() return values that it calculates.

from mplfinance.

haybb avatar haybb commented on August 15, 2024

I'd like to. This feature would be awesome.
I could contribute but I don't know how to do this at all...

from mplfinance.

DanielGoldfarb avatar DanielGoldfarb commented on August 15, 2024

I'd like to. This feature would be awesome.
I could contribute but I don't know how to do this at all...

I will be happy to guide you in making this enhancement. Give me a day or two to finish up my current enhancement, and I will provide some design/coding guidance to get you started.

In the meantime, you may want to familiarize youself with the code here starting with plotting.py, and mpf.plot(). You can email any questions about the code to me at [email protected] (or post them here). Thank you.

from mplfinance.

haybb avatar haybb commented on August 15, 2024

Ok thank you

from mplfinance.

DanielGoldfarb avatar DanielGoldfarb commented on August 15, 2024

@WHug0 - I hope you are doing well, and had a chance to familiarize yourself with the code. I will outline here changes needed for this request. I assume you know basic GitHub workflow (fork, clone, code, commit, push, pull-request) but if not let me know I will review it with you.

Regarding returning renko values, moving averages, and anything else mpf.plot() might calculate, I don't think we should return these things as the return value of the function, because mpf.plot() already has an option to return the Figure and Axes, and we should not confuse things by having the return value of mpf.plot() sometimes be plotting objects and sometimes be data.

I propose that you create a new kwarg, return_calculated_values, and the user wanting the calculated data would pass a variable containing an empty dict as the value for that kwarg, and mpf.plot() will fill that empty dict with the calculated values. Thus, for example:

 retdata = {}
 mpf.plot(df, type='renko', mav=(10,20), return_calculated_values=retdata)

The kwarg should be added to _valid_plot_kwargs() with a default value of None, and its validator should check to make sure the user passes only an empty dict.

All of the possible calculated values are available in this general vicinity of the code. These include brick_values, new_dates, mavprices, and only for the case of type=renko the variable volumes may contact calculated values (but not for other plot types). In an appropriate place near that part of the code, you can write code to insert the calculated values into the dict. Here is some pseudo code to give you an idea:

if config['return_calculated_values'] is not None:
    retdict = config['return_calculated_values']
    if ptype == 'renko':
        retdict['renko_bricks'] = brick_values
        retdict['renko_dates']  = new_dates
        if config['volume']:
            retdict[renko_volumes'] = volumes
    if mavgs is not None:
        for mav in mavgs:
             format a string like 'mav10' for a 10 period mav, etc.
             retdict['mav25'] = mavprices

That's the basic idea. Let me know if you have any questions, or if you want me to look at the code before you submit a pull request (after is fine too).

All the best. --Daniel

from mplfinance.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.