OPEN-SOURCE SCRIPT
AM - 7h Session Candles

Version 2.0.0
This is a major version because two defaults changed, so the tool behaves differently out of the box than v1.0.0 did.
NEW: SESSION BOUNDARY LINES
• Vertical lines on the real price bars showing where each 7-hour bucket starts, so it is obvious which stretch of chart each drawn candle is made of: the daily open (A starts), plus 7 hours (L starts), plus 14 hours (N starts), and where N ends.
• They cover exactly the buckets the strip is showing and no more, so raising "Sessions back" extends the lines along with the candles. There is no second control that can fall out of step with the first.
• The times come from the same daily-open arithmetic that decides which minute belongs to which bucket, never from a fixed clock, so a line cannot drift away from the candle it marks on any symbol or across a daylight saving change.
• Drawn on 1 hour charts and below only. Above that a 7-hour boundary falls too far inside a single bar for the line to mark anything useful. The candles themselves are unaffected on every timeframe.
• Own input group: show, colour, style and thickness. Drawn light grey at a fixed 25 percent opacity, so a boundary reads as a reference mark rather than competing with the price action.
CHANGED DEFAULT: THE 3 HOUR OVERNIGHT STUB IS NOW PART OF N
• New "NY 7h Candle Data Composition" dropdown. The new default, "NY plus 3h Overnight Stub", folds the last three hours of the day into the same N candle, so N runs from hour 14 to the end of the day and nothing is discarded.
• Why: dropping those hours left three hours of price action in no candle at all, so one day's N closed and the next day's A opened with a hole between them that nothing on the strip accounted for. Including them gives an unbroken day, with every minute in some candle and the bodies joining up.
• What it costs, stated plainly: a 10-hour N is no longer TradingView's own 7-hour bar, and it is no longer the three-equal-block model this tool credits to AMTrades. Choose "NY 7h Candle" to restore both. That setting is exactly what v1.0.0 shipped as.
• The letter stays N either way and no fourth candle ever appears. Only N's high, low and close can move, and it keeps updating for three hours longer than before. Where a day never reaches hour 21 at all, a short regular session for instance, there is no stub and the setting has no effect.
REMOVED: VERTICAL POSITION
• The "Vertical Position" input and its "Centred on Current Price" mode are gone. The strip now always sits at true prices, so a session high or low reads straight across to where that level falls in the price action.
• Why: centred mode added a constant to every drawn price and recomputed it on every tick, so the whole strip slid up and down as price moved and the completed A, L and N candles looked as though they were still forming. It was the default, so that was the out of the box behaviour.
• If you had already selected "Relative Position", your strip is unchanged.
• The cost is that a wide strip is now counted by the chart's auto scale and can compress the price action. Pine cannot exempt an overlay drawing from the scale, so the levers are a lower "Sessions back" or turning auto scale off.
SETTINGS PANEL
• Every tooltip rewritten in short lines, with anything that is a list set out one item per line instead of running on as a paragraph. A settings dialog does not wrap a paragraph usefully and a long one arrived as a dense slab.
• Laid out one row per element rather than one control per line. The boundary lines are a single row: the toggle carrying the name, then the colour, the style, and the width. The three candle colours share a row, and Wick Width shares one with Label Size. Fifteen rows became six, and each field now sits against its own label instead of in the dialog's shared left aligned column.
• Both Opacity inputs are gone. The candles are fixed fully solid and the boundary lines fixed faint, each at exactly what its input used to default to, so a chart on the defaults looks the same as before. Two fewer controls to set.
SMALLER CHANGES
• Candle Width and Gap Between Candles are no longer inputs. They are fixed at 2 bars and 1 bar, down from the 6 and 3 v1.0.0 shipped with, for a tighter strip. The wick still sits on true centre because 2 is even. Offset From Last Bar is now the only layout control.
• The originator is now credited as AMTrades throughout, rather than "AM".
• Documented that Extended hours is not the same as 24 hours and what it contains depends on the feed. US equity extended hours are 04:00 to 20:00, which is 16 hours, so even with the setting correct N gets only the two hours left after A and L and is a 2-hour candle presented as a New York 7-hour one.
FEEDBACK
Please let me know if you experience any issues, or have feedback for improvements or additions in the comments below. Thank you, Tom
This is a major version because two defaults changed, so the tool behaves differently out of the box than v1.0.0 did.
NEW: SESSION BOUNDARY LINES
• Vertical lines on the real price bars showing where each 7-hour bucket starts, so it is obvious which stretch of chart each drawn candle is made of: the daily open (A starts), plus 7 hours (L starts), plus 14 hours (N starts), and where N ends.
• They cover exactly the buckets the strip is showing and no more, so raising "Sessions back" extends the lines along with the candles. There is no second control that can fall out of step with the first.
• The times come from the same daily-open arithmetic that decides which minute belongs to which bucket, never from a fixed clock, so a line cannot drift away from the candle it marks on any symbol or across a daylight saving change.
• Drawn on 1 hour charts and below only. Above that a 7-hour boundary falls too far inside a single bar for the line to mark anything useful. The candles themselves are unaffected on every timeframe.
• Own input group: show, colour, style and thickness. Drawn light grey at a fixed 25 percent opacity, so a boundary reads as a reference mark rather than competing with the price action.
CHANGED DEFAULT: THE 3 HOUR OVERNIGHT STUB IS NOW PART OF N
• New "NY 7h Candle Data Composition" dropdown. The new default, "NY plus 3h Overnight Stub", folds the last three hours of the day into the same N candle, so N runs from hour 14 to the end of the day and nothing is discarded.
• Why: dropping those hours left three hours of price action in no candle at all, so one day's N closed and the next day's A opened with a hole between them that nothing on the strip accounted for. Including them gives an unbroken day, with every minute in some candle and the bodies joining up.
• What it costs, stated plainly: a 10-hour N is no longer TradingView's own 7-hour bar, and it is no longer the three-equal-block model this tool credits to AMTrades. Choose "NY 7h Candle" to restore both. That setting is exactly what v1.0.0 shipped as.
• The letter stays N either way and no fourth candle ever appears. Only N's high, low and close can move, and it keeps updating for three hours longer than before. Where a day never reaches hour 21 at all, a short regular session for instance, there is no stub and the setting has no effect.
REMOVED: VERTICAL POSITION
• The "Vertical Position" input and its "Centred on Current Price" mode are gone. The strip now always sits at true prices, so a session high or low reads straight across to where that level falls in the price action.
• Why: centred mode added a constant to every drawn price and recomputed it on every tick, so the whole strip slid up and down as price moved and the completed A, L and N candles looked as though they were still forming. It was the default, so that was the out of the box behaviour.
• If you had already selected "Relative Position", your strip is unchanged.
• The cost is that a wide strip is now counted by the chart's auto scale and can compress the price action. Pine cannot exempt an overlay drawing from the scale, so the levers are a lower "Sessions back" or turning auto scale off.
SETTINGS PANEL
• Every tooltip rewritten in short lines, with anything that is a list set out one item per line instead of running on as a paragraph. A settings dialog does not wrap a paragraph usefully and a long one arrived as a dense slab.
• Laid out one row per element rather than one control per line. The boundary lines are a single row: the toggle carrying the name, then the colour, the style, and the width. The three candle colours share a row, and Wick Width shares one with Label Size. Fifteen rows became six, and each field now sits against its own label instead of in the dialog's shared left aligned column.
• Both Opacity inputs are gone. The candles are fixed fully solid and the boundary lines fixed faint, each at exactly what its input used to default to, so a chart on the defaults looks the same as before. Two fewer controls to set.
SMALLER CHANGES
• Candle Width and Gap Between Candles are no longer inputs. They are fixed at 2 bars and 1 bar, down from the 6 and 3 v1.0.0 shipped with, for a tighter strip. The wick still sits on true centre because 2 is even. Offset From Last Bar is now the only layout control.
• The originator is now credited as AMTrades throughout, rather than "AM".
• Documented that Extended hours is not the same as 24 hours and what it contains depends on the feed. US equity extended hours are 04:00 to 20:00, which is 16 hours, so even with the setting correct N gets only the two hours left after A and L and is a 2-hour candle presented as a New York 7-hour one.
FEEDBACK
Please let me know if you experience any issues, or have feedback for improvements or additions in the comments below. Thank you, Tom
สคริปต์แบบโอเพนซอร์ส
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์แบบโอเพนซอร์ส
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน