I'm trying to write a script based on the Ichimoku indicator and use the Lagging Span plot:
plot(close, offset = -displacement + 1, color=#43A047, title="Lagging Span")
into a condition like:
`laggingSpan = plot(close, offset = -displacement + 1, color=#43A047, title="Lagging Span")
if laggingSpan > high ...`
I tried just that and I was getting this error: "Error at 34:76 Cannot call 'operator >' with argument 'expr0'='laggingSpan'. An argument of 'plot' type was used but a 'simple float' is expected."
and then I tried
laggingSpan = close[-displacement + 1]
but I'm getting this error:
Invalid number of bars back [-25] within the history-referencing operator. The value must be >= 0.
Your idea with laggingSpan = close[-displacement + 1]
is right but you need to understand how the Ichimoku Cloud works.
The lagging span is the current price moved x-bars (typically 26) back in time. So, you see, the only way to know its value on a given bar is to know the future price. Don't we all want to know that?
But you can do the same thing you did for the leading span A and B. That will work.
leadingSpanA = leadLine1[displacement - 1]