Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Pine script coding. I am using a variable long_above which is defiend inside the if block. I am getting error-Undeclared identifier 'long_above'

My code is given below. Can anyone edit my code so that I can be compiled

    // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © nibedit2irtmtc

//@version=5
indicator("My script", overlay = true)

if high[2] > high[3]
    if low[3] > low[2]
        long_above=high[2]

if high[2]>high[1]
    if low[2]<low[1]
        short_below=low[2]

plotshape(ta.crossover(close, long_above),style = shape.triangleup)

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel


 //@version=5
indicator("My script", overlay = true)
float long_above = na
float short_below= na
if high[2] > high[3]
    if low[3] > low[2]
        long_above:=high[2]

if high[2]>high[1]
    if low[2]<low[1]
        short_below:=low[2]

plotshape(ta.crossover(close, long_above),style = shape.triangleup)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading