My first attempt to code something. It's Mark Fischer concept of Pivot Range from his book Logical Trader. The strategy for using it is actually from Frank Ochoa's book Secrets of a Pivot Boss. Pivot Range is the "meat of the market" and "the heart beat of the market" according to him.
Here are some interesting details I found about the Pivot Range:
The Pivot Range is a confluence area that identifies where the market is likely to find support or encounter resistance based on the prior day’s trading. The Pivot Range identifies the areas where buyers are likely to show up (which is support) and where sellers are likely to show up (which is resistance). The Pivot Range will also help you to see an area where a significant move could occur if price can break through that area.
The key point to note is that the Pivot Range should give support at this price zone enabling you to take a long position with a defined low risk stop. If price is able to break below the Pivot Range then support would be broken and you would want to exit your trade.
A close above the range is bullish and a close below is bearish • A pivot range above the market is resistance and below the market is support • If the market moves through the pivot range you could expect a significant move in that direction. Trade Against The Pivot—You can use the pivot range to establish a position. The pivot range will act as support/resistance. If a stock opens above the pivot range and sells off to the range you can establish a long at the top of the pivot range. If a stock opens below the pivot range you can establish a short at the bottom of the pivot range. Your stop would be on the other side of the pivot range.
thinkScript Code
Code:
# Logical Trader's Pivot Range
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/aaiSbWNj-Pivot-Range-Pivot-Boss/
input aggregationPeriod = AggregationPeriod.DAY;
def PH = high(period = aggregationPeriod);
def PL = low(period = aggregationPeriod);
def PC = close(period = aggregationPeriod);
def pivot = (PH + PL + PC) / 3.0;
def bc = (PH + PL) / 2.0;
def tc = (pivot - bc) + pivot;
plot l1 = pivot[1];
plot l2 = bc[1];
plot l3 = tc[1];
l1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l1.SetDefaultColor(Color.white);
l1.SetLineWeight(1);
l2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l2.SetDefaultColor(Color.CYAN);
l2.SetLineWeight(1);
l3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l3.SetDefaultColor(Color.MAGENTA);
l3.SetLineWeight(1);
You can read more about the Pivot Range using the links below: