Skip to main content

Master Candle Exploration AFL: A Key Pattern in Price Action Trading

The Master Candle is an acclaimed pattern in price action trading, known for its precision in spotting potential breakouts. Professional traders frequently use it to predict market trends and make decisive long or short trades. Our specially crafted master candle exploration AFL significantly reduces analysis time by highlighting these breakout signals. This tool showcases the Master Candle levels of stocks in your watchlist, along with their Open, High, Low, and Close values.

Demystifying the Master Candle

For those new to the concept, the Master Candle consists of a larger ‘mother’ candle followed by 3-4 smaller ‘baby’ candles, all encompassed by the mother candle’s range.

Master-Candle-SetupA breakout above or below the mother candle’s extremes signals a notable trading opportunity.

For a comprehensive understanding of the Master Candle, its interpretation, and practical examples, refer to this detailed article.

Efficient Analysis with Master Candle Exploration AFL

The Master Candle exploration AFL performs these functions:

  1. It identifies Master Candles for any given symbol based on specific conditions:
    • Master Candle High > Highs of the next 4 candles
    • Master Candle Low < Lows of the next 4 candles
  2. After pinpointing the Master Candles, it examines the most recent candle to see if its high or low surpasses the Master Candle’s high or low. This candle should be within the first three candles following the last child candle of the Master Candle setup.

Master Candle Exploration AFL Code

				
					//------------------------------------------------------
//
//  Formula Name:    Master Candle Exploration AFL
//  Website:         https://zerobrokerageclub.com/
//------------------------------------------------------

_SECTION_BEGIN("Master Candle Exploration");

MC = H>Ref(H,1) AND H>Ref(H,2) AND H>Ref(H,3) AND H>Ref(H,4) AND L<Ref(L,1) AND L<Ref(L,2) AND L<Ref(L,3) AND L<Ref(L,4);

MCHigh = ValueWhen(MC,H);
MCLow = ValueWhen(MC,L);
MCRange = MCHigh-MCLow;

BreakoutCandleCond = (Ref(MC,-5) OR Ref(MC,-6) OR Ref(MC,-7));

LongBreakout =  BreakoutCandleCond AND H>MCHigh;
ShortBreakout = BreakoutCandleCond AND L<MCLow;

LongBreakoutStr = WriteIF(LongBreakout,"YES","NO");
ShortBreakoutStr = WriteIF(ShortBreakout,"YES","NO");
  
Filter = LongBreakout OR ShortBreakout;
 
AddColumn(Close, "Close", 1.2,colorBlack,colorLightGrey,width=100);
AddColumn(Open, "Open", 1.2,colorBlack,colorLightGrey,width=100);
AddColumn(High, "High", 1.2,colorBlack,colorLightGrey,width=100);
AddColumn(Low, "Low", 1.2,colorBlack,colorLightGrey,width=100);
AddColumn(MCHigh, "Master Candle High", 1.2, colorBlack, colorLightOrange,200);
AddColumn(MCLow, "Master Candle Low", 1.2, colorBlack, colorAqua,200);
AddColumn(MCRange, "Master candle Range", 1.2, colorBlack, colorPaleTurquoise,200);
AddTextColumn(LongBreakoutStr, "Long Breakout",format=1.2,colorWhite,colorGreen);
AddTextColumn(ShortBreakoutStr, "Short Breakout",format=1.2,colorWhite,colorRed);

_SECTION_END();
				
			

This code is compatible with Amibroker version 6 and higher. Download the Amibroker trial version from this link.

Utilizing the Master Candle Exploration AFL

Step 1: Launch Amibroker, navigate to File –>New –>Formula, and paste the exploration code you downloaded.

Step 2: Go to File –>New –>Analysis and set the appropriate timeframe.

Step 3: In the ‘Apply to’ dropdown, select ‘All symbols’ or choose specific stocks. In the range dropdown, opt for ‘1 recent day(s)’ to analyze the most recent candle. Then, select the AFL code in the ‘Formula’ box.
Master-Candle-Exploration-AFL

Note: This exploration AFL can be applied to any timeframe.

Deciphering the Master Candle Exploration Code

Let’s dive into the details of the exploration code.

Primarily, this is an exploration code, meaning it’s not usable on Amibroker charts.

The code starts by identifying all Master Candles from your database:

Master-Candle-Exploration-AFLIt applies a straightforward logic: if a candle’s high is greater than the highs of the next 4 candles and its low is less than the lows of the next 4 candles, it’s classified as a Master Candle (MC).

Subsequently, the code stores the Master Candle’s high and low in variables MCHigh and MCLow. The range of the Master Candle (MCRange) is the difference between MCHigh and MCLow.

Master-Candle-Exploration-AFL

For a breakout, the code identifies if the first, second, or third candle after the last child candle of the Master Candle setup breaks either high or low of the Master Candle:

Master-Candle-Exploration-AFL

A long breakout occurs if the candle breaks above the Master Candle’s high, while a short breakout happens if it falls below its low:

Master-Candle-Exploration-AFL

The filter then selects symbols where either a LongBreakout or ShortBreakout condition is met.

Master-Candle-Exploration-AFL

Finally, the code adds all calculated variables to the exploration using AddColumn() or AddTextColumn() functions, with appropriate color-coding for clarity.

Master-Candle-Exploration-AFL

2 Comments

Leave a Reply