Hi, I'm looking to write a program that identifies this specific ABC setup when it occurs (see image below). Basically there is a move up to pivot point A. The price drops to pivot point B. It moves up again to a point lower than A, forming point C. Then it drops down again forming a higher low (optionally consolidating for some time, but it doesn't have to) - eventually, it then begins to move up again to point C. This second move to point C is where I want this algorithm to identify this ABC pattern has occured.
Would anyone be able to point me in the right direction on a way I could write this?
Thanks in advance.
https://i.ytimg.com/vi/ExnfRPnzSmw/hqdefault.jpg
Michael Bloomfield
How will you identify Point A? When you do, store the value in a decimal variable.
How will you identify Point B? When you do, store the value in a decimal variable.
How much time since Point B before you look at Point C? When this duration since Point B has elapse, then store the value of Point C in a decimal variable.
Once you have all 3 variables, you can compare them to see if Point C is between Point A and Point B.
Levi Leckenby
Thanks Michael. What I'm having trouble doing is identifying these points accurately. I've written a program that looks at upward closing prices in a sequence (and downward ones in the case of B) but there is also noise that occurs in between. Sometimes there are occasionaly candles that move the other direction, but an overall upward move to form point A. I wondered if there was a formula to determine these price moves given noise.
Derek Melchin
Hi Levi,
We can detect the pattern when there is noise present by using the following snippet:
local_maximas_idx = argrelextrema(lookback, np.greater)[0] local_maximas = lookback[local_maximas_idx] # A is global maximum; Can't be the first element a = (local_maximas[lookback[local_maximas].argmax()], lookback[local_maximas].max()) # Find C = local maximum after A which has the same y-value as the most recent data point c_xs = local_maximas_idx[local_maximas_idx > a[0]] c_ys = lookback[c_xs] cs = list(zip(c_xs, c_ys)) c = [pair for pair in cs if pair[1] == lookback[-1]][0] # Find B = Global minimum between points A and B b_window = lookback[a[0] + 1: c[0]] b = (b_window.argmin() + a[0] + 1, b_window.min())
See the attached research notebook for reference.
Best,
Derek Melchin
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Levi Leckenby
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!