5

Let's say I want to include the AO indicator as part of the criteria for my Pine script. How can a pine script access indicators? Can a strategy or study import a series generated by another Pine script or built-in indicators?

PineCoders-LucF
  • 8,288
  • 2
  • 12
  • 21
tiz.io
  • 12,510
  • 1
  • 18
  • 9

2 Answers2

5

You can't access indicators if they're not provided by built-in functions.
In your specific case of the Awesome Oscillator, you could calculate it yourself to get the series values.
See Awesome Oscillator (AO) for how it's calculated.

edit:
I just found out that it does seem to be possible if the desired indicator is on your chart.
See How can I use one script’s output as an input into another?

Screenshot of example with the Awesome Oscillator:

External Indicator

Bjorn Mistiaen
  • 6,459
  • 3
  • 18
  • 42
  • 1
    And if you were to use this `AO:AO` as a source, every time you make modifications to the code where Pine thinks it affected input arguments, it will reset it to `Close`. Also there is a Copy function on the right-click menu of your Indicators/Strategies. Now if you use another indicator as a source for your indicator, then this Copy function disappears. – karatedog Aug 11 '22 at 23:27
0

While indicators does not offer reusability in the way you mentioned. But, new libraries will surely does.

Have a look at libraries and examples of some indicators using them.

https://www.tradingview.com/scripts/?script_type=libraries

Not sure if awesome oscillator is present as part of any library. Feel free to write one if you think it can be useful.