TradingView-API icon indicating copy to clipboard operation
TradingView-API copied to clipboard

check study unexpected error

Open TimUnderhay opened this issue 1 year ago • 0 comments

Describe the bug When attempting to study a builtin indicator (DEMA), the client errors with check study unexpected error. I'm sure the issue is something I've done wrong, but I've attempted to follow the examples and read the jsDocs, but the error isn't enough to go on.

To Reproduce

const client = new TradingView.Client({
  token: 'sometoken',
  signature: 'somesignature'
});
const chart = new client.Session.Chart();
chart.setMarket(
  'BINANCE:BTCUSDT',
  {
    timeframe: '5',
    range: 100
  }
);
const demaProfile = new TradingView.BuiltInIndicator('STD;DEMA');

// I've tried with and without these options:
demaProfile.setOption('pineFeatures', '{"indicator":1,"plot":1,"ta":1}');
demaProfile.setOption('in_0', 63); // length
demaProfile.setOption('in_1', 'close'); // source
demaProfile.setOption('in_2', ''); // timeframe
demaProfile.setOption('in_3', true); // Wait for timeframe closes
demaProfile.setOption('__profile', false);

const study = new chart.Study(demaProfile)
study.onUpdate(
  () => {
    console.log(
      util.inspect(study.graphic, { showHidden: true, depth: Infinity, colors: true, showProxy: true })
    )
    client.end();
  }
);
// prints "check study unexpected error"

Expected behavior Expect no error

Screenshots If applicable, add screenshots to help explain your problem.

Environment:

  • OS: Ubuntu 24
  • Node version: 22.0

Additional context Add any other context about the problem here.

TimUnderhay avatar Apr 30 '24 17:04 TimUnderhay