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 指标代码。
Venezuela commands the world's largest proven oil reserves at 303 billion barrels. Yet political turmoil, global sanctions, and recent US intervention show that being the biggest isn’t always best.
Quick facts:
Venezuela holds 18% of the world's total proven oil reserves despite producing less than 1% of global consumption.
Just four countries (Venezuela, Saudi Arabia, Iran, and Canada) control over half the planet's proven reserves.
Saudi Arabia dominates crude oil production contributing to over 16% of global exports.
US shale technology has enabled America to lead in production despite ranking ninth in reserves.
Top 10 countries by proven oil reserves
1. Venezuela – 303 billion barrels
Controls 18% of global reserves, primarily extra-heavy crude in the Orinoco Belt requiring specialised refining.
Heavy crude trades $15-20 below Brent benchmarks due to high sulphur content and complex processing requirements.
Output crashed 60% from 2.5 million bpd in 2014 to less than 1.0 million bpd last year.
Approximately 80% of exports flow to China as loan repayment, with export revenues dwarfed by reserve potential.
2. Saudi Arabia – 267 billion barrels
Majority light, sweet crude oil requires minimal refining and commands premium prices, contributing to world-leading exports of $191.1 billion in 2024.
Maintains 2-3 million bpd of spare production capacity, providing market stabilisation capability during supply disruptions.
Oil comprises roughly 50% of the country’s GDP and 70% of its export earnings.
Production decisions significantly impact international oil prices due to market dominance.
Heavy Western sanctions severely limit the country’s ability to monetise and access international markets.
Production estimates vary significantly (2.5-3.8 million bpd) due to sanctions, limited transparency, and restricted international reporting.
Significant crude volumes flow to China through discount arrangements and sanctions-evading mechanisms.
Sanctions relief could rapidly boost production toward 4-5 million bpd, though domestic consumption (12th globally) reduces export potential.
4. Canada – 163 billion barrels
Approximately 97% of reserves are oil sands (bitumen) requiring steam-assisted extraction and significant upfront capital investment.
Political stability and regulatory frameworks position Canada as a secure source compared to volatile producers, with direct pipeline access to US refineries.
Supplied over 60% of U.S. crude oil imports in 2024, making Canada America's top source by far.
5. Iraq – 145 billion barrels
Decades of war and sanctions have prevented optimal field development and infrastructure modernisation.
Improved security conditions since 2017 have enabled production recovery, but pipeline attacks and aging facilities continue to constrain output.
Oil revenue comprises over 90% of government income, creating extreme fiscal vulnerability.
Exports flow primarily to China, India, and Asian buyers seeking a reliable Middle Eastern supply, with most production from super-giant southern fields near Basra.
6. United Arab Emirates – 113 billion barrels
Produces primarily medium-to-light sweet crude commanding premium prices, ranking fourth globally in export value at $87.6 billion.
Has successfully diversified its economy through tourism, finance, and trade, reducing oil's GDP share compared to Gulf peers.
Strategic location near the Strait of Hormuz and openness to international oil companies help facilitate efficient global distribution.
7. Kuwait – 101.5 billion barrels
Reserves are concentrated in aging super-giant fields like Burgan, which require enhanced recovery techniques.
Favourable geology enables extraction costs around $8-10 per barrel, with proven reserves providing 80+ years of supply at current production rates.
Oil comprises 60% of GDP and over 95% of export revenue.
8. Russia – 80 billion barrels
World's third-largest producer despite ranking eighth in reserves.
Post-2022 Western sanctions redirected crude flows from Europe to Asia, with China and India now absorbing the majority at discounted prices.
Despite export restrictions and G7 price cap at $60/barrel, it posted the second-highest global export value at $169.7 billion in 2024.
Russian Urals crude typically trades $15-30 below Brent due to quality, sanctions, and logistics, with November 2024 revenues declining to $11 billion.
9. United States – 74.4 billion barrels
The shale revolution through horizontal drilling and hydraulic fracturing has made the U.S. the world's #1 oil producer despite holding only the 9th-largest reserves.
The Permian Basin accounts for nearly 50% of production, with shale/tight oil representing 65% of total output.
Achieved net petroleum exporter status in 2020 for the first time since 1949, with crude exports growing from near-zero in 2015 to over 4 million bpd in 2024.
The U.S. government maintains a 375+ million barrel strategic reserve.
10. Libya – 48.4 billion barrels
Holds Africa's largest proven oil reserves at 48.4 billion barrels, producing light sweet crude commanding premium prices.
Rival bordering governments compete for oil revenue control, causing production to fluctuate based on political conditions.
Oil facilities face blockades, militia attacks, and political leverage tactics, preventing consistent returns.
Favourable geology enables extraction costs around $10-15 per barrel, with geographic proximity making Libya a natural supplier to European refineries.
What does this mean for oil markets?
The concentration of reserves among OPEC members (60% of the global total) ensures the organisation has continued influence over pricing, even as US shale provides a production counterweight.
Venezuela's potential return as a major exporter post-U.S. occupation could eventually ease supply constraints, though most analysts view significant production increases as years away.
Sanctions could create a situation where discounted crude seeks buyers willing to navigate compliance risks. Refiners with heavy crude processing capability may benefit from price differentials if Venezuelan barrels increase.
While reserves appear abundant, economically recoverable volumes depend on sustained high prices. If renewable adoption accelerates and demand peaks sooner than projected, stranded assets become a material risk for reserve-heavy producers.
FX markets enter the month influenced by uncertain growth momentum, inflation dynamics and central bank policy, yield sensitivity, and shifts in how markets are pricing geopolitical risk.
Quick facts:
USD remains primarily responsive to inflation data, and this may have overtaken growth as the main driver.
JPY sensitivity to potential Bank of Japan (BOJ) action remains high, creating asymmetric responses to global rate moves and policy communication.
EUR and AUD continue to trade reactively to global events and commodity price moves.
Volatility may be episodic, clustering around key data releases rather than a single sustained directional trend.
With central bank expectations still evolving into the first quarter (Q1), key releases and policy communication are likely to stay central to near-term FX pricing. In this environment, moves may cluster around scheduled events and headline risk, rather than build into a single dominant trend.
USD performance remains closely tied to inflation data and what it could mean for Federal Reserve policy expectations. Market pricing can shift quickly around CPI and labour-market outcomes, particularly where outcomes affect how investors perceive the timing and pace of any policy changes.
Jobs data and GDP numbers will be watched as gauges of growth momentum. The start of the US earnings season may also influence FX indirectly through its impact on equity performance, risk sentiment, and yield expectations, rather than acting as a direct currency driver.
Key chart: US dollar index (DXY) weekly chart
Periods of market uncertainty can support USD demand around prior support areas near 97, while the 100 region may continue to act as a reference point for resistance, including where it aligns with commonly watched moving averages (noting technical indicators can fail).
A break in either direction may reflect shifting expectations about how different central banks will respond to the next run of inflation and growth data.
Euro (EUR)
Key data and events:
CPI (Euro area HICP, Dec 2025 reference period): 19 January 2026 European Central Bank
European Central Bank (ECB) messaging on policy direction and inflation remains key. A prolonged hold is one scenario market participants continue to debate, but outcomes are likely to remain data-dependent and sensitive to changes in the growth and inflation backdrop.
The geopolitical situation in Ukraine will also remain in focus.
Key chart: EUR/USD weekly chart
Differences in likely central bank direction could support a test of the top end of the current multi-month range near 1.18. A sustained break above that level would be technically significant.
For now, price may stay range-bound until there is clearer guidance on policy direction on both sides of the Atlantic.
Japanese yen (JPY)
Key data and events:
BOJ policy decision: 22–23 January 2026 Bank of Japan
Tokyo core CPI (Ku-area of Tokyo, preliminary; Dec 2025 reference month): 23 January 2026 Statistics Bureau of Japan
What to watch:
Following the BOJ’s December rate rise, markets appear to be weighing the likelihood of further action in Q1. Whether the January meeting delivers another move remains uncertain and may depend on incoming inflation and wage signals, as well as BOJ communication.
Data released ahead of the decision may be important in shaping expectations.
Key chart: GBP/JPY daily chart
As of 7 January 2026, GBPJPY has traded around the 211.50 area, near levels last seen in 2008. Continued consolidation may suggest fresh drivers are needed to extend gains.
If the cross can’t push higher, some traders will start watching for a pullback toward 210.00, where support has shown up before. And if expectations for BOJ action build, selling could accelerate, with price potentially drifting down through those previously tested support zones and toward the more established support near 208.00.
RBA rate decision: 3 February 2026 (Monetary Policy Board meeting 2–3 February) Reserve Bank of Australia
AUD continues to behave as a proxy for global growth sentiment and commodity demand.
Stabilisation in Chinese data, firmer commodity prices, and expectations around the Reserve Bank of Australia (RBA) policy path may be providing relative support for AUD. Sensitivity to broader risk conditions remains high.
Key chart: EUR/AUD daily chart
Moves in commodity prices have coincided with a sharp fall in EURAUD since the 31 December close, breaking down out of the prior range. The next key level to the downside sits at 1.7305.
The area around 1.7305 may help indicate whether selling pressure is continuing or whether momentum is fading for now. Near-term commodity price moves are likely to remain important.
Bottom line
FX conditions this month may remain reactive, with volatility clustering around key data releases rather than a sustained directional trend. With Q1 central bank expectations still forming, price moves may be sharper around the calendar, policy communication, and geopolitical headlines.