-4

i would appreciate some Help with pine code to plot sell signal for red candle close is at or below 50% below mid point of candle( i.e. open and close should be in the lower 50% of the body). Candle should be above 5ema and should not touch 5ema

Also if possible - option of Adjustment of candle formation ( if we want to change the lower 50% formation) i.e body of candle size less than 50% but can open anywhere.

Any help would be grateful enter image description here

1 Answers1

0

You can calculate the ema using ta.ema function. Then you can use plotshape function to plot the arrows by checking three conditions, red candle (close<open) - candle body below specified percentage open < high-(high-low)*percentBelow/100 - candle above 5ema low>ema .

    //@version=5
indicator(title="Sell Signals",overlay=true)
var percentBelow=input.int(50,"Percent Below")
var checkprvhigh=input.bool(false,"Check Prv Day High")
ema=ta.ema(close,5)
prvhigh=request.security(syminfo.tickerid,"D",high)
plot(prvhigh)
plot(ema)
plotshape(close<open and (close<prvhigh or not checkprvhigh) and open < high-(high-low)*percentBelow/100 and low>ema,style=shape.arrowdown,location=location.abovebar)
Rohit Agarwal
  • 1,258
  • 1
  • 3
  • 9