tradecombine
Member
This post is about SCANNING for a megaphone pattern, which is also known as a broadening formation.Hello team,
I have recently enrolled. does anyone ever did the megaphone pattern setup on the SPX of any stocks, if so can you please share the study if possible. Thanks
If you are looking for DRAWING a megaphone on your chart, @Pelonsax has a rudimentary script that does that on the first post of this thread:
https://usethinkscript.com/threads/rob-smiths-the-strat-indicator-for-thinkorswim.3312/
Look for this text in the first post:
Pelonsax said:BROADENING FORMATIONS (1ST DRAFT)
This study will only find 1-3 combos and extend diagonal lines outward.
Anyway, you already know what a megaphone/broadening formation is, but I wanted to be sure to provide context for those who come upon this thread.
https://www.investopedia.com/terms/b/broadeningformation.aspInvestopedia said:A broadening formation is a price chart pattern identified by technical analysts. It is characterized by increasing price volatility and diagrammed as two diverging trend lines, one rising and one falling. It usually occurs after a significant rise, or fall, in the action of security prices. It is identified on a chart by a series of higher pivot highs and lower pivot lows.
So, my simple definition of broadening is taking out prior highs AND taking out prior lows.
I figure that if you zoom out far enough, it will show up as an outside bar on your chart.
#TheStrat calls this a 3. You can check out the @Pelonsax thread, linked above in this post, if you're curious about #TheSTRAT.
Anyway, on to the code:
First, there is an input called Window. The window defines the "number of bars" that you consider for taking out previous highs AND lows.
(For example, on higher time frames (monthly, quarterly, yearly), you can use windows of lesser bars and that will often be sufficient to show price action broadening in both directions.
On a lower time frame (day, 4-hour, 30-minute), you may need multiple bars to show broadening, to give price time to move from one side of the formation to the other.
The code defines a broadening as high taking out previous highs and low taking out previous lows. The high and low have to be taken out within the same window to be a valid broadening for this code.
The megaphone in this code requires back-to-back broadening: A broadening for the current Window against its prior Window, AND a broadening for the previous Window against its prior Window.
I've tested this scan with these parameters:
version 1: scan in: S&P 500, Timeframe: Quarter, input Window = 2
version 2: scan in: S&P 500, Timeframe = Daily, input window = 50;
Both sets returned somewhat reasonable-looking results on the daily timeframe. Might want to experiment with timeframes and windows to get something you like.
Code:
input window =50;
def highWindow = highest(high, window);
def lowWindow = lowest(low, window);
def broadening = highWindow > highWindow[window] && lowWindow < lowWindow[window];
def megaPhone = broadening && broadening[window];
plot scan = megaPhone;