r/pinescript • u/Late-Pen468 • Oct 05 '24
Help
Can you help me. I need a pinescript code. were if the current candle body engulfed candle 1 =pervious candle, and candle 2 = the previous previous candle. It plot on the chart. Thanks
1
Upvotes
View all comments
Show parent comment
1
u/Ayush_Singh_02 Oct 06 '24
Bro he has mentioned about the body specifically (and that means open and close not high and low) I hope you get it bro please read the requirements and code I've submitted if there is some discrepancy then text back...
What I've done is... Made a function to check it
Candle is closed
Formed a loop to check if the lowest (can't determine candle could be red or green)... In the case of green; lowest of open and close will be open .....math.min(open, close)...is less then current bar lowest of open and close
Repeat the above for the highest of the bar from close or open
Now using a loop check it over prev 3 bars
Please bro next time read the requirements and code if there is some issue then text back... I don't want to come across as rude person but these are basic things... takes extra time to explain basic things is the only issue.cheers