Moonboy_Morty
Pine Script Rookie
Pine Script Rookie
Posts: 1
Joined: February 7th, 2023

Fractal engulfing candle

Hi all,

I'm watching the video now about the fractal engulfing candle. And I just can't wrap my head around one thing.

In order to check if there has been a lower low or higher high in the last 10 days, you write:

swingHigh = high == ta.highest(high, 10) or high[1] == ta.highest(high, 10)
swingLow = low == ta.lowest(low, 10) or low[1] == ta.lowest(low, 10)

Why is the sign here == instead of => or =<?

We want to see whether in the last 10 days, any candle was equal or higher than the current high or equal or lower to the current low. Not whether its exactly the same as the current high or the current low.

Got totally frustrated after this video cause I followed all the logic everything makes perfect sense and then one thing happens that doesn't make any sense and I get internal errors haha.

Thanks! :zen:

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

Re: Fractal engulfing candle

Hey,

Yes, the check should be >= and <= ,

as using == will only work if at some point in the 10 bars the highs are equal which is more rare.

Return to “Pine Script Q&A”