0

Based on TradingView's built-in Auto Fib Retracement code, how to calculate and plot the price difference between 0 and 1. I cannot figure out how and where to grab the price value of these Fibonnacci levels in the pinescript code.

Example from the linked image : I'd like the indicator to minus 6737,7 (level 0) to 6710,2 (level 1) which gives 27,5.

Thanks !

Paul
  • 5
  • 3

1 Answers1

0

I've found a way :

price_0 = line.get_price(lineId4, bar_index)
price_1 = line.get_price(lineId11, bar_index)
amplitude = price_0 - price_1

lineId# is one of Auto Fib Retracement level.

I'm not expert in Pinescript so there may be better ways.

Paul
  • 5
  • 3