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

[REQUEST] Renko Chart #53

Open
rrfaria opened this issue Jun 21, 2019 · 3 comments
Open

[REQUEST] Renko Chart #53

rrfaria opened this issue Jun 21, 2019 · 3 comments

Comments

@rrfaria
Copy link

rrfaria commented Jun 21, 2019

Hi I would like to suggest a good one.

Renko chart is an amazing chart and helps a lot in analyse finance

Currently I'm using react-stockscharts to generate my charts but I noticed renko chart from them is missing the wicks like you can see on tradingview site.

And I saw your amazing chart and would like to suggest it.

I'm trying to change to vue js but until now I don't found any lib capable do that.

@Atem18
Copy link

Atem18 commented May 7, 2020

I am interested also

@Atem18
Copy link

Atem18 commented May 14, 2020

@rrfaria Actually, I found an easy way to do it.

Just create a bar chart like that:

this.chart = new Chart(this.$refs.backtestChart, {
    type: 'bar',
    data: {
        labels: renkoPoints,
        datasets: [{
            type: 'bar',
            label: 'Renko Prices',
            borderWidth: 1,
            data: renkoPrices,
            backgroundColor: renkoColors
        }]
    },
    options: {
        scales: {
            xAxes: [{
                categoryPercentage: 1.0,
                barPercentage: 1.0
            }]
        }
    }
})

For the variables, I generate them like that:

response.data.backtest_result = {"direction" : [0, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1], "price" : [9528.7, 9518.8, 9508.9, 9499, 9518.9, 9528.8, 9508.9, 9499, 9489.1, 9479.2, 9499.1, 9509, 9518.9, 9528.8, 9538.7, 9518.8, 9538.7, 9548.6, 9558.5, 9568.4, 9578.3, 9588.2, 9598.1, 9608, 9617.9, 9627.8, 9607.9, 9598, 9617.9, 9627.8, 9637.7, 9647.6, 9657.5, 9667.4, 9677.3, 9687.2, 9667.3, 9687.2, 9697.1, 9707, 9716.9, 9697, 9687.1, 9707, 9687.1, 9677.2, 9697.1, 9707, 9716.9, 9726.8, 9736.7, 9746.6, 9756.5, 9736.6, 9726.7, 9716.8, 9706.9, 9697, 9687.1, 9707, 9716.9, 9697, 9716.9, 9726.8, 9736.7, 9746.6, 9756.5, 9766.4, 9776.3, 9786.2, 9796.1, 9806, 9815.9, 9796, 9815.9, 9825.8, 9835.7, 9845.6, 9855.5, 9865.4, 9875.3, 9885.2, 9895.1, 9905, 9914.9, 9924.8, 9934.7, 9914.8, 9904.9, 9895, 9914.9, 9895, 9885.1, 9875.2, 9865.3, 9855.4, 9845.5, 9835.6, 9825.7, 9815.8]}
var renkoColors = [];
var renkoPrices = [];
for (let i = 1; i < response.data.backtest_result.direction.length; i++) {
    var direction = response.data.backtest_result.direction[i];
    if (direction === 0 || direction === -1) {
        renkoColors.push('rgba(255, 82, 82)')
    } else if (direction === 1) {
        renkoColors.push('rgba(76, 175, 80)')
    }
}
for (let j = 1; j < response.data.backtest_result.price.length; j++) {
    var previousPrice = 0
    var price = response.data.backtest_result.price[j];
    if (j === 1) {
        previousPrice = response.data.backtest_result.price[0]
    } else {
        previousPrice = response.data.backtest_result.price[j - 1]
    }
    renkoPrices.push([previousPrice, price])
}
var renkoPoints = []
for (let k = 1; k < renkoPrices.length; ++k) {
    renkoPoints.push(k.toString());
}

And that response.data.backtest_result JSON comes from an API request with Axios :)

@AzadCoder
Copy link

I'm interested too. In my new project, I have a lot of searches about the Renko chart in angular but I couldn't found any good result.

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

3 participants