OPEN-SOURCE SCRIPT
Camarilla Pivots + 20 EMA Strategy

This is an intraday volatility and trend-following system for commodities like Natural Gas, combining dynamic pivot levels (Camarilla) with a trend filter (20-period EMA) to improve risk-reward and reduce false breakouts.
Core Components
1. Camarilla Pivots:
These are special support and resistance levels (H3, H4, L3, L4) calculated each day based on the previous day's high, low, and close.
The pivots adapt to daily volatility, giving more relevant breakout and bounce zones than static lines.
H4: Aggressive resistance (used for breakout LONG entry)
H3: Moderate resistance/support (used for bounce or stoploss)
L4: Aggressive support (used for breakout SHORT entry)
L3: Moderate support/resistance (used for bounce or stoploss)
2. 20 EMA (Exponential Moving Average):
Plotted on the 30-minute chart, this acts as a trend filter.
If the price is above 20 EMA: Only look for long trades (bullish bias).
If below 20 EMA: Only look for short trades (bearish bias).
How the Strategy Works
Setup (30-Min Chart):
Camarilla pivots for the day are drawn on the chart.
20 EMA is also plotted.
Trade Filter:
Bullish: Trade ONLY if price is above 20 EMA.
Bearish: Trade ONLY if price is below 20 EMA.
Entry:
LONG: Enter when price breaks and closes above the H4 pivot AND is above 20 EMA.
SHORT: Enter when price breaks and closes below the L4 pivot AND is below 20 EMA.
Stop Loss:
LONG: Place stoploss at H3 (the next lower Camarilla resistance).
SHORT: Place stoploss at L3 (the next higher Camarilla support).
Target:
Always set a profit target at 2x the distance (risk) between entry and stoploss (strict R:R 2).
For example, if your entry is at H4 and stoploss at H3, your target is entry + 2*(entry - stoploss).
Alerts & Visuals:
The strategy plots entry arrows, stoploss and target lines for immediate visual reference.
Alerts trigger on breakout signals so you never miss a trade.
Why This Works Well for Natural Gas
Adapts to volatility: The pivots change daily, handling wide-ranging and choppy price moves better than fixed breakouts.
Trend filter: EMA prevents counter-trend whipsaws, only trades with market momentum.
Risk control: Every trade must meet strict risk-reward criteria, so losses are contained and winners can outweigh losers.
Core Components
1. Camarilla Pivots:
These are special support and resistance levels (H3, H4, L3, L4) calculated each day based on the previous day's high, low, and close.
The pivots adapt to daily volatility, giving more relevant breakout and bounce zones than static lines.
H4: Aggressive resistance (used for breakout LONG entry)
H3: Moderate resistance/support (used for bounce or stoploss)
L4: Aggressive support (used for breakout SHORT entry)
L3: Moderate support/resistance (used for bounce or stoploss)
2. 20 EMA (Exponential Moving Average):
Plotted on the 30-minute chart, this acts as a trend filter.
If the price is above 20 EMA: Only look for long trades (bullish bias).
If below 20 EMA: Only look for short trades (bearish bias).
How the Strategy Works
Setup (30-Min Chart):
Camarilla pivots for the day are drawn on the chart.
20 EMA is also plotted.
Trade Filter:
Bullish: Trade ONLY if price is above 20 EMA.
Bearish: Trade ONLY if price is below 20 EMA.
Entry:
LONG: Enter when price breaks and closes above the H4 pivot AND is above 20 EMA.
SHORT: Enter when price breaks and closes below the L4 pivot AND is below 20 EMA.
Stop Loss:
LONG: Place stoploss at H3 (the next lower Camarilla resistance).
SHORT: Place stoploss at L3 (the next higher Camarilla support).
Target:
Always set a profit target at 2x the distance (risk) between entry and stoploss (strict R:R 2).
For example, if your entry is at H4 and stoploss at H3, your target is entry + 2*(entry - stoploss).
Alerts & Visuals:
The strategy plots entry arrows, stoploss and target lines for immediate visual reference.
Alerts trigger on breakout signals so you never miss a trade.
Why This Works Well for Natural Gas
Adapts to volatility: The pivots change daily, handling wide-ranging and choppy price moves better than fixed breakouts.
Trend filter: EMA prevents counter-trend whipsaws, only trades with market momentum.
Risk control: Every trade must meet strict risk-reward criteria, so losses are contained and winners can outweigh losers.
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。