3

I am writing a script that calculates the angle of the trend and for the calculations to coincide with my chart, I use the same "Lock price to bar ratio" setting for the chart and the script. The problem is that each asset has a different price and for correct angle calculations, I need to manually change this setting for each asset. However, if you disable this setting and enable auto scaling, TradingView will automatically calculate the optimal price to bar ratio for the chart. Is there any formula for automatic calculation of this price to bar ratio or other solutions to the problem?

"Lock price to bar ratio" button:

"Lock price to bar ratio" button

willcrack
  • 1,794
  • 11
  • 20
  • This ration is not accessible in Pine Script, but if you want to calculate angles, you might want to take a look [here](https://stackoverflow.com/questions/52650047/angle-of-line-in-pine-script) – Bjorn Mistiaen Dec 22 '20 at 12:38
  • 1
    @BjornMistiaen I calculate angles successfully. But if I want to apply the script to assets with different prices, the same "price to bar ratio" may not work and the angles will be calculated incorrectly. – Phantom_7331 Dec 22 '20 at 15:11

0 Answers0