I want to search a pattern in price column for eg: if the close price has .55 at the end like 129.55 or 160.55

The frac function can be used to return the fractional portion of the close price. However, depending on your data feed, that value may contain smaller residual amounts far off to the right of the decimal point, which can make a test for equality with a two digit decimal problematic, even using AlmostEqual. You can therefore combine frac with int to isolate just the cents. Then use `AlmostEqual`

or `==`

to test for equality.

```
FullFraction = frac(C); // All decimal portion of price
JustCents = int(frac(C) * 100) / 100; // just "cents"
TargetPrice = .55;
//Filter = AlmostEqual(JustCents, TargetPrice);
Filter = 1;
AddColumn(C, "Close", 1.6);
AddColumn(FullFraction, "FullFraction", 1.6);
AddColumn(JustCents, "JustCents", 1.6);
AddColumn(AlmostEqual(FullFraction, TargetPrice), "AlmostEqual(FullFraction, TargetPrice)", 1);
AddColumn(FullFraction == TargetPrice, "FullFraction == TargetPrice", 1);
AddColumn(AlmostEqual(JustCents, TargetPrice), "AlmostEqual(JustCents, TargetPrice)", 1);
AddColumn(JustCents == TargetPrice, "JustCents == TargetPrice", 1);
```

2 Likes

Thank you for your reply

will try this.