#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

## Quick Links

New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.

# candle size

I need help to phrase the following:
candle is long candle- 1. The Open -Close range yesterday was at least 50% of High Low range
(body at least as long as shadow) 2. The open-Close range today was at least 50% of toay's high-low range.

thanks for your help

## Comments

• mod
edited January 14
You need to compare the difference between the close and the open to the difference between the high and the low. You want the open:close difference to be greater than a certain fraction of the high:low difference.

But there is a problem.

The difference between the high and the low [high - low] is always positive, but, the difference between the open and the close [open - close] can be positive OR negative.

If the open:close difference is negative, it will always be less than the high:low fraction EVEN IF the absolute difference is greater, so you will not get hits you might want. So, you must always express the difference between the open and close as a positive number.

It would be nice if you could just use the absval( ) function to get a positive value for the open:close difference, but, as far as I know, that function only works on indicators like absval(MACD Hist(12,26,9). It does not evaluate statements with expressions and operators like absval(close - open) .

So, when you write your scan, you have to write [close-open], or [open - close], depending on which gives you a positive number.

To do that, you first have to test whether the close was above or below the open:

This looks for close above open

and [[close - open] > 0]

This looks for close below open

and [ [open - close] > 0]

Then you can write your comparison to high - low.

and [[close - open] > 0]
and [ [close - open] > [high-low] * .5]

Or, if close is below open:

and [[open - close] > 0]
and [ [open - close] > [high-low] * .5]

If you are comparing two days, there are four possible combinations for the open:close difference:

day 1 close >open, day 2 close > open;
day 1 close > open, day 2 close < open;
day 1 close < open, day 2 close > open;
day 1 close < open, day 2 close < open.

If you want only situations where the close is above the open for both days, just specify that.

So,

...

and [close - open]>0 ]

and [ [close - open] > [high - low] * .5 ]

and [ [1 day ago close - 1 day ago open] > 0]

and [ [1 day ago close - 1 day ago open] > [1 day ago high - 1 day ago low] * .5 ]

...

If you want all possible combinations, you need to join them into a large "or" statement.
Sign In or Register to comment.