OPEN-SOURCE SCRIPT
更新済 Premium + Discount Ranges (M1D)

Premium + Discount Ranges
Measures the range you are trading inside, the way it is read by eye from the newest swing point on a chosen timeframe across to the swing of the opposite kind, split into premium and discount either side of an equilibrium. Three ranges can run at once, each on its own timeframe, so an execution range can be read inside the higher one that frames it.
Two ways to bound a range
Period takes the timeframe's own high and low so far: one month is one range, it starts empty at the open and is gone at the rollover. It answers where price sits in the month.
Swing takes the newest confirmed swing high across to the newest swing low on that same timeframe, which owes nothing to the calendar and can run across many periods. It answers which structural range price is inside right now.
Each range picks its own mode, and the chart says which: "1M High" is this month's high, "1M Swing High" is the monthly swing high.
What counts as a swing
A swing is a level price actually turned at, not merely a high that sits above its neighbours while price kept running the same way. The candle has to hold the extreme against a chosen number of candles either side of it, and by default it also has to mark the change of direction — a swing high on the turn from an up candle to a down one, a swing low on the turn from down to up. That second condition can be switched off to accept any candle holding the extreme, regardless of what it turned into.
Every swing is read from candles already closed on its own timeframe, one bar clear of the newest bar, so nothing on a forming higher-timeframe candle can confirm or unconfirm it.
The raided edge
A confirmed swing is the last level price turned at, which is not always the edge of the range being traded right now — the moment a boundary is taken, the real range is already wider than the swings describe. Each boundary is carried out to the extreme price has actually reached since its swing confirmed, and draws dotted while it is out there: a level price has not yet turned at is a raid in progress, not structure. It settles back to solid the moment a new swing confirms behind it. This can be switched off to pin both boundaries to confirmed swings only, with price free to trade outside the range.
Direction and shading
The range is read from whichever swing formed most recently. A new swing low means price has already turned up away from it, so the leg is bullish and discount is the side being worked from; a new swing high reads the other way. The first range is shaded premium and discount by default; the shading can optionally lean toward the side being worked from, fading the other side back. Ranges two and three draw as bare levels by default so a bias range never muddies the range being traded.
Anchoring and labels
Every boundary starts at the candle that set it, never drawn back across bars that closed before that price existed. The equilibrium and the shading begin at the later of the two swings, because a range has no midpoint until both ends exist.
Each range's names can follow the global label settings or override them: centred over the range's own span, to the left, to the right, at the swing that set the level, or off. Two names landing on the same price are merged into one label rather than left stacked; two that land close together without being the same level are separated by a blank line rather than overlapping.
The readout
One panel, two blocks. The first names each active range's timeframe, whether it fits under the chart's own timeframe, which way it is working, which half of it price is trading in, and how far through it price has travelled. The second is a calendar statistic rather than a swing one: the average daily, weekly and monthly range over a chosen number of completed periods, how much of that average the current period has already used, and a countdown to the period's close.
Alerts
Six. Price crossing into premium, price crossing into discount, price trading the equilibrium, the range high taken, the range low taken, and a new swing redrawing the range. All six read the range being traded — range one.
Method and repainting
Swings on ranges two and three are read on their own timeframe via a higher-timeframe request; range one's swing test is likewise timeframe-bound to whichever timeframe is chosen for it. Every swing reads only candles already closed, one bar back, so nothing about it depends on lookahead revealing an unclosed bar.
A confirmed boundary moves only when a genuinely new swing prints. The one part of the drawing that is live by design is a boundary carried out to a raid in progress, and it draws dotted so that is visible rather than implied.
What it will not do
It places no entries, exits, stops or targets, and it does not size a position. It draws no trend line, no bias score and no target projection beyond the range itself. It does not identify order blocks, fair value gaps or liquidity pools — only the swing highs and lows that bound the range and the equilibrium between them.
Settings
Per range: on/off, timeframe, Period or Swing, label placement override, swing strength, premium/discount shading, boundary width. Swing definition: whether a direction turn is required, whether a raided boundary is carried out to price. Shading: premium and discount colours, transparency, whether the shading leans with direction and by how much. Lines: boundary and equilibrium colour and width, how far boundaries extend past the last bar. Labels: side and nudge for the high, low and equilibrium of each range, whether premium/discount get their own names, the collision distance that separates two close labels, whether price is shown in the label, label size and colour. Readout: show/hide, position, size. Average ranges: show/hide, lookback length for each of daily, weekly and monthly, and whether the close countdown is shown.
Disclaimer
This is a decision-support tool for discretionary ICT trading. It is not financial advice, and no market's past behaviour is indicative of future results.
Measures the range you are trading inside, the way it is read by eye from the newest swing point on a chosen timeframe across to the swing of the opposite kind, split into premium and discount either side of an equilibrium. Three ranges can run at once, each on its own timeframe, so an execution range can be read inside the higher one that frames it.
Two ways to bound a range
Period takes the timeframe's own high and low so far: one month is one range, it starts empty at the open and is gone at the rollover. It answers where price sits in the month.
Swing takes the newest confirmed swing high across to the newest swing low on that same timeframe, which owes nothing to the calendar and can run across many periods. It answers which structural range price is inside right now.
Each range picks its own mode, and the chart says which: "1M High" is this month's high, "1M Swing High" is the monthly swing high.
What counts as a swing
A swing is a level price actually turned at, not merely a high that sits above its neighbours while price kept running the same way. The candle has to hold the extreme against a chosen number of candles either side of it, and by default it also has to mark the change of direction — a swing high on the turn from an up candle to a down one, a swing low on the turn from down to up. That second condition can be switched off to accept any candle holding the extreme, regardless of what it turned into.
Every swing is read from candles already closed on its own timeframe, one bar clear of the newest bar, so nothing on a forming higher-timeframe candle can confirm or unconfirm it.
The raided edge
A confirmed swing is the last level price turned at, which is not always the edge of the range being traded right now — the moment a boundary is taken, the real range is already wider than the swings describe. Each boundary is carried out to the extreme price has actually reached since its swing confirmed, and draws dotted while it is out there: a level price has not yet turned at is a raid in progress, not structure. It settles back to solid the moment a new swing confirms behind it. This can be switched off to pin both boundaries to confirmed swings only, with price free to trade outside the range.
Direction and shading
The range is read from whichever swing formed most recently. A new swing low means price has already turned up away from it, so the leg is bullish and discount is the side being worked from; a new swing high reads the other way. The first range is shaded premium and discount by default; the shading can optionally lean toward the side being worked from, fading the other side back. Ranges two and three draw as bare levels by default so a bias range never muddies the range being traded.
Anchoring and labels
Every boundary starts at the candle that set it, never drawn back across bars that closed before that price existed. The equilibrium and the shading begin at the later of the two swings, because a range has no midpoint until both ends exist.
Each range's names can follow the global label settings or override them: centred over the range's own span, to the left, to the right, at the swing that set the level, or off. Two names landing on the same price are merged into one label rather than left stacked; two that land close together without being the same level are separated by a blank line rather than overlapping.
The readout
One panel, two blocks. The first names each active range's timeframe, whether it fits under the chart's own timeframe, which way it is working, which half of it price is trading in, and how far through it price has travelled. The second is a calendar statistic rather than a swing one: the average daily, weekly and monthly range over a chosen number of completed periods, how much of that average the current period has already used, and a countdown to the period's close.
Alerts
Six. Price crossing into premium, price crossing into discount, price trading the equilibrium, the range high taken, the range low taken, and a new swing redrawing the range. All six read the range being traded — range one.
Method and repainting
Swings on ranges two and three are read on their own timeframe via a higher-timeframe request; range one's swing test is likewise timeframe-bound to whichever timeframe is chosen for it. Every swing reads only candles already closed, one bar back, so nothing about it depends on lookahead revealing an unclosed bar.
A confirmed boundary moves only when a genuinely new swing prints. The one part of the drawing that is live by design is a boundary carried out to a raid in progress, and it draws dotted so that is visible rather than implied.
What it will not do
It places no entries, exits, stops or targets, and it does not size a position. It draws no trend line, no bias score and no target projection beyond the range itself. It does not identify order blocks, fair value gaps or liquidity pools — only the swing highs and lows that bound the range and the equilibrium between them.
Settings
Per range: on/off, timeframe, Period or Swing, label placement override, swing strength, premium/discount shading, boundary width. Swing definition: whether a direction turn is required, whether a raided boundary is carried out to price. Shading: premium and discount colours, transparency, whether the shading leans with direction and by how much. Lines: boundary and equilibrium colour and width, how far boundaries extend past the last bar. Labels: side and nudge for the high, low and equilibrium of each range, whether premium/discount get their own names, the collision distance that separates two close labels, whether price is shown in the label, label size and colour. Readout: show/hide, position, size. Average ranges: show/hide, lookback length for each of daily, weekly and monthly, and whether the close countdown is shown.
Disclaimer
This is a decision-support tool for discretionary ICT trading. It is not financial advice, and no market's past behaviour is indicative of future results.
リリースノート
Shorter namesNames read 1H EQ, 1D Low and so on, without the word Swing and without the price. Prices can be switched back on under Labels, for 12H ranges and above; below that the levels sit close to price and the axis already reads them.
Session highs and lows are named
A range high or low that is also the high or low of the Asia, London or NY session says so, e.g. 1D Low + NY Low, so one level wears one name. The session times can be changed under Labels, and the whole thing switched off there. It reads the chart's own candles, so it runs on 1H charts and below.
Each range names its levels in its own column
With two or three ranges on, every name used to sit in one column at the right edge, so two ranges with levels a few points apart stacked their names on top of each other. Range 2 now reaches further right than range 1, and range 3 further again. Set how far with Extra bars per range under Lines; 0 puts every range back in one column. The right edge is also counted in bars of the chart's own session now, so a weekend no longer bunches every name onto the next open.
The shading fills the whole range
The premium and discount shading now starts where the range starts, at its first swing, instead of at the second. The high, the low and the equilibrium start there too, so the range reads as one block.
Separate colours for the chart and the table
The names on the chart and the readout each have their own colour, so the chart names can be faded without fading the table.
New defaults
Range 1 is 1H with its names centred, and the boundaries step up in weight with the timeframe: 1 for range 1, 2 for range 2, 3 for range 3. Require a direction turn is off.
Fixed a crash that could stop the script mid-session
The range's boundaries start at the swings that set them, which can sit thousands of chart bars back. Placing that anchor on the chart walks back through bar history, and the buffer Pine sizes for it is set from what past bars happened to need, so the first live bar that needed one bar more stopped the whole script with "requested historical offset is beyond the historical buffer's limit". The buffer is now set explicitly, and a swing older than the chart can reach anchors on the oldest reachable bar instead of failing. Nothing changes in what is detected or how it is drawn.
リリースノート
A Swing range now holds until a close breaks itA Swing range forms on a swing high and a swing low of its timeframe and then holds. A wick through a side that closes back inside is a sweep, and the range stays where it is. Swings that form inside the range do not move it. It rebuilds only when a candle of the range's own timeframe closes through a side. The far edge then moves to the extreme reached since the break and draws dotted while it follows price. Once price turns and that many candles close without exceeding it, the edge settles to solid. The near edge becomes the swing that launched the break. Everything is judged on the range's own closed candles, so the same range draws on every chart timeframe. Period ranges are unchanged.
Levels start on the candle that made them
A higher-timeframe high or low used to start at the open of the weekly or daily candle it belonged to, up to several days to the left of where price actually printed it. Each line now starts on the chart bar that made the level. A level older than the chart's loaded history still starts at its candle's open.
Names say Swing or Period
A Swing range's names read 1W Swing High, 1W Swing EQ and so on, and a Period range's read 1W High. The two are different levels and no longer share a name. Names on exactly the same price merge into one. Names that are merely close together stay at their own prices, each range in its own column. The old setting that pushed nearby names apart by a ATR distance has been removed.
The equilibrium is dotted
The range high and low stay solid while they hold. The equilibrium is a midline and now draws dotted.
A clearer table
Each range has one row: its timeframe, whether it is a Swing or Period range, which way it is working, whether price is in premium or discount, how far through the range price is, and whether a held edge has been swept since the range formed. Hover the premium or discount cell for the arithmetic. ADR, AWR and AMR stay below it.
Alerts follow the drawn range
Range high taken and Range low taken fire on a Swing range's held edges, and no longer on a far edge that is still following price. New dealing range fires when a Swing range rebuilds on a close or a Period range rolls over, not when a edge extends.
Fewer settings
Settings go from 60 to 33. Each range keeps Show, Timeframe, Range from, Label placement and Shade. One Swing strength now applies to all three ranges. Boundary widths are fixed at 1, 2 and 3, so the senior range reads heaviest. One text size and one text colour cover both the names and the table. The per-level label sides and nudges, the label gap, the ATR spacing, the shading lean and the session and average-range lengths are gone. The session windows stay at Asia 18:00-00:00, London 02:00-05:00 and NY 09:30-11:00 New York time, and the averages stay at 5 days, 4 weeks and 3 months.
リリースノート
Ranges stack by timeframeThe column a range names its levels in, the weight of its high and low lines, and its row in the table now follow its timeframe, not the slot it sits in. The lowest timeframe switched on draws at width 1 in the nearest column and lists first; each higher one reaches further right, draws one step heavier and lists below it. A Weekly range in Range 1 beside a 1H range in Range 2 now reads as the senior range. With the default setup nothing moves.
Premium and Discount are named again
Each half of the shaded range is named in bold in its own centre. The names go on one range only, the lowest timeframe that is shaded, so two or three sets never stack over each other.
New label placement: Inside corners
A fourth choice under Label placement for each range. The high is named just under its line and the low just over its own, inside the range at its right edge, so the names sit in the corners of the band instead of out past it. The equilibrium stays at the right. Right, Centred, Left and Off are unchanged.
リリースノート
Ranges stack by timeframeThe column a range names its levels in, the weight of its high and low lines, and its row in the table now follow its timeframe, not the slot it sits in. The lowest timeframe switched on draws at width 1 in the nearest column and lists first; each higher one reaches further right, draws one step heavier and lists below it. A Weekly range in Range 1 beside a 1H range in Range 2 now reads as the senior range. With the default setup nothing moves.
Premium and Discount are named again
Each half of the shaded range is named in bold in its own centre. The names go on one range only, so two or three sets never stack over each other. By default that is the lowest timeframe that is shaded, and Shading > Name Premium / Discount on picks another.
New label placement: Inside corners
A fourth choice under Label placement for each range. The high is named just under its line and the low just over its own, inside the range at its right edge, so the names sit in the corners of the band instead of out past it. The equilibrium stays at the right. Right, Centred, Left and Off are unchanged.
Gap from the lines is back
Under Lines, Gap from the lines (bars) sets how far past the right end of a line its name sits. The default is 2, the same spacing as before, so nothing moves on update. Raise it to push the names further right, clear of another indicator's labels at the same edge. Lines, shading and the other placements are unchanged.
A clearer table
The table is now one compact line per range, lowest timeframe first: whether it is a Swing or Period range, which way it is working, where price sits in it, and for a Swing range whether its held high and low have been swept (✓ swept, × not). Swept means a closed candle wicked through the level and closed back inside the range. ADR, AWR and AMR follow, each on one line with the share already used and the time left to its close. Hover any line for the prices and how it was worked out.
Choose which range is named Premium and Discount
Under Shading, Name Premium / Discount on picks the range that carries the bold names: the lowest shaded timeframe (the default, as before), the highest shaded timeframe, a chosen range, or Off. Naming a higher range keeps the names off the busiest part of the chart and leaves the lower ranges free to use Inside corners for their own labels.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。