EveryDayBetter
Pine Script Master
Pine Script Master
Posts: 27
Joined: February 16th, 2022

How to move a signal more below in the chart?

Is it possible to get the green cross (signal) above the red cross to the psoition of the red cross? That can be 2 or three percent under the bar.

Code: Select all

drawShape = false               
if CONDITION IS  FULFILLED
    drawShape := true 

plotshape(drawShape, color=#FFFF00, location=location.belowbar)
 
Image

processingclouds
Pine Script Master
Pine Script Master
Posts: 115
Joined: January 30th, 2022

Re: How to move a signal more below in the chart?

Hey,

Issue: You would like to define the location of the plotshape, by moving it by certain points vertically up or down.

Solution:
This is very much achievable. In plotshape, y coordinate is the value of the series, i.e. your initial parameter setting.

In your case you would like to move the shape certain points below the low position of the bar.

Code: Select all

// © processingclouds

//@version=5
indicator("My script", overlay = true)
plot(close)              
drawShape := true 

plotshape(drawShape ? low - 1 : na, color=#FFFF00, location=location.absolute)
As you can see i have passed a logic operation to the series that if your condition is true than plot at low value - 1, this will move it 1 below the low value. You can change this to any percentage calculation as you like.

Return to “Pine Script Q&A”