Access value from custom indicator in pinescript
Posted: Sat Feb 27, 2021 6:55 pm
Hello, I'm having a terrible time trying to solve this (seemingly simple?) issue. I want to access another indicator's value and make use of it in my pinescript.
The other indicator is a slightly modified version of Chop Zone. For example, I renamed it Chop30 and I forced the resolution to 30. I also updated the plot on the Chop30 so that it provides me the emaAngle value I need like this:
From what I can tell, the Chop30 indicator is working correctly and I can see the value I want displayed on the screen when I hover over bars.
In my pinescript strategy, this is where I'm having difficulty accessing that value. For example I have done this:
and it was my understanding that this would return the indicator's plot value.
However, the value I get when I try to plot that value is the "close" value of the bar, not the emaAngle value that I need. On my pinescript inputs, I see the Chop30 selector, but it only contains the hardcoded pinescript defaults (open, high, low, close, etc...)
I am still researching how to get this value, but any tips would be appreciated. Thanks!
The other indicator is a slightly modified version of Chop Zone. For example, I renamed it Chop30 and I forced the resolution to 30. I also updated the plot on the Chop30 so that it provides me the emaAngle value I need like this:
Code: Select all
plot(emaAngle, color=chopZoneColor, style=plot.style_columns)
In my pinescript strategy, this is where I'm having difficulty accessing that value. For example I have done this:
Code: Select all
chop30 = input(title="Chop30", type=input.source, defval=close)
However, the value I get when I try to plot that value is the "close" value of the bar, not the emaAngle value that I need. On my pinescript inputs, I see the Chop30 selector, but it only contains the hardcoded pinescript defaults (open, high, low, close, etc...)
I am still researching how to get this value, but any tips would be appreciated. Thanks!