Renko chart's indicator value does not match GUI-based TradingView's, given same configurations
Both the code and the GUI-based TradingView chart have the exact same configurations - chart type, timeframe, regular session, box size, etc. Both also have the exact same indicator, CM_Ultimate_MA_MTF_V2. The issue is that the study.periods[0].MultiTimeframe_Moving_Avg indicator value output should be the same as the GUI-based TradingView chart, but unfortunately they are not the same.
const TradingView = require('../main');
const privateSessionId = process.env.TRADINGVIEW_SESSIONID;
const client = new TradingView.Client({
token: privateSessionId,
});
const chart = new client.Session.Chart();
chart.setMarket('NASDAQ:AAPL', {
session: 'regular',
type: 'Renko',
timeframe: '1',
inputs: {
source: 'close',
sources: 'Close',
boxSize: 3,
style: 'Traditional',
atrLength: 14,
wicks: true,
},
});
const publicFmp = TradingView.searchIndicator('CM_Ultimate_MA_MTF_V2').then(async (indicator) => {
indicator[0].source = '-',
console.log(
'*** Indicator information \n',
indicator[0],
);
const pineIndicator = await indicator[0].get();
const study = new chart.Study(pineIndicator);
study.onUpdate(() => {
console.log(
`\n*** Chart time and close:\n`,
chart.periods[0].time,
chart.periods[0].close
);
console.log(
'\n*** Indicator value:\n',
study.periods[0].MultiTimeframe_Moving_Avg,
);
})
})
TradingView-API Output

GUI-based TradingView Chart

Hello,
It's working for me when you remove inputs property in setMarket:
...
chart.setMarket('NASDAQ:AAPL', {
type: 'Renko',
timeframe: '1', // 1 minute
});
...
I tried with the Traditional style and I have the same problem as you.
I can't seem to find any patterns. There are some box size values that match perfectly and some that do not. I've compared the WS output from the Developer Networking tab and have confirmed that they do agree with the code - for example:
2: "={\"symbol\":{\"symbol\":\"NASDAQ:AAPL\",\"currency-id\":\"USD\",\"adjustment\":\"splits\",\"session\":\"regular\"},\"type\":\"BarSetRenko@tv-prostudies-40!\",\"inputs\":{\"source\":\"close\",\"sources\":\"Close\",\"boxSize\":3,\"style\":\"Traditional\",\"atrLength\":14,\"wicks\":true}}"
Any new developments on your end?
First, thank you for your work! I've got the same problem here with another private indicator. Setting a different option instead the default returns wrong values. Do you already got an idea how to solve this?
Hello, I didn't found any solution to this, and my TW Pro trial has expired. (I don't have the problem with higher timeframes...) I think that the only thing to do is to compare all sent WebSocket requests (browser vs API) and see where is the difference.
@VRspace4 did you solve it ?
I think that the only thing to do is to compare all sent WebSocket requests (browser vs API) and see where is the difference.
It could be a difference of just one char ! The comparaison must be perfect !
Thanks, i will analyse it