本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//@version=6
indicator("North Node Sign Crossings", overlay = true, max_lines_count = 100, max_labels_count = 100)
const string SETTINGS = "North Node Signs"
const string HOUSE_SETTINGS = "House Interpretation"
const int VEDIC_ANCHOR = timestamp("26 Nov 2026 00:00 +0000")
const int VEDIC_START = timestamp("01 Jan 1960 00:00 +0000")
const int VEDIC_END = timestamp("01 Jan 2061 00:00 +0000")
const int ARIES = 0
const int TAURUS = 1
const int GEMINI = 2
const int CANCER = 3
const int LEO = 4
const int VIRGO = 5
const int LIBRA = 6
const int SCORPIO = 7
const int SAGITTARIUS = 8
const int CAPRICORN = 9
const int AQUARIUS = 10
const int PISCES = 11
bool enabled = input.bool(true, "Show transit lines", display = display.none)
bool vedicMode = input.bool(false, "Vedic Astrology Mode (Whole-Sign Houses)", group = HOUSE_SETTINGS, tooltip = "Unchecked: original PDF tropical True Node events. Checked: estimated constant-speed 30-degree sign entries, anchored to Capricorn on November 26, 2026 at 00:00 UTC by convention. The average full-cycle duration is calibrated from the PDF's Capricorn entries. Covers 1960-2060; not a verified sidereal ephemeris or Placidus calculation.", display = display.none)
string referenceAscendant = input.string("Not set", "Reference Ascendant sign", options = ["Not set", "Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces"], group = HOUSE_SETTINGS, tooltip = "Select the Ascendant sign of your fixed reference chart for the modeled sign convention. Its entire sign becomes house 1. This assigns houses only; it does not calculate or convert the Ascendant. Not set leaves house labels unavailable without hiding modeled transit lines.", display = display.none)
bool ariesOn = input.bool(true, "Aries", inline = "a", group = SETTINGS, display = display.none)
color ariesInk = input.color(#E64A19, "Color", inline = "a", group = SETTINGS, display = display.none)
bool taurusOn = input.bool(true, "Taurus", inline = "b", group = SETTINGS, display = display.none)
color taurusInk = input.color(#A66A00, "Color", inline = "b", group = SETTINGS, display = display.none)
bool geminiOn = input.bool(true, "Gemini", inline = "c", group = SETTINGS, display = display.none)
color geminiInk = input.color(#827717, "Color", inline = "c", group = SETTINGS, display = display.none)
bool cancerOn = input.bool(true, "Cancer", inline = "d", group = SETTINGS, display = display.none)
color cancerInk = input.color(#65A30D, "Color", inline = "d", group = SETTINGS, display = display.none)
bool leoOn = input.bool(true, "Leo", inline = "e", group = SETTINGS, display = display.none)
color leoInk = input.color(#00875A, "Color", inline = "e", group = SETTINGS, display = display.none)
bool virgoOn = input.bool(true, "Virgo", inline = "f", group = SETTINGS, display = display.none)
color virgoInk = input.color(#00838F, "Color", inline = "f", group = SETTINGS, display = display.none)
bool libraOn = input.bool(true, "Libra", inline = "g", group = SETTINGS, display = display.none)
color libraInk = input.color(#039BE5, "Color", inline = "g", group = SETTINGS, display = display.none)
bool scorpioOn = input.bool(true, "Scorpio", inline = "h", group = SETTINGS, display = display.none)
color scorpioInk = input.color(#3454D1, "Color", inline = "h", group = SETTINGS, display = display.none)
bool sagittariusOn = input.bool(true, "Sagittarius", inline = "i", group = SETTINGS, display = display.none)
color sagittariusInk = input.color(#7E57C2, "Color", inline = "i", group = SETTINGS, display = display.none)
bool capricornOn = input.bool(true, "Capricorn", inline = "j", group = SETTINGS, display = display.none)
color capricornInk = input.color(#C2185B, "Color", inline = "j", group = SETTINGS, display = display.none)
bool aquariusOn = input.bool(true, "Aquarius", inline = "k", group = SETTINGS, display = display.none)
color aquariusInk = input.color(#B71C1C, "Color", inline = "k", group = SETTINGS, display = display.none)
bool piscesOn = input.bool(true, "Pisces", inline = "l", group = SETTINGS, display = display.none)
color piscesInk = input.color(#707070, "Color", inline = "l", group = SETTINGS, display = display.none)
type NodeCrossing
int instant
int destination
bool backward
var array<NodeCrossing> crossings = array.new<NodeCrossing>()
var array<NodeCrossing> vedicCrossings = array.new<NodeCrossing>()
var array<line> strokes = array.new<line>()
var table paletteNotice = table.new(position.top_right, 1, 1)
var table houseNotice = table.new(position.bottom_right, 1, 1)
registerCrossing(int year, int month, int day, int hour, int minute, int second, string zone, int destination, bool backward = true) =>
array.push(crossings, NodeCrossing.new(timestamp(zone, year, month, day, hour, minute, second), destination, backward))
wholeSignHouse(int signIndex, int ascendantIndex) =>
(signIndex - ascendantIndex + 12) % 12 + 1
buildVedicCrossings() =>
float totalCycleDuration = 0.0
int cycleCount = 0
int previousCapricorn = na
for crossing in crossings
if crossing.destination == CAPRICORN
if not na(previousCapricorn)
totalCycleDuration += crossing.instant - previousCapricorn
cycleCount += 1
previousCapricorn := crossing.instant
if cycleCount == 0 or totalCycleDuration <= 0
runtime.error("Whole-Sign estimates require valid full-cycle Capricorn intervals in the PDF dataset.")
float stepDuration = totalCycleDuration / cycleCount / 12.0
int firstStep = int(math.floor((VEDIC_START - VEDIC_ANCHOR) / stepDuration))
int lastStep = int(math.floor((VEDIC_END - VEDIC_ANCHOR) / stepDuration))
for stepIndex = firstStep to lastStep
int entryTime = VEDIC_ANCHOR + int(math.round(stepIndex * stepDuration))
int signIndex = ((CAPRICORN - stepIndex) % 12 + 12) % 12
if entryTime < VEDIC_END
array.push(vedicCrossings, NodeCrossing.new(entryTime, signIndex, true))
if barstate.isfirst
registerCrossing(1961, 6, 10, 16, 27, 43, "GMT-4", LEO)
registerCrossing(1962, 12, 22, 23, 44, 13, "GMT-5", CANCER)
registerCrossing(1964, 8, 25, 7, 2, 0, "GMT-4", GEMINI)
registerCrossing(1966, 2, 19, 12, 2, 40, "GMT-5", TAURUS)
registerCrossing(1967, 8, 19, 13, 39, 9, "GMT-4", ARIES)
registerCrossing(1969, 4, 19, 2, 0, 15, "GMT-5", PISCES)
registerCrossing(1970, 11, 2, 2, 54, 23, "GMT-5", AQUARIUS)
registerCrossing(1972, 4, 27, 2, 40, 32, "GMT-5", CAPRICORN)
registerCrossing(1973, 10, 26, 21, 14, 26, "GMT-4", SAGITTARIUS)
registerCrossing(1975, 7, 9, 20, 25, 55, "GMT-4", SCORPIO)
registerCrossing(1977, 1, 7, 12, 44, 24, "GMT-5", LIBRA)
registerCrossing(1978, 7, 5, 6, 38, 35, "GMT-4", VIRGO)
registerCrossing(1980, 1, 5, 12, 17, 33, "GMT-5", LEO)
registerCrossing(1980, 1, 6, 18, 31, 45, "GMT-5", VIRGO, false)
registerCrossing(1980, 1, 12, 14, 11, 48, "GMT-5", LEO)
registerCrossing(1981, 9, 24, 5, 28, 1, "GMT-4", CANCER)
registerCrossing(1983, 3, 15, 21, 36, 59, "GMT-5", GEMINI)
registerCrossing(1984, 9, 11, 13, 33, 47, "GMT-4", TAURUS)
registerCrossing(1986, 4, 6, 2, 21, 36, "GMT-5", ARIES)
registerCrossing(1987, 12, 2, 0, 21, 20, "GMT-5", PISCES)
registerCrossing(1989, 5, 22, 7, 39, 2, "GMT-4", AQUARIUS)
registerCrossing(1990, 11, 18, 13, 48, 20, "GMT-5", CAPRICORN)
registerCrossing(1992, 8, 1, 16, 42, 27, "GMT-4", SAGITTARIUS)
registerCrossing(1994, 2, 1, 2, 20, 8, "GMT-5", SCORPIO)
registerCrossing(1995, 7, 31, 7, 43, 38, "GMT-4", LIBRA)
registerCrossing(1997, 1, 24, 19, 43, 7, "GMT-5", VIRGO)
registerCrossing(1998, 10, 20, 2, 16, 42, "GMT-4", LEO)
registerCrossing(2000, 4, 8, 21, 34, 6, "GMT-4", CANCER)
registerCrossing(2001, 10, 12, 23, 1, 24, "GMT-4", GEMINI)
registerCrossing(2003, 4, 13, 20, 56, 26, "GMT-4", TAURUS)
registerCrossing(2004, 12, 26, 2, 47, 9, "GMT-5", ARIES)
registerCrossing(2006, 6, 22, 5, 8, 26, "GMT-4", PISCES)
registerCrossing(2007, 12, 14, 19, 25, 18, "GMT-5", AQUARIUS)
registerCrossing(2009, 8, 21, 13, 47, 19, "GMT-4", CAPRICORN)
registerCrossing(2011, 3, 3, 7, 0, 8, "GMT-5", SAGITTARIUS)
registerCrossing(2012, 8, 29, 23, 5, 29, "GMT-4", SCORPIO)
registerCrossing(2014, 2, 18, 9, 50, 20, "GMT-5", LIBRA)
registerCrossing(2015, 11, 11, 20, 3, 5, "GMT-5", VIRGO)
registerCrossing(2017, 5, 9, 14, 27, 32, "GMT-4", LEO)
registerCrossing(2018, 11, 6, 13, 9, 4, "GMT-5", CANCER)
registerCrossing(2020, 5, 5, 1, 48, 30, "GMT-4", GEMINI)
registerCrossing(2022, 1, 18, 13, 49, 41, "GMT-5", TAURUS)
registerCrossing(2023, 7, 17, 15, 59, 36, "GMT-4", ARIES)
registerCrossing(2025, 1, 11, 18, 1, 31, "GMT-5", PISCES)
registerCrossing(2026, 7, 26, 20, 46, 22, "GMT-4", AQUARIUS)
registerCrossing(2028, 3, 26, 12, 2, 36, "GMT-4", CAPRICORN)
registerCrossing(2029, 9, 23, 7, 47, 21, "GMT-4", SAGITTARIUS)
registerCrossing(2031, 3, 20, 18, 30, 23, "GMT-5", SCORPIO)
registerCrossing(2032, 12, 1, 23, 38, 51, "GMT-5", LIBRA)
registerCrossing(2034, 6, 3, 12, 25, 9, "GMT-5", VIRGO)
registerCrossing(2035, 11, 30, 2, 27, 19, "GMT-5", LEO)
registerCrossing(2037, 5, 29, 5, 51, 59, "GMT-5", CANCER)
registerCrossing(2039, 2, 9, 23, 7, 18, "GMT-5", GEMINI)
registerCrossing(2040, 8, 11, 3, 47, 3, "GMT-5", TAURUS)
registerCrossing(2042, 2, 4, 4, 33, 57, "GMT-5", ARIES)
registerCrossing(2043, 8, 18, 10, 3, 8, "GMT-5", PISCES)
registerCrossing(2045, 4, 18, 16, 45, 40, "GMT-5", AQUARIUS)
registerCrossing(2046, 10, 18, 15, 52, 29, "GMT-5", CAPRICORN)
registerCrossing(2048, 4, 12, 4, 17, 20, "GMT-5", SAGITTARIUS)
registerCrossing(2049, 12, 14, 4, 40, 23, "GMT-5", SCORPIO)
registerCrossing(2051, 6, 28, 5, 21, 46, "GMT-5", LIBRA)
registerCrossing(2052, 12, 23, 12, 48, 8, "GMT-5", VIRGO)
registerCrossing(2054, 6, 21, 12, 0, 54, "GMT-5", LEO)
registerCrossing(2056, 3, 4, 2, 24, 12, "GMT-5", CANCER)
registerCrossing(2057, 9, 11, 4, 15, 15, "GMT-5", GEMINI)
registerCrossing(2059, 2, 28, 11, 52, 25, "GMT-5", TAURUS)
if vedicMode
buildVedicCrossings()
array<NodeCrossing> activeCrossings = vedicMode ? vedicCrossings : crossings
array<bool> visibleSigns = array.from(ariesOn, taurusOn, geminiOn, cancerOn, leoOn, virgoOn, libraOn, scorpioOn, sagittariusOn, capricornOn, aquariusOn, piscesOn)
array<color> palette = array.from(ariesInk, taurusInk, geminiInk, cancerInk, leoInk, virgoInk, libraInk, scorpioInk, sagittariusInk, capricornInk, aquariusInk, piscesInk)
array<string> signNames = array.from("Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces")
int ascendantIndex = array.indexof(signNames, referenceAscendant)
bool housesAvailable = vedicMode and ascendantIndex >= 0
if barstate.islast
if enabled and array.size(strokes) == 0
for crossing in activeCrossings
bool withinCoverage = not vedicMode or (crossing.instant >= VEDIC_START and crossing.instant < VEDIC_END)
if withinCoverage and array.get(visibleSigns, crossing.destination)
float upperAnchor = high > low ? high : low + syminfo.mintick
line stroke = line.new(crossing.instant, low, crossing.instant, upperAnchor, xloc = xloc.bar_time, extend = extend.both, color = array.get(palette, crossing.destination), style = line.style_solid, width = 2)
array.push(strokes, stroke)
if housesAvailable
int rahuHouse = wholeSignHouse(crossing.destination, ascendantIndex)
int oppositeSign = (crossing.destination + 6) % 12
int ketuHouse = wholeSignHouse(oppositeSign, ascendantIndex)
string houseText = "Rahu H" + str.tostring(rahuHouse)
string details = "Rahu enters " + array.get(signNames, crossing.destination) + " / Whole-Sign house " + str.tostring(rahuHouse)
details += "\nOpposite Ketu: " + array.get(signNames, oppositeSign) + " / house " + str.tostring(ketuHouse)
details += "\nReference Ascendant: " + referenceAscendant
details += "\n" + (crossing.backward ? "Retrograde crossing" : "Direct crossing")
details += "\nEvent UTC: " + str.format_time(crossing.instant, "yyyy-MM-dd HH:mm:ss", "UTC")
details += "\nEstimated constant-speed Whole-Sign dataset, calibrated from PDF Capricorn cycles."
details += "\nAnchor convention: November 26, 2026 at 00:00 UTC, entering Capricorn."
details += "\nNot verified astronomical or sidereal ingress times."
label.new(crossing.instant, upperAnchor, houseText, xloc = xloc.bar_time, yloc = yloc.price, color = array.get(palette, crossing.destination), style = label.style_label_down, textcolor = color.white, size = size.small, tooltip = details)
if enabled and vedicMode and not housesAvailable
table.cell(houseNotice, 0, 0, "Whole-Sign houses: reference Ascendant not set.", text_color = color.white, bgcolor = color.new(color.red, 15), text_size = size.small)
else
table.clear(houseNotice, 0, 0)
bool repeatedInk = false
for firstIndex = 0 to 10
for secondIndex = firstIndex + 1 to 11
repeatedInk := repeatedInk or array.get(palette, firstIndex) == array.get(palette, secondIndex)
if enabled and repeatedInk
table.cell(paletteNotice, 0, 0, "North Node: sign colors must be distinct.", text_color = color.white, bgcolor = color.new(color.red, 15), text_size = size.small)
else
table.clear(paletteNotice, 0, 0)