I would like to know the exact entry and exit prices for the 'alertconditions' I know this can be done for a 'strategy script, but I can't get it to work for an 'indicator'.
the code below doesn't work.
plotshape(entry, title='Long Enter', color=color.new(#2d9331, 0), style=shape.cross, location=location.absolute, size=size.small, xloc=xloc.bar_index, yloc=entry_price, offset=0)
Error: Cannot use 'plotshape' in local scope
You have the error because you try to use plotshape inside a conditional block.
Use plotshape outside your conditional loop and use this condition inside the plotshape fonction on the color variable :
if MyCondition is true, your plotshape will draw, else the color will be na and nothing will be drawn.
You should modify your code like this :