Combined SR, HEMA, and PivotsHelps to draw dynamic Support and resistance along with pivot points high / low
브레드쓰 인디케이터
NISHITThis strategy is equal to the very popular "ANN Strategy" coded by sirolf2009 but without the Artificial Neural Network (ANN// Main difference besides stripping out the ANN is that I use close prices instead of OHLC4 prices
Bi Trend signalauto bot MT5 for XAU, BTC ETH, liên hệ tôi để biết thêm chi tiết cho các hạng mục coppy trade
Full Custom Setup with Alerts🚀 Full Custom TradingView Setup — EMA + MACD + RSI + Volume with Smart Alerts
This script combines everything you need for a clean, alert-driven trading system:
EMA 9 / 21 / 50 / 200 for trend structure
MACD (6,13,5) to detect momentum shifts
RSI 6 / 12 / 24 to track overbought/oversold zones
Volume with MA5/MA10 and dynamic high-volume line
📈 Visual triangle markers for perfect entry setups
🔔 Alerts fire when all signals align for Long or Short trades
💡 Designed for both fast scalping and multi-timeframe swing trading.
Add it to your chart, set your alerts, and stay ahead of the market.
This is not financial advice. Use with your own risk management (Or better yet don't even use it)
Nadaraya-Watson Envelope Strategy//@version=6
// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) creativecommons.org
// © LuxAlgo - Modified for strategy testing
strategy("Nadaraya-Watson Envelope Strategy", "NWE Strat", overlay = true, max_lines_count = 500, max_labels_count = 500, max_bars_back=500, initial_capital = 10000, commission_type = strategy.commission.percent, commission_value = 0.1, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, calc_on_every_tick = true)
//------------------------------------------------------------------------------
//Settings
//-----------------------------------------------------------------------------{
h = input.float(8.,'Bandwidth', minval = 0)
mult = input.float(3., minval = 0)
src = input(close, 'Source')
repaint = input.bool(false, 'Repainting Smoothing', tooltip = 'Repainting is an effect where the indicators historical output is subject to change over time. Disabling repainting will cause the indicator to output the endpoints of the calculations')
// Strategy Settings
// 과거 날짜로 변경
startDate = input.time(timestamp("2020-01-01"), "Start Date")
endDate = input.time(timestamp("2023-12-31"), "End Date")
contractSize = input.float(1.0, "Contract Size", minval=0.1, step=0.1)
takeProfitPct = input.float(3.0, "Take Profit %", minval=0.1, step=0.1)
stopLossPct = input.float(2.0, "Stop Loss %", minval=0.1, step=0.1)
// Enable/disable take profit and stop loss
useTakeProfit = input.bool(true, "Use Take Profit")
useStopLoss = input.bool(true, "Use Stop Loss")
//Style
upCss = input.color(color.teal, 'Colors', inline = 'inline1', group = 'Style')
dnCss = input.color(color.red, '', inline = 'inline1', group = 'Style')
//-----------------------------------------------------------------------------}
//Functions
//-----------------------------------------------------------------------------{
//Gaussian window
gauss(x, h) => math.exp(-(math.pow(x, 2)/(h * h * 2)))
//-----------------------------------------------------------------------------}
//Append lines
//-----------------------------------------------------------------------------{
n = bar_index
var ln = array.new_line(0)
if barstate.isfirst and repaint
for i = 0 to 499
array.push(ln,line.new(na,na,na,na))
//-----------------------------------------------------------------------------}
//End point method
//-----------------------------------------------------------------------------{
var coefs = array.new_float(0)
var den = 0.
if barstate.isfirst and not repaint
for i = 0 to 499
w = gauss(i, h)
coefs.push(w)
den := coefs.sum()
out = 0.
float upper = na
float lower = na
float mae = na
if not repaint
for i = 0 to 499
out += src * coefs.get(i)
out /= den
mae := ta.sma(math.abs(src - out), 499) * mult
upper := out + mae
lower := out - mae
else
// 리페인팅 모드에서도 밴드 계산 수행
sma = ta.sma(src, 20)
stdev = ta.stdev(src, 20)
upper := sma + stdev * mult
lower := sma - stdev * mult
//-----------------------------------------------------------------------------}
//Compute and display NWE
//-----------------------------------------------------------------------------{
float y2 = na
float y1 = na
nwe = array.new(0)
if barstate.islast and repaint
sae = 0.
//Compute and set NWE point
for i = 0 to math.min(499,n - 1)
sum = 0.
sumw = 0.
//Compute weighted mean
for j = 0 to math.min(499,n - 1)
w = gauss(i - j, h)
sum += src * w
sumw += w
y2 := sum / sumw
sae += math.abs(src - y2)
nwe.push(y2)
sae := sae / math.min(499,n - 1) * mult
for i = 0 to math.min(499,n - 1)
// Fix for the bool vs int error - use modulo comparison instead of direct assignment
isEvenIndex = i % 2 == 0
if not isEvenIndex // This is equivalent to if i%2 but uses a proper boolean
line.new(n-i+1, y1 + sae, n-i, nwe.get(i) + sae, color = upCss)
line.new(n-i+1, y1 - sae, n-i, nwe.get(i) + sae, color = dnCss)
if src > nwe.get(i) + sae and src < nwe.get(i) + sae
label.new(n-i, src , '▼', color = color(na), style = label.style_label_down, textcolor = dnCss, textalign = text.align_center)
if src < nwe.get(i) - sae and src > nwe.get(i) - sae
label.new(n-i, src , '▲', color = color(na), style = label.style_label_up, textcolor = upCss, textalign = text.align_center)
y1 := nwe.get(i)
//-----------------------------------------------------------------------------}
//Dashboard
//-----------------------------------------------------------------------------{
var tb = table.new(position.top_right, 1, 1
, bgcolor = #1e222d
, border_color = #373a46
, border_width = 1
, frame_color = #373a46
, frame_width = 1)
if repaint
tb.cell(0, 0, 'Repainting Mode Enabled', text_color = color.white, text_size = size.small)
//-----------------------------------------------------------------------------}
//Plot
//-----------------------------------------------------------------------------{
float upperBand = na
float lowerBand = na
upperBand := upper
lowerBand := lower
plot(upperBand, 'Upper', upCss)
plot(lowerBand, 'Lower', dnCss)
//Crossing Arrows
plotshape(ta.crossunder(close, lowerBand) ? low : na, "Crossunder", shape.labelup, location.absolute, color(na), 0 , text = '▲', textcolor = upCss, size = size.tiny)
plotshape(ta.crossover(close, upperBand) ? high : na, "Crossover", shape.labeldown, location.absolute, color(na), 0 , text = '▼', textcolor = dnCss, size = size.tiny)
//-----------------------------------------------------------------------------}
// Strategy Implementation
//-----------------------------------------------------------------------------{
// Set date filter
inDateRange = time >= startDate and time <= endDate
// Trading Conditions
longCondition = ta.crossunder(close, lowerBand) and inDateRange
shortCondition = ta.crossover(close, upperBand) and inDateRange
// Entry conditions
if (longCondition)
strategy.entry("Long", strategy.long, qty=contractSize)
if (shortCondition)
strategy.entry("Short", strategy.short, qty=contractSize)
// Calculate Take Profit and Stop Loss levels
longTakeProfit = strategy.position_avg_price * (1 + takeProfitPct / 100)
longStopLoss = strategy.position_avg_price * (1 - stopLossPct / 100)
shortTakeProfit = strategy.position_avg_price * (1 - takeProfitPct / 100)
shortStopLoss = strategy.position_avg_price * (1 + stopLossPct / 100)
// Exit conditions
isInLongPosition = strategy.position_size > 0
isInShortPosition = strategy.position_size < 0
// Apply take profit and stop loss if enabled
if (isInLongPosition)
if (useTakeProfit and useStopLoss)
strategy.exit("Long TP/SL", "Long", limit=longTakeProfit, stop=longStopLoss)
else if (useTakeProfit)
strategy.exit("Long TP", "Long", limit=longTakeProfit)
else if (useStopLoss)
strategy.exit("Long SL", "Long", stop=longStopLoss)
if (isInShortPosition)
if (useTakeProfit and useStopLoss)
strategy.exit("Short TP/SL", "Short", limit=shortTakeProfit, stop=shortStopLoss)
else if (useTakeProfit)
strategy.exit("Short TP", "Short", limit=shortTakeProfit)
else if (useStopLoss)
strategy.exit("Short SL", "Short", stop=shortStopLoss)
// Plot entry/exit signals
plotshape(longCondition, "Long Signal", shape.triangleup, location.belowbar, color.green, size=size.small)
plotshape(shortCondition, "Short Signal", shape.triangledown, location.abovebar, color.red, size=size.small)
//-----------------------------------------------------------------------------}
Trendline Crossover 1M//@version=5
indicator("Trendline Crossover 1M", overlay=true)
// Define Lookback Period for Trendlines
lookback = 20
// Identify Swing Highs and Lows for Trendlines
highs = ta.highestbars(high, lookback)
lows = ta.lowestbars(low, lookback)
// Define Trendline Points (based on Swing Highs for Downtrend and Swing Lows for Uptrend)
upTrendLineX1 = bar_index
upTrendLineY1 = low
upTrendLineX2 = bar_index
upTrendLineY2 = low
downTrendLineX1 = bar_index
downTrendLineY1 = high
downTrendLineX2 = bar_index
downTrendLineY2 = high
// Draw Trendlines Based on Swing Highs (Downtrend) and Swing Lows (Uptrend)
line upTrendLine = line.new(upTrendLineX1, upTrendLineY1, upTrendLineX2, upTrendLineY2, color=color.green, width=2)
line downTrendLine = line.new(downTrendLineX1, downTrendLineY1, downTrendLineX2, downTrendLineY2, color=color.red, width=2)
// Check for Price Crosses Above (Buy Signal) and Below (Sell Signal) Trendlines
crossUp = ta.crossover(close, line.get_price(upTrendLine, bar_index))
crossDown = ta.crossunder(close, line.get_price(downTrendLine, bar_index))
// Only Trigger Buy/Sell Signal on First Trendline Cross
plotshape(series=crossUp, location=location.belowbar, color=color.green, style=shape.labelup, title="Buy Signal")
plotshape(series=crossDown, location=location.abovebar, color=color.red, style=shape.labeldown, title="Sell Signal")
Volume-Powered S/R TraderThis advanced TradingView indicator combines volume analysis, dynamic support/resistance levels, and technical indicators to identify high-probability trading opportunities. It focuses on detecting institutional-level activity through volume spikes at key price levels.
Key Components
Volume Analysis Engine
Tracks volume spikes (150%+ of 20-period average)
Color-coded volume bars:
Green: Bullish volume spike (high volume + bullish candle)
Red: Bearish volume spike (high volume + bearish candle)
Dynamic Support/Resistance System
Auto-detects swing points using pivot high/low
Maintains rolling arrays of:
Support Levels (green semi-transparent lines)
Resistance Levels (red semi-transparent lines)
Displays only the 5 most recent levels for clarity
Trend Analysis
50-period EMA trend filter
RSI momentum indicator (14-period)
Trend direction classification:
Bullish: EMA rising
Bearish: EMA falling
[TABLE] Moving Average Stage Indicator Table📈 MA Stage Indicator Table
🧠 Overview:
This script analyzes market phases based on moving average (MA) crossovers, classifying them into 6 distinct stages and displaying statistical summaries for each.
🔍 Key Features:
• Classifies market condition into Stage 1 to Stage 6 based on the relationship between MA1 (short), MA2 (mid), and MA3 (long)
• Provides detailed stats for each stage:
• Average Duration
• Average Width (MA distance)
• Slope (Angle) - High / Low / Average
• Shows current stage details in real-time
• Supports custom date range filtering
• Choose MA type: SMA or EMA
• Optional background coloring for stages
• Clean summary table displayed on the chart
JPMorgan Collar LevelsJPMorgan Collar Levels – SPX/SPY Auto-Responsive (Quarterly Logic)
This script tracks the JPMorgan Hedged Equity Fund collar strategy, one of the most watched institutional positioning tools on SPX/SPY. The strategy rolls quarterly and often acts as a magnet or resistance/support zone for price.
Smart Money RTM MACD Divergence//@version=5
indicator("Smart Money RTM MACD Divergence", overlay=true)
// MACD Calculation
fastLength = 12
slowLength = 26
signalSmoothing = 9
source = close
= ta.macd(source, fastLength, slowLength, signalSmoothing)
// Detect MACD Divergence with Better Confirmation
macdHigh = ta.highest(macdLine, 20)
macdLow = ta.lowest(macdLine, 20)
priceHigh = ta.highest(high, 20)
priceLow = ta.lowest(low, 20)
bullishDiv = priceLow < ta.valuewhen(priceLow, 1, 1) and macdLine > ta.valuewhen(macdLow, 1, 1) and ta.rising(macdLine, 3)
bearishDiv = priceHigh > ta.valuewhen(priceHigh, 1, 1) and macdLine < ta.valuewhen(macdHigh, 1, 1) and ta.falling(macdLine, 3)
// Return to Mean (RTM) using 50 EMA with Confirmation
ema50 = ta.ema(close, 50)
ema200 = ta.ema(close, 200) // Additional Trend Confirmation
atr = ta.atr(14) // Volatility Filter
rtmBuy = close < ema50 and ta.crossover(macdLine, signalLine) and close > ema200 and ta.barssince(ta.lowest(close, 10)) < 5
rtmSell = close > ema50 and ta.crossunder(macdLine, signalLine) and close < ema200 and ta.barssince(ta.highest(close, 10)) < 5
// Plot Buy and Sell Signals with Filters
plotshape(series=bullishDiv or rtmBuy, location=location.belowbar, color=color.green, style=shape.labelup, title="Buy Signal", size=size.small)
plotshape(series=bearishDiv or rtmSell, location=location.abovebar, color=color.red, style=shape.labeldown, title="Sell Signal", size=size.small)
// Plot EMA 50 and EMA 200 for reference
plot(ema50, title="50 EMA", color=color.blue)
plot(ema200, title="200 EMA", color=color.orange)
Medias Móviles - Swing Trading - by addryy58Moving averages for swing trading. The daily view shows the SMA30, WMA21, EMA150, and SMA200, while the weekly view shows the WMA10, WMA30, and WMA50.
Estrategia EMA + RSIElser Senior Strategy: A Precise Approach to Profitable Trading
The Elser Senior strategy is designed for traders looking to take advantage of the best market opportunities with a robust technical approach. Using a combination of Exponential Moving Averages (EMA) and the Relative Strength Index (RSI), this strategy identifies key entry and exit points, allowing you to maximize profits and minimize risks.
Short and Long EMAs: Accurately detect the market trend, providing clear buy and sell signals.
RSI: Filters out false breakouts, focusing on overbought and oversold levels for more informed decision-making.
Customizable Stop Loss and Take Profit: Protects your capital with risk management settings tailored to your needs. Set a personalized Stop Loss and TP/SL ratio, optimizing your chances of success.
This strategy works across the most popular timeframes: 15 minutes, 1 hour, 4 hours, and 1 day, allowing you to adapt to different trading styles, from intraday to long-term positions.
Ideal for Forex, Indices, Commodities, and Cryptocurrencies, the Elser Senior Strategy has been crafted for serious traders seeking consistency and reliability in their operations. With a clear and easy-to-follow structure, it is perfect for both novice and experienced traders.
Follow the signals, optimize your risk management, and achieve successful trading with Elser Senior!
Kase Permission StochasticOverview
The Kase Permission Stochastic indicator is an advanced momentum oscillator developed from Kase's trading methodology. It offers enhanced signal smoothing and filtering compared to traditional stochastic oscillators, providing clearer entry and exit signals with fewer false triggers.
How It Works
This indicator calculates a specialized stochastic using a multi-stage smoothing process:
Initial stochastic calculation based on high, low, and close prices
Application of weighted moving averages (WMA) for short-term smoothing
Progressive smoothing through differential factors
Final smoothing to reduce noise and highlight significant trend changes
The indicator oscillates between 0 and 100, with two main components:
Main Line (Green): The smoothed stochastic value
Signal Line (Yellow): A further smoothed version of the main line
Signal Generation
Trading signals are generated when the main line crosses the signal line:
Buy Signal (Green Triangle): When the main line crosses above the signal line
Sell Signal (Red Triangle): When the main line crosses below the signal line
Key Features
Multiple Smoothing Algorithms: Uses a combination of weighted and exponential moving averages for superior noise reduction
Clear Visualization: Color-coded lines and background filling
Reference Levels: Horizontal lines at 25, 50, and 75 for context
Customizable Colors: All visual elements can be color-customized
Customization Options
PST Length: Base period for the stochastic calculation (default: 9)
PST X: Multiplier for the lookback period (default: 5)
PST Smooth: Smoothing factor for progressive calculations (default: 3)
Smooth Period: Final smoothing period (default: 10)
Trading Applications
Trend Confirmation: Use crossovers to confirm entries in the direction of the prevailing trend
Reversal Detection: Identify potential market reversals when crossovers occur at extreme levels
Range-Bound Markets: Look for oscillations between overbought and oversold levels
Filter for Other Indicators: Use as a confirmation tool alongside other technical indicators
Best Practices
Most effective in trending markets or during well-defined ranges
Combine with price action analysis for better context
Consider the overall market environment before taking signals
Use longer settings for fewer but higher-quality signals
The Kase Permission Stochastic delivers a sophisticated approach to momentum analysis, offering a refined perspective on market conditions while filtering out much of the noise that affects standard oscillators.
Low Volume Engulfing CandleVolume Moving Average (volMA): This calculates the simple moving average of the volume over a specified period (default 20).
Bullish and Bearish Engulfing Patterns: The script checks for engulfing patterns by comparing the current candle with the previous one.
A bullish engulfing occurs when the current candle closes higher than it opens and the previous candle is a bearish candle.
A bearish engulfing occurs when the current candle closes lower than it opens and the previous candle is a bullish candle.
Low Volume Condition: The volume of the current candle is compared to the moving average volume. If it's below the defined threshold (e.g., 80% of the moving average), it’s considered "low volume."
Plotting: When a low-volume bullish or bearish engulfing pattern is detected, a marker is plotted on the chart.
Larry Williams POIV A/D [tradeviZion]Larry Williams' POIV A/D - Release Notes v1.0
=================================================
Release Date: 01 April 2025
OVERVIEW
--------
The Larry Williams POIV A/D (Price, Open Interest, Volume Accumulation/Distribution) indicator implements Williams' original formula while adding advanced divergence detection capabilities. This powerful tool combines price movement, open interest, and volume data to identify potential trend reversals and continuations.
FEATURES
--------
- Implements Larry Williams' original POIV A/D formula
- Divergence detection system:
* Regular divergences for trend reversal signals
* Hidden divergences for trend continuation signals
- Fast Mode option for earlier pivot detection
- Customizable sensitivity for divergence filtering
- Dynamic color visualization based on indicator direction
- Adjustable smoothing to reduce noise
- Automatic fallback to OBV when Open Interest is unavailable
FORMULA
-------
POIV A/D = CumulativeSum(Open Interest * (Close - Close ) / (True High - True Low)) + OBV
Where:
- Open Interest: Current period's open interest
- Close - Close : Price change from previous period
- True High - True Low: True Range
- OBV: On Balance Volume
DIVERGENCE TYPES
---------------
1. Regular Divergences (Reversal Signals):
- Bullish: Price makes lower lows while indicator makes higher lows
- Bearish: Price makes higher highs while indicator makes lower highs
2. Hidden Divergences (Continuation Signals):
- Bullish: Price makes higher lows while indicator makes lower lows
- Bearish: Price makes lower highs while indicator makes higher highs
REQUIREMENTS
-----------
- Works best with futures and other instruments that provide Open Interest data
- Automatically adapts to work with any instrument by using OBV when OI is unavailable
USAGE GUIDE
-----------
1. Apply the indicator to any chart
2. Configure settings:
- Adjust sensitivity for divergence detection
- Enable/disable Fast Mode for earlier signals
- Customize visual settings as needed
3. Look for divergence signals:
- Regular divergences for potential trend reversals
- Hidden divergences for trend continuation opportunities
4. Use the alerts system for automated divergence detection
KNOWN LIMITATIONS
----------------
- Requires Open Interest data for full functionality
- Fast Mode may generate more signals but with lower reliability
ACKNOWLEDGEMENTS
---------------
This indicator is based on Larry Williams' work on Open Interest analysis. The implementation includes additional features for divergence detection while maintaining the integrity of the original formula.
Medias Móviles - Swing Trading - by addryy58Moving averages for Swing Trading daily view SMA30 - WMA 21 - EMA 150 - WMA200 - SMA200 and weekly view WMA10 - WMA30 - WMA50.
VOLD Ratio Histogram [Th16rry]How to Use the VOLD Ratio Histogram Indicator
The VOLD Ratio Histogram Indicator is a powerful tool for identifying buying and selling volume dominance over a selected period. It provides traders with visual cues about volume pressure in the market, helping them make more informed trading decisions.
How to Read the Indicator:
1. Green Bars (Positive Histogram):
- Indicates that buying volume is stronger than selling volume.
- Higher green bars suggest increasing bullish pressure.
- Useful for confirming uptrends or identifying potential accumulation phases.
2. Red Bars (Negative Histogram):
- Indicates that selling volume is stronger than buying volume.
- Lower red bars suggest increasing bearish pressure.
- Useful for confirming downtrends or identifying potential distribution phases.
3. Zero Line (Gray Line):
- Acts as a neutral reference point where buying and selling volumes are balanced.
- Crossing above zero suggests buying dominance; crossing below zero suggests selling dominance.
How to Use It:
1. Confirming Trends:
- A strong positive histogram during an uptrend supports bullish momentum.
- A strong negative histogram during a downtrend supports bearish momentum.
2. Detecting Reversals:
- Monitor for changes from positive (green) to negative (red) or vice versa as potential reversal signals.
- Divergences between price action and histogram direction can indicate weakening trends.
3. Identifying Volume Surges:
- Sharp spikes in the histogram may indicate strong buying or selling interest.
- Use these spikes to investigate potential breakout or breakdown scenarios.
4. Filtering Noise:
- Adjust the period length to control sensitivity:
- Shorter periods (e.g., 10) are more responsive but may produce more noise.
- Longer periods (e.g., 50) provide smoother signals, better for identifying broader trends.
Recommended Markets:
- Cryptocurrencies: Works effectively with real volume data from exchanges.
- Forex: Useful with tick volume, though interpretation may vary.
- Stocks & Commodities: Particularly effective for analyzing high-volume assets.
Best Practices:
- Combine the VOLD Ratio Histogram with other indicators like moving averages or RSI for confirmation.
- Use different period lengths depending on your trading style (scalping, swing trading, long-term investing).
- Observe volume spikes and divergences to anticipate potential market moves.
The VOLD Ratio Histogram Indicator is ideal for traders looking to enhance their volume analysis and gain a deeper understanding of market dynamics.
M.G.O Receptor RSIIt is possible to conclude that the Primary RSI is responsible for inserting each block of information in the field represented by the Cartesian scale of the price and time forces, thus complying with its ordinary programming of information organization.
The equation;
1
f = ----
P
It says that the frequency is inversely proportional to the period.
Considering the idea that oscillatory waves (line graph) are the ex-pressure of what occurs in the MGO (on graph matrix), it is correct to state that the wave events of a common periodic wave can be easily reproduced in the M.G.O proposal, because the blocks are events (f) separated and organized by the time force (P).
Notice that the "NODE" or on the other hand the BLOCK that forms the M.G.O. are the same phenomena when transmuted to the conception of idea, waves.
My diligence is to show you that the G.M.O. is expressed graphically in accordance with already known physical guidelines.
So it is correct to say that just as in physics an oscillatory wave event or events that remedy the name of frequency is thus separated by another force, that is, the period in which we understand that the tool that separates and organizes the oscillation events when it was standardized by Wilder in model 14 as prototyping of action within the RSI. This mathematical indicator is intended to demonstrate by capturing through the precise calculations of the averages using the following mathematical formula; average of n positive time-frames RS = --------------------------------------------- average of n negative time-frames So it is thus defined that the period is the RSI tool/programming acting in the organization of the blocks that make up the ON - MGO graphic matrix.
BTC Macro Liquidity StrategyProvides a trading strategy for Bitcoin based on US Liquidity. Goes long when US liquidity goes above the US liquidity 30 day SMA.
ADR Nivele Horizontale dhe EMAThe user provided a Pine Script code for an indicator called "ADR Nivele Horizontale dhe EMA". The task is to explain how this code works. Hmm, first, I need to understand what this indicator does. The title mentions ADR levels and EMA, so it's probably combining horizontal lines based on Average Daily Range and some Exponential Moving Averages.
Looking at the code, the first part is the indicator declaration with version 6. The settings include an ADR period, levels above and below the mid, and line style. Then there's a section for calculations. They request daily high and low to compute the daily range. The ADR is the SMA of the daily range over the specified period. The mid is the average of daily high and low. The adr_val is half of ADR, maybe to create symmetrical levels around the mid.
Next, they create arrays for lines and labels above and below the mid. The loops go from 1 to levels_above/below, calculate each level, draw lines and labels. The mid line is also drawn with a different color. Then, there are several EMAs plotted: 13, 50, 200, 400, 600, 800, each with different colorsWait, but in Pine Script, when you use arrays to store lines and labels, you have to manage them properly to avoid repainting or memory issues. The code uses array.concat to add new lines and labels each bar. However, since this code is running on each bar, the for loops might be creating multiple lines each time, leading to too many objects. Oh right, but they use var to initialize the arrays, so they are only initialized once. Wait, no. The var keyword initializes the variable once, but in each iteration, they are concatenating new lines. Wait, no: the for loops are inside the main script, which runs on each bar. So every time a new bar is processed, the loops will run again, adding new lines and labels. That's a problem because each bar would create new lines, leading to an ever-increasing number of lines, which could hit the maximum limit (max_lines_count is set to 20, but maybe they have more bars). Oh, the indicator has max_lines_count=20, but the code might be creating multiple lines per bar. So maybe the code isn't handling the line management correctly. For example, if levels_above is 2, then each bar would create 2 new lines above and 2 below, plus the mid line. Over 20 bars, that's way over 20 lines. So this could cause the indicator to stop drawing after 20 lines. The user might not have realized that the lines are being recreated every bar, leading to a buildup. But perhaps the original code intended to have the lines update each bar, extending to the current bar. Let's see: in line.new, they use bar_index as the starting x1 and bar_index as x2. So each line is drawn from the previous bar's index to the current one. But since this is done on every bar, each line is only one bar long. Wait, no. Because on each new bar, the code creates a new line from the previous bar's index (bar_index , which is now the bar before the current one) to the current bar_index. So each line is just a segment from the previous bar to the current bar. But when the next bar comes, a new line is created again. So the result is that each level line is a series of one-bar-length segments, which might not be intended. The user probably wants continuous lines that extend from the left to the right, not just per bar. So this approach is incorrect. The correct way would be to have a line that starts at the first bar of the calculation and extends to the right, updating each bar. But the current code creates a new line each bar, leading to multiple short lines instead of one continuous line. That's a mistake.
So the main issue here is that the code is generating a new line segment for each bar, which is not efficient and would quickly hit the line limit. To fix this, instead of creating a new line every bar, they should create the line once and then update its position each bar. But in Pine Script, you can't directly update a line after it's created; instead, you need to track the line ID and use line.set_xy() to extend it. However, the current code uses array.concat to add new lines each bar, which isn't the right approach.
Therefore, the code as written will create multiple short lines instead of continuous horizontal lines. The correct approach for horizontal levels that extend to the right is to create the line once, starting at a certain bar and extending indefinitely, or to update the line's end point each new bar. But in Pine Script, you can't extend lines infinitely; you have to manage them each bar. Alternatively, using the 'line.extend' style might help, but I think the original code's logic is flawed here.
Additionally, the EMA part is straightforward: plotting multiple EMAs with different periods. That part should work as expected.
So the explanation should mention that the ADR levels are calculated based on the daily high and low, then the code attempts to draw horizontal lines above and below the mid-point. However, the way the lines are drawn may lead to multiple short segments instead of continuous lines, potentially causing performance issues or hitting the maximum line count. The EMAs are plotted correctly with various periods..
EMA Supertrend StrategyAERVA EMA Supertrend Strategy
Original TradingView Script for Trend-following Strategy with Buy/Sell Signals
This strategy uses a combination of Exponential Moving Averages (EMA), Supertrend, and Fibonacci to identify potential Buy and Sell signals. The strategy focuses on detecting price action with two consecutive green candles crossing above the 200 EMA for a buy signal and two consecutive red candles crossing below the 200 EMA for a sell signal.
Key Components:
50 EMA and 200 EMA: Used to identify the trend and signal potential reversals or continuations.
Supertrend: Helps visualize the trend direction and smooths out price movements.
Fibonacci: Adds an additional layer of confluence for trade entries.
Buy Condition: A buy signal is triggered when two consecutive green candles cross above the 200 EMA.
Sell Condition: A sell signal is triggered when two consecutive red candles cross below the 200 EMA.
Features:
Buy/Sell Signals: Clear visual cues on the chart, with arrows and labels marking the entry points.
Supertrend: Displays green/red trends to help confirm the overall market direction.
Fibonacci: Plotting Fibonacci levels to support your decision-making for potential trade setups.
Risk Management & Backtesting: This script supports backtesting within the TradingView environment, and the strategy includes realistic commission and slippage parameters to reflect more accurate trade results.
The script is designed for traders who want a clear and systematic approach to identifying potential trend-following trade opportunities using a combination of classic technical indicators and price action.
Hashtags:
#AERVA #EMA #Supertrend #TradingStrategy #TechnicalAnalysis #TrendFollowing #BuyAndSellSignals #StockTrading #CryptoTrading #ForexTrading #TradingView #Backtesting #MarketTrends #Fibonacci #TechnicalIndicators #PriceAction #SwingTrading #DayTrading #TradingSystem #CustomStrategy #PineScript