Retest to a big green/red bar?

I am trying to code an AFL where I get to know if today's candle has retested to a big candle (either green or red). So what I excatly want to know is, if todays high has touched any previous (60 days) big red candle upper half (for sell setup) but not pierced its high or if today's low has touched any previous (60 days) big green candle lower half, but not pierced its low.

A big candle is where absolute movement for the day is atleast 4% ( its on daily basis)

AFL is based on programming and mathematics amongst others things to express logic.
A big candle is a very relative term, and cannot almost be expressed without some assumption.

For quicker and better replies, kindly go through this and see the tips you need to convey or express your question properly.

1 Like

I apologize for this. I have made the changes in the post.

Kindly help me out with this since I have been trying to figure out this for long time now.


@tanmayagrawal, can you please make your question clearer - it could be interpreted in many different ways, none of which satisfy your requirements.

Please define the following:

  • "big red candle"
  • "retest"
  • "green", "red"
  • "touched"
  • "candle upper half"
  • "not pierced its low"
  • "absolute movement"

Please see this post for an example:

1 Like


Here big candle means which have difference of atleast 5% between open and close
I want if another candle has retested to this big candle in a way if it has entered above midpoint of the big candle (high+low)/2.

in the screenshot, the arrow is the big candle

I guess you need to use valuewhen here