简体   繁体   中英

Plot red candle open and close at or below 50% below mid point of candle

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( ie 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) ie body of candle size less than 50% but can open anywhere.

Any help would be grateful enter image description here

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)

Can i get a optional checkbox if if sell signal is below previous day HIGH

Example

Example - Valid Signal Example - Invalid Signal

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM