Mathieu2301 / TradingView-API

📈 Get real-time stocks from TradingView
1.31k stars 307 forks source link

[FR] Pull a saved indicator template. #209

Open NVentimiglia opened 11 months ago

NVentimiglia commented 11 months ago

Is your feature request related to a problem? Please describe. Defining a chart setup with multiple indicators is difficult. It requires looking up the indicators, finding their id, and loading them one at a time. Moreover, if the indicator requires any custom settings we must learn each individual indicator's api to setup correctly. This is much work which is best handled graphically via the trading view API.

Describe the solution you'd like

  1. Define a trading view 'template' using the trading view app.
  2. Loading the indicator template via the API.

Describe alternatives you've considered It is possible to achieve complex chart setups via the current API however requires non-trivial amount of work for the user.

Additional context

return new Promise(async resolve => {
      const template= await TradingView.getTemplate(templateId);
      const study = new chart.Study(template);
      study.onError(err => {
        console.log(`LoadedTemplate Error ${template.pineId} ${err}`);
        resolve(null);
        study.remove();
      });
      study.onUpdate(() => {
        resolve(study);
        study.remove();
      });
    });