Skip to main content

Unveiling the Morning Start Candlestick Pattern with Amibroker AFL

Decoding the Morning Start Candlestick Pattern

The Morning Star candlestick pattern, known for its bullish reversal potential, often emerges at a downtrend’s bottom. This three-candle formation starts with a bearish candle, followed by a small-bodied candle (bullish or bearish), and culminates in a bullish candle.

This pattern indicates a shift in market dynamics, with selling pressure diminishing and buyers gaining the upper hand, potentially reversing the trend.

The pivotal second candle reflects market hesitation, with neither buyers nor sellers in clear dominance. The third candle, signaling the bullish takeover, confirms the reversal. Traders frequently pair the Morning Star pattern with other indicators to validate buy signals.

Further Reading: Exploring the Balance of Power Indicator Amibroker AFL Code

Download the Morning Start Candlestick Pattern Amibroker AFL

				
					//------------------------------------------------------
//
//  Formula Name:    Morning Start Candlestick Pattern
//  Website:         https://zerobrokerageclub.com/
//------------------------------------------------------

_SECTION_BEGIN("Morning Start Candlestick Pattern");

SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} – {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

Plot( Close, "Price", colorWhite, styleCandle );

// Define the criteria for identifying the Morning Star pattern
// The pattern consists of three candles: a bearish candle, a small-bodied candle, and a bullish candle

// First candle is bearish
candle1Bearish =
    Ref( Close, -2 ) < Ref( Close, -1 ) AND
    Ref( Open, -2 ) > Ref( Close, -2 );

// Second candle is small-bodied (can be a doji or spinning top)

PrevClose = Ref(Close, -1); // Get the closing price of the previous candle
PrevOpen = Ref(Open, -1);   // Get the opening price of the previous candle
PrevHigh = Ref(High, -1);   // Get the highest price of the previous candle
PrevLow = Ref(Low, -1);     // Get the lowest price of the previous candle

PrevRange = PrevHigh - PrevLow;
PrevBody = Abs(PrevClose - PrevOpen);

candle2SmallBody = (PrevBody < (0.05 * PrevRange)); 


// Third candle is bullish
candle3Bullish = Open < Close AND
                 Close > Ref( Close, -1 );

// The pattern is complete when the three criteria are met
morningStar = candle1Bearish AND candle2SmallBody AND candle3Bullish;

// Plot an up arrow to indicate the Morning Star pattern
PlotShapes(IIf(morningStar, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(morningStar, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(morningStar, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);

_SECTION_END();


				
			

Preview of the Morning Start Candlestick Pattern AFL

Take a look at the AFL’s interface:

Morning-Start-Candlestick-Pattern-Amibroker-AFL

Understanding the AFL’s Mechanism

  • Our journey starts with setting the criteria for spotting the Morning Star candlestick pattern, which comprises three distinct candles – a bearish one, a small-bodied one, and a bullish one.
  • We utilize the Ref() function to reference the previous candles’ values for pattern criteria calculation. For instance, Ref(Close, -2) points to the closing price two periods back.
  • The initial step involves confirming the first candle’s bearish nature. We compare the opening and closing prices from two periods ago with the previous period’s closing and the opening from two periods ago.
  • Next, we ensure the second candle has a small body, indicating its opening and closing prices are closely aligned.
  • For the final step, we ascertain the bullish nature of the third candle by comparing its opening and closing prices with those of the previous two periods.
  • After establishing the Morning Star pattern criteria, we use the PlotShapes() function to mark an upward arrow on the chart whenever the pattern surfaces.

In essence, this AFL code identifies the Morning Star pattern by scrutinizing three specific candle types on the chart and marks an upward arrow when it appears.

More to Explore: Dive into the Weekly Breakout Trading Strategy Amibroker AFL Code

One Comment

Leave a Reply