免责声明:GO Markets 分析师或外部发言人提供的信息基于其独立分析或个人经验。所表达的观点或交易风格仅代表其个人;并不代表 GO Markets 的观点或立场。
联系方式:
墨尔本 03 8658 0603
悉尼 02 9188 0418
中国地区(中文) 400 120 8537中国地区(英文) +248 4 671 903
作者:
Christine Li | GO Markets 墨尔本中文部
By
Christine Li
GO Markets 墨尔本中文部
The information provided is of general nature only and does not take into account your personal objectives, financial situations or needs. Before acting on any information provided, you should consider whether the information is suitable for you and your personal circumstances and if necessary, seek appropriate professional advice. All opinions, conclusions, forecasts or recommendations are reasonably held at the time of compilation but are subject to change without notice. Past performance is not an indication of future performance. Go Markets Pty Ltd, ABN 85 081 864 039, AFSL 254963 is a CFD issuer, and trading carries significant risks and is not suitable for everyone. You do not own or have any interest in the rights to the underlying assets. You should consider the appropriateness by reviewing our TMD, FSG, PDS and other CFD legal documents to ensure you understand the risks before you invest in CFDs. These documents are available here.
免责声明:文章来自 GO Markets 分析师和参与者,基于他们的独立分析或个人经验。表达的观点、意见或交易风格仅代表作者个人,不代表 GO Markets 立场。建议,(如有),具有“普遍”性,并非基于您的个人目标、财务状况或需求。在根据建议采取行动之前,请考虑该建议(如有)对您的目标、财务状况和需求的适用程度。如果建议与购买特定金融产品有关,您应该在做出任何决定之前了解并考虑该产品的产品披露声明 (PDS) 和金融服务指南 (FSG)。
在 Pine Script 中,for 循环是一种非常重要且高频使用的控制结构,主要用于在脚本中执行重复、可控次数的计算或操作。无论是遍历数组、逐项计算指标,还是在指定范围内生成图形元素,for 循环都能让代码更加简洁、高效和可读。与简单的条件判断不同,for 循环通过计数器精确控制迭代次数,使开发者能够清楚地掌握脚本的执行流程。理解 for 循环的语法结构、执行机制以及与 continue、break 等关键字的配合方式,是掌握 Pine Script 进阶编程的关键一步。本文将从基础概念入手,结合示例,系统地介绍 Pine Script 中 for 循环的用法与注意事项。
for 循环语句用于创建一种计数控制型循环,它通过一个计数器变量来管理其局部代码块的重复执行。计数器从预先定义的初始值开始,在每次迭代结束后按固定的步长递增或递减。当计数器达到指定的最终值时,循环停止迭代。
在 Pine Script 中,for 循环使用以下语法来定义:
[variables = | :=] for counter = from_num to to_num [by step_num]
下面这个简单的脚本演示了一个 for 循环:在最后一根历史 K 线执行脚本时,循环会在未来的柱索引位置绘制多个标签。该循环的计数器从 0 开始,每次增加 1,直到达到 10,此时执行最后一次迭代。
下面对这段 Pine Script 代码进行逐行解析。
声明这是一个指标脚本,并将指标名称设置为for loop example 1。该名称会显示在 TradingView 的指标列表和图表上。
设置一个条件判断语句,barstate.islastconfirmedhistory 在最后一根已确认的历史 K 线上返回 true。这样可以确保后面的代码只执行一次,避免在每根 K 线上重复创建标签。
定义一个 for 循环。计数器变量 i 从 0 开始,每次递增 1,直到 10 为止,一共执行 11 次迭代。
bar_index + i:标签绘制在当前 K 线之后第 i 根柱子的位置
0:标签在价格轴上的 y 坐标
str.tostring(i):将当前计数器 i 转换为字符串,作为标签文本
textcolor = color.white:设置文字颜色为白色
size = size.large:设置文字大小为大号
下面再举一个复杂一点的例子,下面的脚本用于计算并绘制 开盘价的成交量加权移动平均线(VWMA),计算范围为指定数量的 K 线。随后,脚本使用一个向下计数的 for 循环,将最后一根历史 K 线的数值与之前各根 K 线的数值进行比较,比较过程从所设定回看窗口中最早的一根 K 线开始。在每一次循环迭代中,脚本都会获取某一根过去 K 线的 vwmaOpen 值,计算它与当前 K 线数值之间的差值,并在该历史 K 线的开盘价位置通过标签显示计算结果。
最终效果如上所示:在主图中,脚本会对过去 15 根 K 线逐一计算其 VWMA 历史值与当前 VWMA 值之间的差异,并将结果以标签形式直接标注在对应的 K 线位置上。
本文围绕 Pine Script 中的 for 循环 展开,介绍了其基本语法、计数方式以及在实际指标中的应用。通过 VWMA 示例,演示了如何利用 for 循环回看历史 K 线、逐一计算并对比数据,并将结果直观地展示在主图上。同时,也指出了 overlay = true、barstate.islastconfirmedhistory 等常见但关键的细节问题。掌握 for 循环的正确用法,有助于编写更高效、清晰且可维护的 Pine Script 指标代码。
Global markets are calm but alert in response to the U.S.–Venezuela situation, with U.S. and European equities holding near or testing record levels.
Gains in energy, defence and materials suggest selective positioning. Modest strength in gold and lower yields is indicative of hedging rather than market fear, with oil prices remaining muted.
Quick facts:
U.S. and European equity indices are holding near record highs despite geopolitical headlines. Volatility remains low through the trading session.
Energy and defence stocks are leading gains, with materials stocks responding to mild gains in previous metals, reflecting selective risk positioning.
Gold is edging higher, and government bond yields have dipped slightly, signalling mild hedging.
Oil prices remain range-bound, suggesting no immediate supply shock is being priced in.
Markets could be sensitive to further geopolitical developments, with any escalation a major potential risk to sentiment.
U.S.–Venezuela tensions escalation has prompted heightened geopolitical scrutiny across the globe, not only related to this action itself but other geopolitical longer-term implications.
There has been a muted and measured response across global financial markets so far, with little significant negative impact evident for now.
Some sectors have had noteworthy gains, whilst the impact on other asset classes has again been calm.
US Equities
What’s happening:
U.S. equity markets are showing resilience, with the S&P 500 holding near recent highs and the Dow Jones Industrial Average up 1.23%, pushing into fresh record territory.
What to watch:
If U.S. indices continue to hold above recent breakout levels, then markets are reinforcing the view that geopolitical risk remains manageable.
Rising volatility, if seen in the VIX index, may indicate that sentiment may be shifting from selective risk-taking to broader caution.
European Equities
What’s happening:
European markets are modestly higher, with the DAX trading at record levels and the FTSE 100 closing over 10,000 for the first time.
What to watch:
For now, European indices appear to be tracking U.S. strength, suggesting investors are viewing the event as externally contained. Similar sectors are performing well, as seen in overnight US equity performance.
It is unlikely that we will see any specific regional response, though tensions related to the US administration's narrative around Greenland is noteworthy.
Specific Sector moves
Energy Stocks
What’s happening:
Energy stocks are leading equity gains across the U.S. (e.g. Chevron Corp – CVX up 5.1%), and European markets, with the potential for increased influence in Venezuela of US oil companies.
What to watch:
While energy equities outperform while oil prices remain range-bound, then markets are pricing geopolitical caution rather than immediate disruption. If this is accompanied by a rise in crude prices rise together, then it may be indicative of supply risk
Defence stocks are attracting some investor interest. (E.g. Lockheed Martin – LMT up 2.92%, General Dynamics – GD up 3.54%).
What to watch:
Continued outperformance with other sector equity drawdowns may be indicative of some escalation concerns.
Materials & Miners
What’s happening:
Materials and mining stocks are finding support alongside modest gains in precious metals and record highs in copper. The S&P Metals & Mining ETF – XME closed 3.28% up.
What to watch:
Ongoing materials strength alongside stable growth indicators, then the current move may reflect real-asset demand rather than simply a hedging approach. If gold accelerates higher while base metals fail to follow, then investor defensive positioning may be overtaking confidence in growth.
Crude Oil
What’s happening:
Oil prices remain subdued, with the futures trading at $58.40, within recent ranges, despite the unfolding geopolitical situation.
What to watch:
Venezuelan influence on global oil production is not substantial enough on its own to create any major issues in the short term with global oil supply at high levels.
As a result, the impact is more likely to remain muted, but any significant rises in oil price across multiple sessions may be indicative of some market concerns related to increases in geopolitical-influenced supply expectations.
Gold
What’s happening:
Gold prices are currently edging higher towards all-time highs, reflecting a modest safe-haven play. The closing price for Gold futures is $4454, breaching the psychologically important $4400.
What to watch:
If gold continues to rise gradually while equities remain firm, then the move reflects a standard hedging approach to assets rather than fear.
A spike in gold price alongside falling equities and rising volatility, maybe a signal that market risk may be increasing.
Treasury Yields
What’s happening:
Yields have eased slightly, indicating a potential selective defensive positioning in asset choice by institutional investors. (10-year treasury yields at 4.153%, down 0.36%)
What to watch:
If yields should fall sharply alongside equity weakness, then markets may be shifting toward a risk-off approach.
What to watch next
If asset-class correlations remain contained, then markets are maintaining confidence in the broader macro backdrop.
If tensions escalate into broader regional instability or prolonged policy responses, Sharp movements across equities, bonds, and commodities may signify a reassessment of risk.
If geopolitical developments fail to translate into sustained price dislocation, then the current response is likely to fade.
(All prices quoted correct as of 4.30pm NY time after market close).
在 Pine Script 中,for 循环是一种非常重要且高频使用的控制结构,主要用于在脚本中执行重复、可控次数的计算或操作。无论是遍历数组、逐项计算指标,还是在指定范围内生成图形元素,for 循环都能让代码更加简洁、高效和可读。与简单的条件判断不同,for 循环通过计数器精确控制迭代次数,使开发者能够清楚地掌握脚本的执行流程。理解 for 循环的语法结构、执行机制以及与 continue、break 等关键字的配合方式,是掌握 Pine Script 进阶编程的关键一步。本文将从基础概念入手,结合示例,系统地介绍 Pine Script 中 for 循环的用法与注意事项。
for 循环语句用于创建一种计数控制型循环,它通过一个计数器变量来管理其局部代码块的重复执行。计数器从预先定义的初始值开始,在每次迭代结束后按固定的步长递增或递减。当计数器达到指定的最终值时,循环停止迭代。
在 Pine Script 中,for 循环使用以下语法来定义:
[variables = | :=] for counter = from_num to to_num [by step_num]
下面这个简单的脚本演示了一个 for 循环:在最后一根历史 K 线执行脚本时,循环会在未来的柱索引位置绘制多个标签。该循环的计数器从 0 开始,每次增加 1,直到达到 10,此时执行最后一次迭代。
下面对这段 Pine Script 代码进行逐行解析。
声明这是一个指标脚本,并将指标名称设置为for loop example 1。该名称会显示在 TradingView 的指标列表和图表上。
设置一个条件判断语句,barstate.islastconfirmedhistory 在最后一根已确认的历史 K 线上返回 true。这样可以确保后面的代码只执行一次,避免在每根 K 线上重复创建标签。
定义一个 for 循环。计数器变量 i 从 0 开始,每次递增 1,直到 10 为止,一共执行 11 次迭代。
bar_index + i:标签绘制在当前 K 线之后第 i 根柱子的位置
0:标签在价格轴上的 y 坐标
str.tostring(i):将当前计数器 i 转换为字符串,作为标签文本
textcolor = color.white:设置文字颜色为白色
size = size.large:设置文字大小为大号
下面再举一个复杂一点的例子,下面的脚本用于计算并绘制 开盘价的成交量加权移动平均线(VWMA),计算范围为指定数量的 K 线。随后,脚本使用一个向下计数的 for 循环,将最后一根历史 K 线的数值与之前各根 K 线的数值进行比较,比较过程从所设定回看窗口中最早的一根 K 线开始。在每一次循环迭代中,脚本都会获取某一根过去 K 线的 vwmaOpen 值,计算它与当前 K 线数值之间的差值,并在该历史 K 线的开盘价位置通过标签显示计算结果。
最终效果如上所示:在主图中,脚本会对过去 15 根 K 线逐一计算其 VWMA 历史值与当前 VWMA 值之间的差异,并将结果以标签形式直接标注在对应的 K 线位置上。
本文围绕 Pine Script 中的 for 循环 展开,介绍了其基本语法、计数方式以及在实际指标中的应用。通过 VWMA 示例,演示了如何利用 for 循环回看历史 K 线、逐一计算并对比数据,并将结果直观地展示在主图上。同时,也指出了 overlay = true、barstate.islastconfirmedhistory 等常见但关键的细节问题。掌握 for 循环的正确用法,有助于编写更高效、清晰且可维护的 Pine Script 指标代码。
January’s market action often matters more than simply marking the opening of the calendar year. Institutional positioning resets, testing of economic assumptions, and early price moves reflect how market participants interpret the first meaningful signals of the year.
While January rarely determines full-year outcomes, it frequently shapes the narratives markets carry into the first quarter (Q1).
Four critical levers: growth, labour, inflation, and policy, can provide an early indication of how markets are processing and prioritising incoming information.
Growth: manufacturing PMIs
January’s first growth test comes from the manufacturing surveys, with markets watching whether signals from S&P Global Manufacturing PMI and ISM Manufacturing PMI tell a consistent story.
Key dates:
ISM Manufacturing PMI: 5 January, 10:00 AM (ET)/ 6 January, 1:00 AM (AEDT)
What markets look for:
Attention often centres on new orders as a forward-looking indicator of demand, alongside prices paid for early insight into cost pressures.
Broad strength across both surveys would support the narrative that the growth momentum seen toward the end of 2025 may extend into early 2026, easing some concerns about a sharper slowdown. Weaker or conflicting readings would keep the growth outlook uncertain, rather than decisively negative.
How it tends to show up in markets:
Firmer growth signals often appear first in higher short-dated Treasury yields. Rising yields can tighten financial conditions, weigh on equity valuations, and support the USD, with spillover effects across foreign exchange (FX) and commodity markets.
Labour: job openings and payrolls
While early-January Non-Farm Payrolls (NFP) often drive short-term volatility, JOLTS job openings may be more influential in shaping January’s policy narrative.
Key dates:
JOLTS Job Openings: 7 January, 10:00 AM (ET)/ 8 January, 1:00 AM (AEDT)
Non-Farm Payrolls (NFP): 9 January, 8:30 AM (ET)/ 10 January, 12:30 AM (AEDT)
What markets look for:
Markets often treat JOLTS as a clearer indicator of underlying labour demand than month-to-month hiring flows.
A continued drift lower in openings would support the view that labour demand is easing in an orderly way, reinforcing confidence that inflation pressures can continue to moderate. A rebound or stalled decline would suggest labour conditions remain firmer than expected.
Market sensitivities:
For markets, easing labour demand typically supports lower short-dated yields and a softer USD, while persistent tightness can push yields higher, strengthen the USD, and increase volatility across rate-sensitive assets.
Inflation: PPI and CPI
Key Dates:
PPI: 14 January, 8:30 AM (ET)/ 15 January, 12:30 AM (AEDT)
CPI (December 2025 data): 15 January, 8:30 AM (ET)/ 16 January, 12:30 AM (AEDT)
The inflation signal can be read as a pipeline from producer prices to consumer inflation. Markets are watching whether producer-level cost pressures continue to fade or begin to re-emerge.
What markets look for:
Core PPI, particularly services-linked components, provides an early indication of cost momentum. Core CPI breadth may help determine whether inflation is continuing to cool or showing signs of persistence.
A softer pipeline would reinforce confidence that disinflation can extend into early 2026, increasing the scope for a potential March policy adjustment. Stickier CPI readings above 3% would raise questions about the durability of recent progress.
How rates and the USD often react
Market reaction tends to be led by yields. Cooling inflation pressure usually pulls short-dated yields lower and softens the USD, while persistent inflation risks can push yields higher and tighten financial conditions.
Policy: January FOMC meeting
By the time the Federal Reserve meets at the end of January, markets will have processed the early growth, labour, and inflation signals of the year.
A policy change is unlikely this month, but how those signals are framed in the statement and press conference still matters. With January cut expectations priced well below 20%, attention is on whether expectations for a March move, currently around 50%, begin to shift.
Confidence that inflation and labour pressures are easing would typically support lower yields and a softer USD. A more cautious tone could lift yields, strengthen the USD, and tighten global financial conditions.
Putting it all together
January’s data acts as condition-setters rather than decision points. The practical takeaway lies in how markets respond as those conditions become clearer:
If growth and labour soften while inflation continues to ease, markets may lean toward a more constructive risk backdrop, with Treasury yields remaining the key guide and expectations for policy easing later in Q1 firming.
If growth holds up and inflation proves sticky, a more cautious posture may be warranted, with heightened sensitivity to Treasury yields, USD strength, and pressure on equity valuations and rate-sensitive commodities.