Vingativo ScriptVingativo Script
Vingativo Script
Vingativo Script
Vingativo Script
Vingativo Script
Vingativo Script
Jalur dan Saluran
EXPONOVA by @thejamiulEXPONOVA is an advanced EMA-based indicator designed to provide a visually intuitive and actionable representation of market trends. It combines two EMAs (Exponential Moving Averages) with a custom gradient fill to help traders identify trend reversals, strength, and the potential duration of trends.
This indicator uses a gradient color fill between two EMAs—one short-term (20-period) and one longer-term (55-period). The gradient dynamically adjusts based on the proximity and relationship of the closing price to the EMAs, giving traders a unique visual insight into trend momentum and potential exhaustion points.
Key Features:
Dynamic Gradient Fill:
The fill color between the EMAs changes based on the bar's position relative to the longer-term EMA.
A fading gradient visually conveys the strength and duration of the trend. The closer the closing price is to crossing the EMA, the stronger the gradient, making trends easy to spot.
Precision EMA Calculations:
The indicator plots two EMAs (20 and 55) without cluttering the chart, ensuring traders have a clean and informative display.
Ease of Use:
Designed for both novice and advanced traders, this tool is effective in identifying trend reversals and entry/exit points.
Trend Reversal Detection:
Built-in logic identifies bars since the last EMA cross, dynamically adjusting the gradient to signal potential trend changes.
How It Works:
This indicator calculates two EMAs:
EMA 20 (Fast EMA): Tracks short-term price movements, providing early signals of potential trend changes.
EMA 55 (Slow EMA): Captures broader trends and smoothens noise for a clearer directional bias.
The area between the two EMAs is filled with a dynamic color gradient, which evolves based on how far the price has moved above or below EMA 55. The gradient acts as a visual cue to the strength and duration of the current trend:
Bright green shades indicate bullish momentum building over time.
Red tones highlight bearish momentum.
The fading effect in the gradient provides traders with an intuitive representation of trend strength, helping them gauge whether the trend is accelerating, weakening, or reversing.
Gradient-Filled Region: Unique visualization to simplify trend analysis without cluttering the chart.
Dynamic Trend Strength Indication: The gradient dynamically adjusts based on the price's proximity to EMA 55, giving traders insight into momentum changes.
Minimalist Design: The EMAs themselves are not displayed by default to maintain a clean chart while still benefiting from their analysis.
Customizable Lengths: Pre-configured with EMA lengths of 20 and 55, but easily modifiable for different trading styles or instruments.
How to Use This Indicator
Trend Detection: Look at the gradient fill for visual confirmation of trend direction and strength.
Trade Entries:
Enter long positions when the price crosses above EMA 55, with the gradient transitioning to green.
Enter short positions when the price crosses below EMA 55, with the gradient transitioning to red.
Trend Strength Monitoring:
A brighter gradient suggests a sustained and stronger trend.
A fading gradient may indicate weakening momentum and a potential reversal.
Important Notes
This indicator uses a unique method of color visualization to enhance decision-making but does not generate buy or sell signals directly.
Always combine this indicator with other tools or methods for comprehensive analysis.
Past performance is not indicative of future results; please practice risk management while trading.
How to Use:
Trend Following:
Use the gradient fill to identify the trend direction.
A consistently bright gradient indicates a strong trend, while fading colors suggest weakening momentum.
Reversal Signals:
Watch for gradient changes near the EMA crossover points.
These can signal potential trend reversals or consolidation phases.
Confirmation Tool:
Combine EXPONOVA with other indicators or candlestick patterns for enhanced confirmation of trade setups.
GOLDEN Trading System by @thejamiulGolden Pivot by thejamiul is the ultimate trading companion, meticulously designed to provide traders with precise and actionable market levels for maximizing trading success. With its innovative blend of pivot systems, high/low markers, and customizable features, this indicator empowers you to execute trades with accuracy and confidence.
Source of this indicator : This indicator is based on @TradingView original pivot point ( pivot point standard ) indicator with lot of custom and added features to identify breakouts. Bellow detail list of features with explanations.
What Makes Golden Pivot Unique?
This indicator integrates multiple pivot methodologies and key levels into one powerful tool, making it suitable for a wide variety of trading strategies. Whether you're into breakout trading, virgin trades, or analyzing market trends, Golden Pivot Pro v5 has got you covered.
Key Features:
Camarilla Pivots:
Calculates H3, H4, H5, L3, L4, and L5 levels dynamically.
Helps identify strong support and resistance zones for reversal or breakout opportunities.
Floor Pivots:
Classic pivot point along with BC (Bottom Center) and TC (Top Center) levels for intraday and swing trading setups.
Multi-Timeframe High/Low Levels:
Plots static high/low markers for yearly, monthly, weekly, and daily timeframes.
Provides clarity on major market turning points and breakout zones.
Close Price Levels:
Highlights yearly, monthly, weekly, and daily close prices to aid in understanding market bias.
Custom Timeframe Selection:
Flexibly choose daily, weekly, monthly, or yearly pivot resolutions to suit your trading style and objectives.
Comprehensive Visualization:
Color-coded levels for quick recognition of significant zones.
Dynamic updates to adapt to changing market conditions seamlessly.
EXPONOVA:
In input tab you will get EXPONOVA, it is build with two ema and gradient colours. It is very important for trend identification because if we only use pivot, we can not tell the market direction easily. So if you use the EXPONOVA we can easily tell the market trend because when the market is in up trend the EXPONOVA will be green and when the market is in downtrend the EXPONOVA will be red. So if we use pivot and EXPONOVA together we can build a rubout strategy.
This indicator enables you to implement strategies like:
Breakout Trading: Identify critical levels where price might break out for momentum trades.
Virgin Trades: Use untouched levels for precision entries with minimal risk.
Trend Reversals: Spot overbought or oversold zones using Camarilla and Floor Pivots.
Range-Bound Markets: Utilize high/low levels to define boundaries and trade within the range.
How to Use Golden Pivot by thejamiul for High-Accuracy Trading?
1. Breakout Trading If you like breakout trading then this indicator can help you a lot, here we will only take those trade which are broke green zone or red zone. Here green zone mean H3, to H4, and red zone mean L3, L4 . If price closes above green zone then we will plan to go Long and if price closes bellow red zone then we will plan to go Short.
As you can see on the chart when price break the green zone, the market shoot up!
2. Range-Bound Trading: When market are in range bound mode, usually we fear to take trade because we don't have clear idea about major support or resistance and how to take trade in such market. But if you use this indicator it will show you the major support and resistance zone which are red and green colours in this indicator. In range bound market, market usually trade between red zone and green zone so we can trade accordingly.
Supertrend with EMAs (288 & 50)This indicator combines the Supertrend with two key Exponential Moving Averages (EMAs) — the 50 EMA and the 288 EMA — to help traders identify trends and possible entry or exit points in the market.
Key Features:
Supertrend Indicator:
The Supertrend indicator is a widely used trend-following tool. It helps determine whether the market is in an uptrend or downtrend by adjusting based on the Average True Range (ATR).
In this indicator, green represents an uptrend, and red represents a downtrend.
288 EMA:
The 288-period Exponential Moving Average is plotted to show the long-term market trend. It reacts more quickly to recent price changes than a simple moving average, offering an effective way to gauge long-term market direction.
50 EMA:
The 50-period Exponential Moving Average is commonly used as a short-term trend indicator. It helps identify shorter-term trends and serves as a dynamic support/resistance level.
EMA Crossover Alerts:
This indicator includes alerts for when the 50 EMA crosses above the 288 EMA (bullish signal) and when it crosses below (bearish signal), helping traders catch trend reversals or confirmation of current trends.
Supertrend Alerts:
Alerts are triggered when the Supertrend indicator switches from uptrend to downtrend or downtrend to uptrend, indicating a potential shift in market direction.
Usage:
Uptrend Confirmation: When the Supertrend is green and the 50 EMA is above the 288 EMA, it signals that the market is in a strong bullish trend.
Downtrend Confirmation: When the Supertrend is red and the 50 EMA is below the 288 EMA, it indicates that the market is in a bearish trend.
Crossover Signals: The indicator provides alerts when the 50 EMA crosses above or below the 288 EMA, helping traders spot trend changes.
Best For:
Trend-following strategies
Identifying potential trend reversals and market shifts
Traders looking for a combination of short-term and long-term trend analysis
Note: This indicator is most effective when used in conjunction with other technical analysis tools and should be considered alongside other factors such as volume, support/resistance levels, and price action.
GOLDEN RSI by @thejamiulGOLDEN RSI thejamiul is a versatile Relative Strength Index (RSI)-based tool designed to provide enhanced visualization and additional insights into market trends and potential reversal points. This indicator improves upon the traditional RSI by integrating gradient fills for overbought/oversold zones and divergence detection features, making it an excellent choice for traders who seek precise and actionable signals.
Source of this indicator : This indicator is based on @TradingView original RSI indicator with a little bit of customisation to enhance overbought and oversold identification.
Key Features
1. Customizable RSI Settings:
RSI Length: Adjust the RSI calculation period to suit your trading style (default: 14).
Source Selection: Choose the price source (e.g., close, open, high, low) for RSI calculation.
2. Gradient-Filled RSI Zones:
Overbought Zone (80-100): Gradient fill with shades of green to indicate strong bullish conditions.
Oversold Zone (0-20): Gradient fill with shades of red to highlight strong bearish conditions.
3. Support and Resistance Levels:
Upper Band: 80
Middle Bands: 60 (bullish) and 40 (bearish)
Lower Band: 20
These levels help identify overbought, oversold, and neutral zones.
4. Divergence Detection:
Bullish Divergence: Detects lower lows in price with corresponding higher lows in RSI, signaling potential upward reversals.
Bearish Divergence: Detects higher highs in price with corresponding lower highs in RSI, indicating potential downward reversals.
Visual Indicators:
Bullish divergence is marked with green labels and line plots.
Bearish divergence is marked with red labels and line plots.
5. Alert Functionality:
Custom Alerts: Set up alerts for bullish or bearish divergences to stay notified of potential trading opportunities without constant chart monitoring.
6. Enhanced Chart Visualization:
RSI Plot: A smooth and visually appealing RSI curve.
Color Coding: Gradient and fills for better distinction of trading zones.
Pivot Labels: Clear identification of divergence points on the RSI plot.
Dynamic Risk Levels with Buy/Sell TextIntroduction
Risk management and making the right decisions while trading can be quite complex. To help you overcome these challenges, we developed the Dynamic Risk Levels and Buy/Sell Text indicator. This indicator aims to simplify your decision-making processes by combining volatility analysis, dynamic risk levels and RSI (Relative Strength Index) signals. This tool, which clearly visualizes buy/sell levels and risk zones on the chart, offers an ideal solution for investors of all levels.
---
Key Features
1. ATR Based Volatility Calculation
The indicator uses the Average True Range (ATR) method to measure market volatility. Combined with Fibonacci's golden ratio (1.618), ATR creates risk levels that dynamically adapt to market conditions.
2. Determining Buy and Sell Levels
The lowest closing price during a specified period is defined as the buy level, and the highest closing price is defined as the sell level.
3. Dynamic Long and Short Risk Levels
Long (buy) risk level: Buy level + (ATR * 1.618)
Short (sell) risk level: Sell level - (ATR * 1.618)
These levels are constantly updated according to the volatility of the market.
4. Additional Filtering with RSI
RSI (Relative Strength Index) filters out false signals by identifying overbought and oversold areas.
Buy Signal: RSI < 30
Sell Signal: RSI > 70
5. Visualization of Buy/Sell Signals
On the chart:
Buy signals are indicated with a green "Buy" label.
Sell signals are marked with a red "Sell" label.
These visualizations help you make quick and easy decisions.
---
Levels Shown on the Chart
1. Dynamic Risk Levels
Long Risk Level (Green Line): Indicates the safe level for buying positions.
Short Risk Level (Red Line): Indicates the safe level for selling positions.
2. Buy and Sell Levels
Buy Level (Blue Line): Indicates the long-term low closing level.
Sell Level (Orange Line): Indicates the long-term high closing level.
---
How to Use?
1. Long Trading Strategy:
A "Buy" signal is generated when the price goes below the long risk level and then goes above it again and RSI < 30.
2. Short Trading Strategy:
A "Sell" signal is generated when the price goes above the short risk level and then goes below it again and RSI > 70.
---
Conclusion
This indicator supports volatility-based risk management by adapting to the dynamic structure of the market and also provides reliable buy/sell signals. The Dynamic Risk Levels and Buy/Sell Text indicator is an ideal tool for investors who want to create a simple and effective trading strategy.
Using this indicator on the TradingView platform, you can make more informed decisions and better manage your risks.
Remember: No indicator is 100% accurate; always analyze market conditions carefully and pay attention to risk management.
Moving Average Channel (MAC)The strategy uses two Simple Moving Averages (SMA): an upper MA based on the high price and a lower MA based on the low price. Key features include:
Entry Condition: Enter a long position after five consecutive bars close above the upper MA.
Exit Conditions:
Close the position if five consecutive bars close below the lower MA.
Close the position if the price drops below 25% of the highest price recorded since entry (stop-loss).
Key Features:
Dynamic Entry: Long position is triggered only after consistent strength in price (5 bars above the upper MA).
Dynamic Exit:
Tracks weakness (5 bars below the lower MA) for exit.
Implements a stop-loss based on 25% retracement from the highest price recorded post-entry.
Customizable Parameters: MA lengths and stop-loss percentage are adjustable to fit different trading styles and market conditions.
This script provides a simple yet effective trend-following strategy with built-in risk management.
RY-Parabolic Stop and ReverseParabolic Stop and Reverse with Support Resistance (PSAR-SR)
Identify dynamic support and resistance levels based on price movements.
Reduce false signals often generated by the regular PSAR.
Provide more accurate trading decisions by considering previous reversal points as support and resistance.
How Does PSAR-SR Work?
PSAR Reversal Points:
When the regular PSAR generates a reversal signal, the price at that reversal point is used as support (in an uptrend) or resistance (in a downtrend).
Support and Resistance Lines:
Support: A line drawn from the previous PSAR reversal point in an uptrend.
Resistance: A line drawn from the previous PSAR reversal point in a downtrend.
Price often moves sideways between these support and resistance levels before a breakout occurs.
Breakout Above/Below Support and Resistance:
A Buy signal is generated when the price breaks above resistance with a new candle closing above it.
A Sell signal is generated when the price breaks below support with a new candle closing below it.
Strategy Using PSAR-SR
Wait for the Breakout:
Avoid buying or selling immediately when the PSAR gives a signal.
Confirm that the price breaks past the support or resistance levels and forms a new candle outside those lines.
Use Alongside Other Indicators:
PSAR-SR is not recommended as a standalone tool. Use additional confirmation indicators such as:
Moving Average: To identify long-term trends.
RSI or MACD: To confirm momentum or overbought/oversold conditions.
Advantages of PSAR-SR
Reduces False Signals:
By focusing on previous support and resistance levels, PSAR-SR avoids invalid signals.
Helps Identify Breakouts:
It provides better insight for traders to enter the market during valid breakouts.
Limitations of PSAR-SR
Not Suitable for Sideways Markets:
If the price moves sideways for an extended period, the signals may become less effective.
Requires Additional Confirmation:
Should be used in combination with other indicators to improve accuracy.
Conclusion
PSAR-SR is a helpful tool for identifying dynamic support and resistance levels and generating buy/sell signals based on price breakouts. However, it should always be used with additional indicators for confirmation to avoid false trades.
Disclaimer:
Use this indicator at your own risk, and always perform additional analysis before making any trading decisions.
If you'd like further clarification or examples of how to apply this to a chart, feel free to ask! 😊
80% win rate_ONE postion_DEMO//@version=5
indicator('AAtrading', shorttitle='AAtrading', overlay=true)
// الإعدادات الثابتة (ATR Period = 10, Multiplier = 3)
length = 10 // فترة ATR ثابتة
mult = 3.0 // معامل ATR ثابت
useClose = input.bool(title='Use Close Price for Extremums', defval=true)
showLabels = input.bool(title='Show Buy/Sell Labels', defval=true)
highlightState = input.bool(title='Highlight State', defval=true)
// إعدادات السيولة
outlierThreshold = input.int(title='Outlier Threshold Length', defval=10)
fastMovingAverageLength = 100 // فترة MA السريع ثابتة
slowMovingAverageLength = 200 // فترة MA البطيء ثابتة
// خيارات الألوان
buyColor = input.color(title='Buy Signal Color', defval=color.green)
sellColor = input.color(title='Sell Signal Color', defval=color.red)
// حساب الـ ATR
atr = mult * ta.atr(length)
// حساب نقاط التوقف للمراكز الطويلة والقصيرة
longStop = (useClose ? ta.highest(close, length) : ta.highest(length)) - atr
longStopPrev = nz(longStop , longStop)
longStop := close > longStopPrev ? math.max(longStop, longStopPrev) : longStop
shortStop = (useClose ? ta.lowest(close, length) : ta.lowest(length)) + atr
shortStopPrev = nz(shortStop , shortStop)
shortStop := close < shortStopPrev ? math.min(shortStop, shortStopPrev) : shortStop
// تحديد الاتجاه (1=شراء, -1=بيع)
var int dir = 1
dir := close > shortStopPrev ? 1 : close < longStopPrev ? -1 : dir
// حساب السيولة (Liquidity) بناءً على الحركة السعرية
priceMovementLiquidity = volume / math.abs(close - open)
// حساب الحدود لتحديد السيولة المتطرفة
liquidityBoundary = ta.ema(priceMovementLiquidity, outlierThreshold) + ta.stdev(priceMovementLiquidity, outlierThreshold)
// إنشاء مصفوفة لتخزين قيم السيولة
var liquidityValues = array.new_float(5)
// التحقق إذا كانت السيولة تتجاوز الحدود
if ta.crossover(priceMovementLiquidity, liquidityBoundary)
array.insert(liquidityValues, 0, close)
// حساب المتوسطات المتحركة (EMAs) على آخر قيمة سيولة
fastEMA = ta.ema(array.get(liquidityValues, 0), fastMovingAverageLength)
slowEMA = ta.ema(array.get(liquidityValues, 0), slowMovingAverageLength)
// رسم المتوسطات المتحركة (EMAs) بناءً على السيولة
fastPlot = plot(fastEMA, color = fastEMA > slowEMA ? color.new(buyColor, 50) : color.new(sellColor, 50))
slowPlot = plot(slowEMA, color = fastEMA > slowEMA ? color.new(buyColor, 50) : color.new(sellColor, 50))
// إنشاء تظليل بين EMAs
fill(fastPlot, slowPlot, fastEMA, slowEMA, fastEMA > slowEMA ? color.new(buyColor, 50) : color.new(sellColor, 50), color.new(chart.bg_color, 80))
// إشارات الشراء والبيع بناءً على المتوسطات والسيولة
buySignal = dir == 1 and dir == -1 and fastEMA > slowEMA
sellSignal = dir == -1 and dir == 1 and fastEMA < slowEMA
// رسم إشارات الشراء والبيع
plotshape(buySignal and showLabels ? longStop : na, title='Buy Label', text='Buy', location=location.absolute, style=shape.labelup, size=size.tiny, color=color.new(buyColor, 0), textcolor=color.white)
plotshape(sellSignal and showLabels ? shortStop : na, title='Sell Label', text='Sell', location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.new(sellColor, 0), textcolor=color.white)
// إشعارات التنبيه (Alerts)
alertcondition(buySignal, title='Buy Alert', message='🚨 Buy Signal from Chandelier Exit + LWMAs!')
alertcondition(sellSignal, title='Sell Alert', message='🚨 Sell Signal from Chandelier Exit + LWMAs!')
지지 저항 보급
// █▀▀▄ ──▀ █▀▀█ █▀▀█ █▀▀▀ █──█ █▀▄▀█
// █▀▀▄ ──█ █──█ █▄▄▀ █─▀█ █──█ █─▀─█
// ▀▀▀─ █▄█ ▀▀▀▀ ▀─▀▀ ▀▀▀▀ ─▀▀▀ ▀───▀
// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// © Bjorgum
//@version=5
indicator ('Dhananjay and Ajay Support and Resistance', 'Dhananjay and Ajay Support and Resistance', overlay= true, max_boxes_count= 500, max_labels_count= 500, max_lines_count=500)
import Bjorgum/BjCandlePatterns/2 as bj
// ================================== //
// ------------> Tips <-------------- //
// ================================== //
leftTip = "Look left for swing high/low in x number of bars to form pivot. The higher the number, the higher the script looks to the left for the highest/lowest point before drawing pivot"
rightTip = "Look right for swing high/low in x number of bars to form pivot. The higher the number, the higher the script looks to the right for the highest/lowest point before drawing pivot"
nPivTip = "This sets the array size, or the number of pivots to track at a time (x highs, and x number of lows)"
atrLenTip = "Number of bars to average. ATR is used to standardize zone width between assets and timeframes"
multTip = "ATR multiplier to set zone width. Default is half of one ATR from box bottom to box top"
perTip = "Max zone size as a percent of price. Some assets can be too volatile at low prices creating an unreasonably sized zone"
maxTip = "Number of boxes for candlestick patterns to track historically. Note: the higher the number the less pivot zones will be tracked when looking back in time due to the limitation on the number of box elements allowed at once"
futTip = "Number of bars to offset labels for price levels"
srcTip = "Source input for pivots. Default tracks the highest and lowest bodies of HA candles to average price action, which can result in a level that sits in the overlap of support and resistance"
alignZonesTip = "Aligns recurring zones who's edges overlap an existing zone creating a zone that ages in time and intensifies visually"
extendTip = "Extends current zones right"
lLabTip = "Show labels for price levels extended off Key Levels"
dhighsTip = "Disabling will prevent highs from being tracked"
dlowsTip = "Disabling will prevent lows from being tracked"
detectBOTip = "Show points that price action breaks above all pivots. An arrow from below is displayed"
detectBDTip = "Show points that price action breaks below all pivots. An arrow from above is displayed"
breakUpTip = "Show points that price action breaks above resistance. An arrow from below is displayed"
breakDnTip = "Show points that price action breaks below support. An arrow from above is displayed"
falseBullTip = "Show points that price action initially breaks below support before reversing. False moves can lead to fast moves in the opposite direction (bear trap). A large arrow from below is displayed"
falseBearTip = "Show points that price action initially breaks above resistance before reversing. False moves can lead to fast moves in the opposite direction (bull trap). A large arrow from above is displayed"
supPushTip = "Show up candles that are detected within a support zone. Can show points support is being respected. A triangle from below is displayed"
resPushTip = "Show down candles that are detected within a resistance zone. Can show points resistance is being respected. A triangle from above is displayed"
curlTip = "Show Bjorgum TSI 'curl' when candles are detected in the range of a key zone. Can show momentum shift at Key Levels. (Correlates to Bjorgum TSI indicator)"
repaintTip = "Wait for candles end before detecting patterns. False will show potential patterns forming before they are confirmed."
labelsTip = "Show a label for detected candle patterns"
sBoxTip = "Show a box around detected candle patterns"
dTip = "Detect Doji candle patterns"
beTip = "Detect Engulfing patterns"
hsTip = "Detect Hammers and Shooting Star patterns"
dgTip = "Detect Dragonfly Doji and Gravestone Doji patterns"
twTip = "Detect Tweezer Top and Tweezer Bottom patterns"
stTip = "Detect Spinning Top patterns"
pcTip = "Detect Piercing and Dark Cloud Cover patterns"
bhTip = "Detect Harami candle patterns"
lsTip = "Detect Long Upper Shadow and Long Lower Shadow patterns"
ecWickTip = "Determines if engulfing candles must engulf the wick or just the body of the preceding candle"
colorMatchTip = "Determines if hammers must be up candles and shooting stars must be down candles"
closeHalfTip = "Determines if Tweezer patterns must close beyond the half way point of the preceding candle"
atrMaxTip = "Maximum size of setup candles (as a multiplier of the current ATR)"
rejectWickTip = "The maximum wick size as a percentage of body size allowable for a rejection wick on the resolution candle of the pattern. 0 disables the filter"
hammerFibTip = "The relationship of body to candle size for hammers and stars. (ie. body is 33% of total candle size)."
hsShadowPercTip = "The maximum allowable opposing wick size as a percent of body size (ex. top wick for a hammer pattern etc.)"
hammerSizeTip = "The minimum size of hammers, stars, or long shadows as a multiplier of ATR. (To filter out tiny setups)"
dojiSizeTip = "The relationship of body to candle size (ie. body is 5% of total candle size)."
dojiWickSizeTip = "Maximum wick size comparative to the opposite wick. (eg. 2 = bottom wick must be less than or equal to 2x the top wick)."
luRatioTip = "A relationship of the upper wick to the overall candle size expressed as a percent."
lookbackTip = "Number of candles that can be included in a false break signal"
swingTip = "Swing detection is used to filter signals on breakout type signals. A higher number will mean more significant points, but less of them"
reflectTip = "Filter to ensure a setup is a significant swing point. Look back this far"
offsetTip = "Candle pattern high/low distance from absolute swing high/low. Example: 0 would filter patterns that are only the highest/lowest, 1 filters second highest over the significant length, etc."
bullPivotTip = "Color of bullish Key Levels (border, background)"
bearPivotTip = "Color of bearish Key Levels (border, background)"
breakoutTip = "Color of breakout arrows (bull, bear,)"
SnRTip = "Color of triangles for broken support or resistance (bull, bear)"
falseBreakTip = "Color of arrows for false breaks (bull, bear, arrow max height in pixels)"
moveTip = "Color of triangles for candles that are detected within zones (bull, bear)"
patTip = "Color of boxes that wrap candestick patterns Backgrounds: (bull, neutral, bear) Borders: (bull, neutral, bear)"
labTip = "Color of labels that mark candestick patterns Text: (bull, neutral, bear) Labels: (bull, neutral, bear)"
stratTip = "TSI speed control presets. Both speeds correlate to the Bjorgum TSI indicator"
// ================================== //
// ---------> User Input <----------- //
// ================================== //
left = input.int (20 , "Look Left" , group= "Zones" , tooltip= leftTip )
right = input.int (15 , "Look Right" , group= "Zones" , tooltip= rightTip )
nPiv = input.int (4 , "Number of Pivots" , group= "Zones" , tooltip= nPivTip )
atrLen = input.int (30 , "ATR Length" , group= "Zones" , tooltip= atrLenTip )
mult = input.float (0.5 , "Zone Width (ATR)" , group= "Zones" , tooltip= multTip , step = 0.1)
per = input.float (5 , "Max Zone Percent" , group= "Zones" , tooltip= perTip )
max = input.float (10 , "Max Boxes for Patterns" , group= "Zones" , tooltip= maxTip )
fut = input.int (30 , "Offset For Labels" , group= "Zones" , tooltip= futTip )
src = input.string ("HA" , "Source For Pivots" , group= "Zones" , tooltip= srcTip , options= )
alignZones = input.bool (true , "Align Zones" , group= "Zones" , tooltip= alignZonesTip )
extend = input.bool (false , "Extend Right" , group= "Zones" , tooltip= extendTip )
lLab = input.bool (false , "Show Level Labels" , group= "Zones" , tooltip= lLabTip )
dhighs = input.bool (true , "Detect Pivot Highs" , group= "Detection" , tooltip= dhighsTip )
dlows = input.bool (true , "Detect Pivot Lows" , group= "Detection" , tooltip= dlowsTip )
detectBO = input.bool (false , "Detect Breakout" , group= "Detection" , tooltip= detectBOTip )
detectBD = input.bool (false , "Detect Breakdown" , group= "Detection" , tooltip= detectBDTip )
breakUp = input.bool (false , "Detect Resistance Break" , group= "Detection" , tooltip= breakUpTip )
breakDn = input.bool (false , "Detect Support Break" , group= "Detection" , tooltip= breakDnTip )
falseBull = input.bool (false , "Detect False Breakdown" , group= "Detection" , tooltip= falseBullTip )
falseBear = input.bool (false , "Detect False Breakup" , group= "Detection" , tooltip= falseBearTip )
supPush = input.bool (false , "Detect Moves Off Support" , group= "Detection" , tooltip= supPushTip )
resPush = input.bool (false , "Detect Moves Off Resistance" , group= "Detection" , tooltip= resPushTip )
curl = input.bool (false , "Detect TSI Curl" , group= "Detection" , tooltip= curlTip )
repaint = input.bool (true , "Wait For Confirmed Bar" , group= "Candle Patterns" , tooltip= repaintTip )
labels = input.bool (false , "Show Label" , group= "Candle Patterns" , tooltip= labelsTip )
sBox = input.bool (false , "Show Boxes Around Patterns" , group= "Candle Patterns" , tooltip= sBoxTip )
d_ = input.bool (false , "Detect Doji" , group= "Candle Patterns" , tooltip= dTip )
be_ = input.bool (false , "Detect Engulfing" , group= "Candle Patterns" , tooltip= beTip )
hs_ = input.bool (false , "Detect Hammers and Stars" , group= "Candle Patterns" , tooltip= hsTip )
dg_ = input.bool (false , "Detect Dragons and Graves" , group= "Candle Patterns" , tooltip= dgTip )
tw_ = input.bool (false , "Detect Tweezers" , group= "Candle Patterns" , tooltip= twTip )
st_ = input.bool (false , "Detect Spinning Top" , group= "Candle Patterns" , tooltip= stTip )
pc_ = input.bool (false , "Detect Piercing and Clouds" , group= "Candle Patterns" , tooltip= pcTip )
bh_ = input.bool (false , "Detect Harami" , group= "Candle Patterns" , tooltip= bhTip )
ls_ = input.bool (false , "Detect Long Shadows" , group= "Candle Patterns" , tooltip= lsTip )
alertMode = input.string (alert.freq_once_per_bar_close , "Alerts Mode" , group = "Alert Frequency" , options= )
ecWick = input.bool (false , "Engulfing Must Engulf Wick" , group= "Candle Filters" , tooltip= ecWickTip )
colorMatch = input.bool (false , "H&S Must Match Color" , group= "Candle Filters" , tooltip= colorMatchTip )
closeHalf = input.bool (false , "Tweezer Close Over Half" , group= "Candle Filters" , tooltip= closeHalfTip )
atrMax = input.float (0.0 , "Max Candle Size (× ATR)" , group= "Candle Filters" , tooltip= atrMaxTip , step= 0.1 )
rejectWickMax = input.float (0.0 , " Max Reject Wick Size" , group= "Candle Filters" , tooltip= rejectWickTip , step= 1 )
hammerFib = input.float (33 , " H&S Ratio (%)" , group= "Candle Filters" , tooltip= hammerFibTip , step= 1 )
hsShadowPerc = input.float (5 , " H&S Opposing Shadow (%)" , group= "Candle Filters" , tooltip= hsShadowPercTip , step= 1 )
hammerSize = input.float (0.1 , " H&S Min Size (× ATR)" , group= "Candle Filters" , tooltip= hammerSizeTip , step= 0.1 )
dojiSize = input.float (5 , " Doji Size (%)" , group= "Candle Filters" , tooltip= dojiSizeTip , step= 1 )
dojiWickSize = input.float (2 , " Max Doji Wick Size" , group= "Candle Filters" , tooltip= dojiWickSizeTip , step= 1 )
luRatio = input.float (75 , " Long Shadow (%)" , group= "Candle Filters" , tooltip= luRatioTip , step= 1 )
lookback = input.int (2 , "Lookback For Breaks" , group= "Lookback" , tooltip= lookbackTip )
swing = input.int (5 , "swing High/Low" , group= "Lookback" , tooltip= swingTip )
reflect = input.int (10 , "Significant High/Low" , group= "Lookback" , tooltip= reflectTip )
offset = input.int (1 , "Consider Bar From High/Low" , group= "Lookback" , tooltip= offsetTip )
bullBorder = input.color (color.new (color.blue, 60), "", inline= "0" , group= "Pivot Color" )
bullBgCol = input.color (color.new (color.blue, 95), "", inline= "0" , group= "Pivot Color" , tooltip= bullPivotTip )
bearBorder = input.color (color.new (color.red, 60), "", inline= "1" , group= "Pivot Color" )
bearBgCol = input.color (color.new (color.red, 95), "", inline= "1" , group= "Pivot Color" , tooltip= bearPivotTip )
upCol = input.color (color.new (#ff6d00, 25), "", inline= "2" , group= "Breakout Color" )
dnCol = input.color (color.new (#ff00ff, 25), "", inline= "2" , group= "Breakout Color" , tooltip= breakoutTip )
supCol = input.color (color.new (#17ff00, 25), "", inline= "3" , group= "S&R Break Color" )
resCol = input.color (color.new (#ff0000, 25), "", inline= "3" , group= "S&R Break Color" , tooltip= SnRTip )
fBull = input.color (color.new (#17ff00, 25), "", inline= "4" , group= "False Break Color" )
fBear = input.color (color.new (#ff0000, 25), "", inline= "4" , group= "False Break Color" )
arrowMax = input.int (75 , "", inline= "4" , group= "False Break Color" , tooltip= falseBreakTip )
moveBullCol = input.color (color.new (#64b5f6, 25), "", inline= "5" , group= "Moves From S&R Color" )
moveBearCol = input.color (color.new (#ffeb3b, 25), "", inline= "5" , group= "Moves From S&R Color" , tooltip= moveTip )
curlBullCol = input.color (color.new (#17ff00, 40), "", inline= "6" , group= "Momentum Curl Color" )
curlBearCol = input.color (color.new (#f3ff00, 40), "", inline= "6" , group= "Momentum Curl Color" , tooltip= curlTip )
patBullBg = input.color (color.new (#17ff00, 90), "", inline= "7" , group= "Pattern Box Color" )
patNeutBg = input.color (color.new (#b2b5be, 90), "", inline= "7" , group= "Pattern Box Color" )
patBearBg = input.color (color.new (#ff0000, 90), "", inline= "7" , group= "Pattern Box Color" )
patBullBo = input.color (color.new (#17ff00, 80), "", inline= "8" , group= "Pattern Box Color" )
patNeutBo = input.color (color.new (#b2b5be, 80), "", inline= "8" , group= "Pattern Box Color" )
patBearBo = input.color (color.new (#ff0000, 80), "", inline= "8" , group= "Pattern Box Color" , tooltip= patTip )
textBullCol = input.color (color.new (#17ff00, 0), "", inline= "9" , group= "Label Color (Text/Bg)" )
textNeutCol = input.color (color.new (#b2b5be, 0), "", inline= "9" , group= "Label Color (Text/Bg)" )
textBearCol = input.color (color.new (#ff0000, 0), "", inline= "9" , group= "Label Color (Text/Bg)" )
labBullCol = input.color (color.new (#17ff00, 80), "", inline= "10" , group= "Label Color (Text/Bg)" )
labNeutCol = input.color (color.new (#b2b5be, 80), "", inline= "10" , group= "Label Color (Text/Bg)" )
labBearCol = input.color (color.new (#ff0000, 80), "", inline= "10" , group= "Label Color (Text/Bg)", tooltip= labTip )
strat = input.string ("Fast" , "Select a Speed" , group= "TSI Speed Control" , tooltip= stratTip , options= )
longf = input.int (25 , "Long Length" , group= "TSI Fast Settings" )
shortf = input.int (5 , "Short Length" , group= "TSI Fast Settings" )
signalf = input.int (14 , "Signal Length" , group= "TSI Fast Settings" )
longs = input.int (25 , "Long Length" , group= "TSI Slow Settings" )
shorts = input.int (13 , "Short Length" , group= "TSI Slow Settings" )
signals = input.int (13 , "Signal Length" , group= "TSI Slow Settings" )
// ================================== //
// -----> Immutable Constants <------ //
// ================================== //
sync = bar_index
labUp = label.style_label_up
labDn = label.style_label_down
confirmed = barstate.isconfirmed
extrap = extend ? extend.right : extend.none
var pivotHigh = array.new_box (nPiv)
var pivotLows = array.new_box (nPiv)
var highBull = array.new_bool (nPiv)
var lowsBull = array.new_bool (nPiv)
var boxes = array.new_box ()
haSrc = src == "HA"
hiLoSrc = src == "High/Low"
tsifast = strat == "Fast"
tsislow = strat == "Slow"
// ================================== //
// ---> Functional Declarations <---- //
// ================================== //
atr = ta.atr (atrLen)
perMax = close* 0.02
min = math.min (perMax, atr*0.3)
_haBody() =>
haClose = (open + high + low + close) / 4
haOpen = float(na)
haOpen := na(haOpen ) ? (open + close) / 2 :
(nz(haOpen ) + nz(haClose )) / 2
_extend(_x) =>
for i = 0 to array.size (_x)-1
box.set_right (array.get (_x, i), sync)
_arrayLoad(_x, _max, _val) =>
array.unshift (_x, _val)
if array.size (_x) > _max
array.pop (_x)
_arrayBox(_x, _max, _val) =>
array.unshift (_x, _val)
if array.size (_x) > _max
_b = array.pop (_x)
if extend
box.set_extend (_b, extend.none)
_arrayWrap(_x, _max, _val) =>
array.unshift (_x, _val)
if array.size (_x) > _max
box.delete(array.pop (_x))
_delLab(_x) =>
if array.size(_x) > 0
label.delete (array.pop (_x))
_delLine(_x) =>
if array.size(_x) > 0
line.delete (array.pop (_x))
_delLevels(_x, _y) =>
for i = 0 to array.size (_x)-1
_delLab (_x)
_delLine (_y)
_box(_x1, _t, _r, _b, _boCol, _bgCol, _e) =>
box.new( _x1, _t, _r, _b ,
xloc = xloc.bar_index ,
extend = _e ,
border_color= _boCol ,
bgcolor = _bgCol )
_wrap(_cond, _x, _bb, _bc, _bgc) =>
_t = ta.highest (high, _bb) + min
_b = ta.lowest (low , _bb) - min
_l = bar_index - _bb
_r = bar_index + 1
if _cond
_arrayWrap (_x, max, _box (_l, _t, _r, _b, _bc, _bgc, extend.none))
_getBox(_x,_i) =>
_box = array.get (_x,_i)
_t = box.get_top (_box)
_b = box.get_bottom (_box)
_align(_x,_y) =>
for i = 0 to array.size (_x) -1
= _getBox (_y, 0)
= _getBox (_x, i)
if _T > _b and _T < _t or
_B < _t and _B > _b or
_T > _t and _B < _b or
_B > _b and _T < _t
box.set_top (array.get (_y, 0), _t)
box.set_bottom (array.get (_y, 0), _b)
_color(_x, _y) =>
var int _track = nPiv
for i = 0 to array.size (_x) -1
= _getBox (_x, i)
_isBull = array.get (_y, i)
if close > t_ and not _isBull
box.set_extend( array.get (_x, i), extend.none)
array.set(_x, i, _box (sync , t_, sync, b_, bullBorder, bullBgCol, extrap))
array.set(_y, i, true)
_track += 1
if close < b_ and _isBull
box.set_extend( array.get (_x, i), extend.none)
array.set(_x, i, _box (sync , t_, sync, b_, bearBorder, bearBgCol, extrap))
array.set(_y, i, false)
_track -= 1
_track
_detect(_x,_y) =>
int _i = 0
bool _found = false
bool _isBull = na
while (not _found and _i < array.size (_x) )
= _getBox (_x,_i)
if low < t_ and high > b_
_isBull := array.get (_y,_i)
_found := true
_i += 1
_falseBreak(_l) =>
bool _d = false
bool _u = false
for i = 1 to lookback
if _l < _l and _l >= _l and _l < _l
_d := true
if _l > _l and _l <= _l and _l > _l
_u := true
_numLevel(_x,_y) =>
int _above = 0
int _fill = 0
for i = 0 to array.size (_x)-1
_isBull = array.get (_x,i)
if _isBull
_above += 1
if not na(_isBull)
_fill += 1
for i = 0 to array.size (_y)-1
_isBull = array.get (_y,i)
if _isBull
_above += 1
if not na(_isBull)
_fill += 1
_check(_src,_l) =>
bool _check = false
for i = 0 to _l
if _src
_check := true
_check
_count(_src, _l) =>
int _result = 0
for i = 0 to _l
if _src > _src
_result += 1
_result
_label(_x, _y, y, _s, _col1, _col2) =>
transp = math.min (color.t(_col1), color.t(_col2))
array.unshift (_x, label.new (sync+fut, y ,
text = str.tostring(math.round_to_mintick(y) ),
color = color.new(_col1, transp) ,
style = _s ,
textcolor = color.white ))
if not extend and fut > 0
array.unshift (_y, line.new (sync, y, sync+fut, y, color= color.new(_col1, transp)))
_level(_x, _y) =>
var label lab = array.new_label (nPiv)
var line lines = array.new_line (nPiv)
if barstate.islast and lLab
_delLevels (lab, lines)
for i = 0 to array.size (_x)-1
= _getBox (_x,i)
_isBull = array.get (_y,i)
_col1 = _isBull ? bullBgCol : bearBgCol
_col2 = _isBull ? bullBorder : bearBorder
if close > _t
_label (lab, lines, _t, labUp, _col1, _col2)
if close < _b
_label (lab, lines, _b, labDn, _col1, _col2)
if close < _t and close > _b
_label (lab, lines, _t, labDn, _col1, _col2)
_label (lab, lines, _b, labUp, _col1, _col2)
_alert(_x, _y) =>
if _x
alert (_y + timeframe.period + ' chart. Price is ' + str.tostring(close), alertMode)
// ================================== //
// ----> Variable Calculations <----- //
// ================================== //
shortvar = tsifast ? shortf : shorts
longvar = tsifast ? longf : longs
signalvar = tsifast ? signalf : signals
tsi = ta.tsi (close, shortvar, longvar)
tsl = ta.ema (tsi, signalvar)
highest = close == ta.highest (close, right)
lowest = close == ta.lowest (close, right)
closeLows = ta.lowest (close, swing)
closeHigh = ta.highest (close, swing)
numLows = _count (low, reflect)
numHigh = _count (high, reflect)
= _haBody ()
hiHaBod = math.max (close_, open_)
loHaBod = math.min (close_, open_)
hiBod = math.max (close, open)
loBod = math.min (close, open)
srcHigh = haSrc ? hiHaBod : hiLoSrc ? high : hiBod
srcLow = haSrc ? loHaBod : hiLoSrc ? low : loBod
pivot_high = ta.pivothigh (srcHigh, left, right)
pivot_low = ta.pivotlow (srcLow, left, right)
perc = close* (per/100)
band = math.min (atr*mult, perc) /2
HH = pivot_high+ band
HL = pivot_high- band
LH = pivot_low+ band
LL = pivot_low- band
coDiff = close - open
// ================================== //
// --------> Logical Order <--------- //
// ================================== //
if pivot_high and dhighs and confirmed
_arrayLoad (highBull , nPiv, false)
_arrayBox (pivotHigh, nPiv, _box(sync , HH, sync, HL, bearBorder, bearBgCol, extrap))
if pivot_low and dlows and confirmed
_arrayLoad (lowsBull , nPiv, true)
_arrayBox (pivotLows, nPiv, _box(sync , LH, sync, LL, bullBorder, bullBgCol, extrap))
if alignZones
_align (pivotHigh, pivotHigh)
_align (pivotHigh, pivotLows)
_align (pivotLows, pivotLows)
_align (pivotLows, pivotHigh)
_extend (pivotHigh)
_extend (pivotLows)
trackHigh = _color (pivotHigh, highBull)
trackLows = _color (pivotLows, lowsBull)
// ================================== //
// ----> Conditional Parameters <---- //
// ================================== //
isLows = closeLows == close
isHigh = closeHigh == close
wasLows = _check (isLows, lookback)
wasHigh = _check (isHigh, lookback)
= _numLevel (highBull, lowsBull)
moveAbove = trackHigh > trackHigh
moveBelow = trackLows < trackLows
resBreak = (trackLows > trackLows or moveAbove)
supBreak = (trackHigh < trackHigh or moveBelow)
breakOut = moveAbove and highest and above == total
breakDwn = moveBelow and lowest and above == 0
= _falseBreak (trackHigh)
= _falseBreak (trackLows)
falseBreakBull = wasLows and (dh or dl)
falseBreakBear = wasHigh and (uh or ul)
= _detect (pivotHigh, highBull)
= _detect (pivotLows, lowsBull)
bull = (fh or fl) and (hb or lb)
bear = (fh or fl) and not (hb or lb)
bullCheck = not resBreak and not resBreak and (fh or fl) and close > open and (hb or lb)
bearCheck = not supBreak and not supBreak and (fh or fl) and close < open and not (hb or lb)
highrange = reflect-offset
lowsrange = offset
sigLows = numLows <= lowsrange
sigHigh = numHigh >= highrange
isBull1 = sigLows and bull
isBear1 = sigHigh and bear
isBull2 = (sigLows or sigLows ) and (bull or bull )
isBear2 = (sigHigh or sigHigh ) and (bear or bear )
data = tsi > tsi and tsi < tsl
dtat = tsi < tsi and tsi > tsl
hMatch = not colorMatch or close > open
sMatch = not colorMatch or close < open
hsFilter = bj.barRange() >= hammerSize * atr
atrMaxSize = bj.barRange() <= atrMax * atr or atrMax == 0.0
rp = confirmed or not repaint
// ================================== //
// -----> Pattern Recognition <------ //
// ================================== //
dw = isBull1 and rp and d_ and atrMaxSize and bj.doji (dojiSize = dojiSize, dojiWickSize = dojiWickSize)
db = isBear1 and rp and d_ and atrMaxSize and bj.doji (dojiSize = dojiSize, dojiWickSize = dojiWickSize)
bew = isBull2 and rp and be_ and atrMaxSize and bj.bullEngulf (maxRejectWick = rejectWickMax, mustEngulfWick = ecWick)
beb = isBear2 and rp and be_ and atrMaxSize and bj.bearEngulf (maxRejectWick = rejectWickMax, mustEngulfWick = ecWick)
h = isBull1 and rp and hs_ and atrMaxSize and bj.hammer (ratio = hammerFib, shadowPercent = hsShadowPerc) and hsFilter and hMatch
ss = isBear1 and rp and hs_ and atrMaxSize and bj.star (ratio = hammerFib, shadowPercent = hsShadowPerc) and hsFilter and sMatch
dd = isBull1 and rp and dg_ and atrMaxSize and bj.dragonflyDoji ()
gd = isBear1 and rp and dg_ and atrMaxSize and bj.gravestoneDoji ()
tb = isBull2 and rp and tw_ and atrMaxSize and bj.tweezerBottom (closeUpperHalf = closeHalf)
tt = isBear2 and rp and tw_ and atrMaxSize and bj.tweezerTop (closeLowerHalf = closeHalf)
stw = isBull1 and rp and st_ and atrMaxSize and bj.spinningTop ()
stb = isBear1 and rp and st_ and atrMaxSize and bj.spinningTop ()
p = isBull1 and rp and pc_ and atrMaxSize and bj.piercing ()
dcc = isBear1 and rp and pc_ and atrMaxSize and bj.darkCloudCover ()
bhw = isBull1 and rp and bh_ and atrMaxSize and bj.haramiBull ()
bhb = isBear1 and rp and bh_ and atrMaxSize and bj.haramiBear ()
ll = isBull1 and rp and ls_ and atrMaxSize and bj.lls (ratio = luRatio) and hsFilter
lu = isBear1 and rp and ls_ and atrMaxSize and bj.lus (ratio = luRatio) and hsFilter
// ================================== //
// ------> Graphical Display <------- //
// ================================== //
plotFalseDn = falseBull and falseBreakBull
plotFalseUp = falseBear and falseBreakBear
falseUpCol = plotFalseUp ? upCol : na
falseDnCol = plotFalseDn ? dnCol : na
plotBreakOut = breakOut and detectBO and not plotFalseDn
plotBreakDn = breakDwn and detectBD and not plotFalseUp
plotResBreak = resBreak and breakUp and not (plotBreakOut or plotFalseDn)
plotSupBreak = supBreak and breakDn and not (plotBreakDn or plotFalseUp)
plotBullCheck = bullCheck and supPush
plotBearCheck = bearCheck and resPush
plotCurlBull = curl and data and bull
plotCurlBear = curl and dtat and bear
plotarrow (plotFalseUp ? coDiff : na , colorup = fBull , colordown= fBear , maxheight= arrowMax)
plotarrow (plotFalseDn ? coDiff : na , colorup = fBull , colordown= fBear , maxheight= arrowMax)
plotshape (plotBreakOut , style=shape.arrowup , location=location.belowbar, color= upCol , size= size.small)
plotshape (plotBreakDn , style=shape.arrowdown , location=location.abovebar, color= dnCol , size= size.small)
plotshape (plotResBreak , style=shape.arrowup , location=location.belowbar, color= supCol, size= size.small)
plotshape (plotSupBreak , style=shape.arrowdown , location=location.abovebar, color= resCol, size= size.small)
plotshape (plotBullCheck , style=shape.triangleup , location=location.belowbar, color= moveBullCol)
plotshape (plotBearCheck , style=shape.triangledown, location=location.abovebar, color= moveBearCol)
plotshape (plotCurlBull , style=shape.triangleup , location=location.belowbar, color= curlBullCol)
plotshape (plotCurlBear , style=shape.triangledown, location=location.abovebar, color= curlBearCol)
bj.dLab (dw and labels, labNeutCol, textNeutCol), _wrap (dw and sBox, boxes, 1, patNeutBo, patNeutBg)
bj.bewLab (bew and labels, labBullCol, textBullCol), _wrap (bew and sBox, boxes, 2, patBullBo, patBullBg)
bj.hLab (h and labels, labBullCol, textBullCol), _wrap (h and sBox, boxes, 1, patBullBo, patBullBg)
bj.ddLab (dd and labels, labBullCol, textBullCol), _wrap (dd and sBox, boxes, 1, patBullBo, patBullBg)
bj.tbLab (tb and labels, labBullCol, textBullCol), _wrap (tb and sBox, boxes, 2, patBullBo, patBullBg)
bj.stwLab (stw and labels, labNeutCol, textNeutCol), _wrap (stw and sBox, boxes, 1, patBullBo, patNeutBg)
bj.pLab (p and labels, labBullCol, textBullCol), _wrap (p and sBox, boxes, 2, patBullBo, patBullBg)
bj.hwLab (bhw and labels, labBullCol, textBullCol), _wrap (bhw and sBox, boxes, 2, patBullBo, patBullBg)
bj.llsLab (ll and labels, labBullCol, textBullCol), _wrap (ll and sBox, boxes, 1, patBullBo, patBullBg)
bj.dLab (db and labels, labNeutCol, textNeutCol), _wrap (db and sBox, boxes, 1, patNeutBo, patNeutBg)
bj.bebLab (beb and labels, labBearCol, textBearCol), _wrap (beb and sBox, boxes, 2, patBearBo, patBearBg)
bj.ssLab (ss and labels, labBearCol, textBearCol), _wrap (ss and sBox, boxes, 1, patBearBo, patBearBg)
bj.gdLab (gd and labels, labBearCol, textBearCol), _wrap (gd and sBox, boxes, 1, patBearBo, patBearBg)
bj.ttLab (tt and labels, labBearCol, textBearCol), _wrap (tt and sBox, boxes, 2, patBearBo, patBearBg)
bj.stbLab (stb and labels, labNeutCol, textNeutCol), _wrap (stb and sBox, boxes, 1, patBearBo, patBearBg)
bj.dccLab (dcc and labels, labBearCol, textBearCol), _wrap (dcc and sBox, boxes, 2, patBearBo, patBearBg)
bj.hbLab (bhb and labels, labBearCol, textBearCol), _wrap (bhb and sBox, boxes, 2, patBearBo, patBearBg)
bj.lusLab (lu and labels, labBearCol, textBearCol), _wrap (lu and sBox, boxes, 1, patBearBo, patBearBg)
_level (pivotHigh, highBull)
_level (pivotLows, lowsBull)
// ================================== //
// -----> Alert Functionality <------ //
// ================================== //
alertcondition (resBreak , 'Resistance break' , 'Resistance broke on {{interval}} chart. Price is {{close}}' )
alertcondition (supBreak , 'Support break' , 'Support broke on {{interval}} chart. Price is {{close}}' )
alertcondition (bullCheck , 'Found support' , 'Pushing Off Key Level Support on {{interval}} chart. Price is {{close}}' )
alertcondition (bearCheck , 'Found resistance' , 'Pushing Off Key Level Resistance on {{interval}} chart. Price is {{close}}' )
alertcondition (falseBreakBull , 'False break down' , 'False Break Down on {{interval}} chart. Price is {{close}}' )
alertcondition (falseBreakBear , 'False break up' , 'False Break Up on {{interval}} chart. Price is {{close}}' )
alertcondition (breakOut , 'Breakout' , 'Breakout on {{interval}} chart. Price is {{close}}' )
alertcondition (breakDwn , 'Breakdown' , 'Breakdown on {{interval}} chart. Price is {{close}}' )
_alert (plotResBreak , 'Resistance broke on ' )
_alert (plotSupBreak , 'Support break ' )
_alert (plotBullCheck , 'Pushing off key level support on ' )
_alert (plotBearCheck , 'Pushing off key level resistance on ' )
_alert (plotFalseDn , 'False break down on ' )
_alert (plotFalseUp , 'False break up on ' )
_alert (plotBreakOut , 'Breakout on ' )
_alert (plotBreakDn , 'Breakdown on ' )
_alert (dw , 'Doji at support on ' )
_alert (db , 'Doji at resistance on ' )
_alert (bew , 'Bullish Engulfing on ' )
_alert (beb , 'Bearish Engulfing on ' )
_alert (h , 'Hammer candle on ' )
_alert (ss , 'Shooting star on ' )
_alert (dd , 'Dragonfly Doji on ' )
_alert (gd , 'Gravestone Doji on ' )
_alert (tb , 'Tweezer Bottom on ' )
_alert (tt , 'Tweezer Top on ' )
_alert (stw , 'White Spinning Top on ' )
_alert (stb , 'Black Spinning Top on ' )
_alert (p , 'Piercing on ' )
_alert (dcc , 'Dark Cloud Cover on ' )
_alert (bhw , 'Bullish Harami on ' )
_alert (bhb , 'Bearish Harami on ' )
_alert (ll , 'Long Lower Shadow on ' )
_alert (lu , 'Long Upper Shadow on ' )
// ____ __ _ ____
// ( __)( ( \( \
// ) _) / / ) D (
// (____)\_)__)(____/
AVP 259 alertsits a mixture of indicators that merges the famous indicators in one single form to easily get explained with their study and mastery
Candle Rangethe Candle Range refers to the difference between the high price (High) and the low price (Low) of a specific candle or bar.
Example:
For a given candle on the chart:
The high price is 120.
The low price is 100.
The candle range is 20 (120 - 100).
Uses:
Volatility Measurement: The candle range is often used to assess an asset's volatility over time. For example, averaging candle ranges can indicate the average volatility.
Indicator Development: Many indicators, such as Average True Range (ATR), rely on candle ranges to provide insights about market conditions.
Trade Filters: Candle ranges can act as filters in strategies to avoid trading during periods of low volatility.
Moving Average Ribbon SetThe Moving Average Ribbon is a powerful visualization tool for identifying trends and potential reversals in trading. By using 8 moving averages (MAs), you can enhance its sensitivity and applicability to various trading strategies.
Suggested Configuration for an 8-MA Ribbon:
Short-Term MAs: These react quickly to price changes, helping identify immediate trends.
5-period MA
10-period MA
Medium-Term MAs: These offer a balance between sensitivity and reliability.
20-period MA
30-period MA
Long-Term MAs: These filter out short-term noise, focusing on macro trends.
50-period MA
100-period MA
Extended-Term MAs: These highlight the overarching market sentiment.
150-period MA
200-period MA
Candle Range (High-Low)the Candle Range refers to the difference between the high price (High) and the low price (Low) of a specific candle or bar.
Example:
For a given candle on the chart:
The high price is 120.
The low price is 100.
The candle range is 20 (120 - 100).
Uses:
Volatility Measurement: The candle range is often used to assess an asset's volatility over time. For example, averaging candle ranges can indicate the average volatility.
Indicator Development: Many indicators, such as Average True Range (ATR), rely on candle ranges to provide insights about market conditions.
Trade Filters: Candle ranges can act as filters in strategies to avoid trading during periods of low volatility.
BB+MACD+RSI//@version=6
indicator("BB+MACD+RSI", shorttitle="MACD_RSI_BB", overlay=true)
// ───── ENTRADAS E CÁLCULOS DE RSI ─────
len_fast = input.int(5, "RSI Rápido")
len_slow = input.int(14, "RSI Lento")
srcF = input.source(close, "Fonte RSI Rápido")
srcS = input.source(close, "Fonte RSI Lento")
upF = ta.rma(math.max(ta.change(srcF), 0), len_fast)
dnF = ta.rma(-math.min(ta.change(srcF), 0), len_fast)
rsiF = dnF == 0 ? 100 : upF == 0 ? 0 : 100 - (100 / (1 + upF/dnF))
upS = ta.rma(math.max(ta.change(srcS), 0), len_slow)
dnS = ta.rma(-math.min(ta.change(srcS), 0), len_slow)
rsiS = dnS == 0 ? 100 : upS == 0 ? 0 : 100 - (100 / (1 + upS/dnS))
// Divergência RSI
divergence = rsiF - rsiS
// ───── MÉDIAS MÓVEIS ─────
ema21 = ta.ema(close, 21)
ema50 = ta.ema(close, 50)
ema200 = ta.ema(close, 200)
// EMA21 colorida conforme divergência RSI
plot(ema21, "EMA 21", color=divergence > 0 ? color.lime : color.red, linewidth=2)
plot(ema50, "EMA 50", color=color.yellow, linewidth=1)
plot(ema200, "EMA 200", color=color.blue, linewidth=1)
// ───── MACD ─────
useCurrentRes = input.bool(true, "Usar Resolução Atual?")
resCustom = input.timeframe("60", "Resolução MACD")
fastLength = input.int(12, "MACD Rápido")
slowLength = input.int(26, "MACD Lento")
signalLength = input.int(9, "MACD Sinal")
source = close
res = useCurrentRes ? timeframe.period : resCustom
macdVal = ta.ema(source, fastLength) - ta.ema(source, slowLength)
signal = ta.sma(macdVal, signalLength)
outMacD = request.security(syminfo.tickerid, res, macdVal)
outSignal = request.security(syminfo.tickerid, res, signal)
// ───── BOLLINGER BANDS (Coloridas pelo MACD) ─────
bbLength = input.int(20, "Período BB")
bbMult = input.float(2, "Desvio BB")
basis = ta.sma(close, bbLength)
dev = ta.stdev(close, bbLength)
upperBB = basis + bbMult * dev
lowerBB = basis - bbMult * dev
plot(basis, "BB Base", color=color.black)
uBB = plot(upperBB, "BB Superior", color=color.black)
lBB = plot(lowerBB, "BB Inferior", color=color.black)
// Cor verde se MACD acima do sinal, vermelho caso contrário
bbTrendColor = outMacD > outSignal ? color.green : color.red
fill(uBB, lBB, color=color.new(bbTrendColor, 80))
// ───── SINAIS DE COMPRA/VENDA ─────
proxCompra = input.float(1.1, "Fator de Proximidade BB (Compra)")
proxVenda = input.float(0.9, "Fator de Proximidade BB (Venda)")
buySignal = ta.cross(outMacD, outSignal) and outMacD >= outSignal and close <= lowerBB * proxCompra
sellSignal = ta.cross(outMacD, outSignal) and outMacD < outSignal and close >= upperBB * proxVenda
// {
MAIN_GROUP = "Main Settings"
DELETE_GROUP = "Deletion Settings"
COSMETIC_GROUP = "Cosmetic Settings"
// }
// {
levelMethod = input.string(
title = "Detection Method",
defval = "Wick",
options = ,
group = MAIN_GROUP)
leftBars = input.int(
title = "Left Bars",
defval = 20,
group = MAIN_GROUP,
inline = "pivot")
rightBars = input.int(
title = "Right Bars",
defval = 20,
group = MAIN_GROUP,
inline = "pivot")
retestLogic = input.bool(
title = "Retest Weaker",
defval = false,
tooltip = "Retest makes level weaker vs retest makes level stronger",
group = MAIN_GROUP)
definitionOfDelete = input.string(
title = "Delete Definition",
defval = "Stop Updating Level",
options = ,
group = DELETE_GROUP)
flipsUntilDeletion = input.int(
title = "Breakouts Until Level Deletes",
defval = 1,
group = DELETE_GROUP)
ageUntilDeletion = input.int(
title = "Bars Until Level Deletes",
defval = 300,
group = DELETE_GROUP)
supportColor = input.color(
title = "Initial Support Re-Test Color",
defval = color.rgb(76, 175, 79, 50),
group = COSMETIC_GROUP)
resistanceColor = input.color(
title = "Initial Resistance Re-Test Color",
defval = color.rgb(255, 82, 82, 50),
group = COSMETIC_GROUP)
uniqueDeleteColor = input.color(
title = "Unique Deletion Color",
defval = color.rgb(120, 123, 134, 50),
group = COSMETIC_GROUP)
changeColorMethod = input.string(
title = "Change Color Method",
defval = "Price Above/Below",
options = ,
group = COSMETIC_GROUP)
lineWidth = input.int(
title = "Line Width",
defval = 10,
group = COSMETIC_GROUP)
// }
// {
type flipLevelManager
array variation
array lineArray
array lineAge
array lineFlips
array linePhase
// }
// {
pivotHigh = ta.pivothigh(
levelMethod == "Wick" ?
high : close > open ? close : open,
leftBars,
rightBars)
pivotLow = ta.pivotlow(
levelMethod == "Wick" ?
low : close < open ? close : open,
leftBars,
rightBars)
newHigh = not na(pivotHigh)
newLow = not na(pivotLow)
newTestedSupport = false
newTestedResistance = false
supportBrokeDownside = false
supportBrokeUpside = false
resistanceBrokeDownside = false
resistanceBrokeUpside = false
var firstPhaseHigh = array.new_float()
var firstPhaseHighI = array.new_int()
var firstPhaseLow = array.new_float()
var firstPhaseLowI = array.new_int()
var secondPhaseHigh = array.new_float()
var secondPhaseHighI = array.new_int()
var secondPhaseLow = array.new_float()
var secondPhaseLowI = array.new_int()
var flipManager = flipLevelManager.new(
array.new_string(),
array.new_line(),
array.new_int(),
array.new_int(),
array.new_int())
if barstate.isconfirmed
if newHigh
array.push(firstPhaseHigh, pivotHigh)
array.push(firstPhaseHighI, bar_index )
if newLow
array.push(firstPhaseLow, pivotLow)
array.push(firstPhaseLowI, bar_index )
for i = array.size(secondPhaseHigh) > 0 ? array.size(secondPhaseHigh) - 1 : na to 0
price = array.get(secondPhaseHigh, i)
index = array.get(secondPhaseHighI, i)
if low <= price and close > price and close > open
newLine = line.new(
x1 = index, y1 = price,
x2 = bar_index, y2 = price,
xloc = xloc.bar_index, extend = extend.none,
color = supportColor, width = lineWidth)
array.push(flipManager.lineArray, newLine)
array.push(flipManager.variation, "Support")
array.push(flipManager.lineAge, 0)
array.push(flipManager.lineFlips, 0)
array.push(flipManager.linePhase, 1)
array.remove(secondPhaseHigh, i)
array.remove(secondPhaseHighI, i)
newTestedSupport := true
else if bar_index - index > 1000 or close < price
array.remove(secondPhaseHigh, i)
array.remove(secondPhaseHighI, i)
for i = array.size(secondPhaseLow) > 0 ? array.size(secondPhaseLow) - 1 : na to 0
price = array.get(secondPhaseLow, i)
index = array.get(secondPhaseLowI, i)
if high >= price and close < price and close < open
newLine = line.new(
x1 = index, y1 = price,
x2 = bar_index, y2 = price,
xloc = xloc.bar_index, extend = extend.none,
color = resistanceColor, width = lineWidth)
array.push(flipManager.lineArray, newLine)
array.push(flipManager.variation, "Resistance")
array.push(flipManager.lineAge, 0)
array.push(flipManager.lineFlips, 0)
array.push(flipManager.linePhase, -1)
array.remove(secondPhaseLow, i)
array.remove(secondPhaseLowI, i)
newTestedResistance := true
else if bar_index - index > 1000 or close > price
array.remove(secondPhaseLow, i)
array.remove(secondPhaseLowI, i)
for i = array.size(firstPhaseHigh) > 0 ? array.size(firstPhaseHigh) - 1 : na to 0
price = array.get(firstPhaseHigh, i)
index = array.get(firstPhaseHighI, i)
if low > price
array.push(secondPhaseHigh, price)
array.push(secondPhaseHighI, index)
array.remove(firstPhaseHigh, i)
array.remove(firstPhaseHighI, i)
else if bar_index - index > 1000
array.remove(firstPhaseHigh, i)
array.remove(firstPhaseHighI, i)
for i = array.size(firstPhaseLow) > 0 ? array.size(firstPhaseLow) - 1 : na to 0
price = array.get(firstPhaseLow, i)
index = array.get(firstPhaseLowI, i)
if high < price
array.push(secondPhaseLow, price)
array.push(secondPhaseLowI, index)
array.remove(firstPhaseLow, i)
array.remove(firstPhaseLowI, i)
else if bar_index - index > 1000
array.remove(firstPhaseLow, i)
array.remove(firstPhaseLowI, i)
for i = array.size(flipManager.lineArray) > 0 ? array.size(flipManager.lineArray) - 1 : na to 0
lineObject = array.get(flipManager.lineArray, i)
lineAge = array.get(flipManager.lineAge, i)
lineType = array.get(flipManager.variation, i)
lineFlips = array.get(flipManager.lineFlips, i)
linePhase = array.get(flipManager.linePhase, i)
linePrice = line.get_y1(lineObject)
line.set_x2(lineObject, bar_index + 1)
lineColor = lineType == "Support" ? supportColor : resistanceColor
gradientLineColor = color.from_gradient(lineAge, 0, ageUntilDeletion, lineColor, color.new(lineColor, 100))
newLineColor = changeColorMethod == "Fade Out Based On Age" ?
gradientLineColor : close > linePrice ? supportColor : resistanceColor
line.set_color(lineObject, newLineColor)
array.set(flipManager.lineAge, i, lineAge + 1)
if lineType == "Support"
if linePhase == 1 and close < linePrice
array.set(flipManager.lineFlips, i, lineFlips + 1)
array.set(flipManager.linePhase, i, -1)
supportBrokeDownside := true
else if linePhase == -1 and close > linePrice
array.set(flipManager.lineFlips, i, lineFlips + 1)
array.set(flipManager.linePhase, i, 1)
supportBrokeUpside := true
if lineType == "Resistance"
if linePhase == -1 and close > linePrice
array.set(flipManager.lineFlips, i, lineFlips + 1)
array.set(flipManager.linePhase, i, 1)
resistanceBrokeUpside := true
else if linePhase == 1 and close < linePrice
array.set(flipManager.lineFlips, i, lineFlips + 1)
array.set(flipManager.linePhase, i, -1)
resistanceBrokeDownside := true
lineFlips := array.get(flipManager.lineFlips, i)
if lineFlips >= flipsUntilDeletion or lineAge >= ageUntilDeletion
if definitionOfDelete == "Completely Delete Level"
line.delete(lineObject)
array.remove(flipManager.lineArray, i)
array.remove(flipManager.lineAge, i)
array.remove(flipManager.lineFlips, i)
array.remove(flipManager.variation, i)
array.remove(flipManager.linePhase, i)
else if definitionOfDelete == "Stop Updating Level"
array.remove(flipManager.lineArray, i)
array.remove(flipManager.lineAge, i)
array.remove(flipManager.lineFlips, i)
array.remove(flipManager.variation, i)
array.remove(flipManager.linePhase, i)
else if definitionOfDelete == "Stop Updating Level & Turn Level Unique Color"
line.set_color(lineObject, uniqueDeleteColor)
array.remove(flipManager.lineArray, i)
array.remove(flipManager.lineAge, i)
array.remove(flipManager.lineFlips, i)
array.remove(flipManager.variation, i)
array.remove(flipManager.linePhase, i)
// }
// {
plotshape(
series = newTestedSupport,
title = "New Support Re-Test X",
style = retestLogic ? shape.labeldown : shape.labelup,
text = "R",
textcolor = color.white,
location = retestLogic ? location.abovebar : location.belowbar,
color = retestLogic ? color.blue :color.blue,
size = size.tiny,
show_last = 20000)
plotshape(
series = newTestedResistance,
title = "New Resistance Re-Test X",
style = retestLogic ? shape.labelup : shape.labeldown,
text = "R",
textcolor = color.white,
location = retestLogic ? location.belowbar : location.abovebar,
color = retestLogic ? color.blue : color.blue,
size = size.tiny,
show_last = 20000)
// }
// {
alertcondition(
condition = newTestedSupport,
title = "New Support Re-Test")
alertcondition(
condition = newTestedResistance,
title = "New Resistance Re-Test")
alertcondition(
condition = supportBrokeDownside,
title = "Support Re-Test Downside Break")
alertcondition(
condition = supportBrokeUpside,
title = "Support Re-Test Upside Break")
alertcondition(
condition = resistanceBrokeDownside,
title = "Resistance Re-Test Downside Break")
alertcondition(
condition = resistanceBrokeUpside,
title = "Resistance Re-Test Upside Break")
alertcondition(
condition = supportBrokeDownside or resistanceBrokeDownside,
title = "Any Downside Break")
alertcondition(
condition = supportBrokeUpside or resistanceBrokeUpside,
title = "Any Upside Break")
// }
plotshape(buySignal, title="BUY Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY", textcolor=color.white, size=size.normal)
plotshape(sellSignal, title="SELL Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL", textcolor=color.white, size=size.normal)
alertcondition(buySignal, "Alerta Buy", "MACD cruzou para cima + preço próximo BB inferior.")
alertcondition(sellSignal, "Alerta Sell", "MACD cruzou para baixo + preço próximo BB superior.")
Candle Range (High-Low)the Candle Range refers to the difference between the high price (High) and the low price (Low) of a specific candle or bar.
Example:
For a given candle on the chart:
The high price is 120.
The low price is 100.
The candle range is 20 (120 - 100).
Uses:
Volatility Measurement: The candle range is often used to assess an asset's volatility over time. For example, averaging candle ranges can indicate the average volatility.
Indicator Development: Many indicators, such as Average True Range (ATR), rely on candle ranges to provide insights about market conditions.
Trade Filters: Candle ranges can act as filters in strategies to avoid trading during periods of low volatility.
Fibobull Düzeltme Türkce Vol.2//@version=5
//@fibobull
indicator("Fibobull Düzeltme Türkce Vol.2", overlay=true)
devTooltip = "Deviation is a multiplier that affects how much the price should deviate from the previous pivot in order for the bar to become a new pivot."
depthTooltip = "The minimum number of bars that will be taken into account when calculating the indicator."
// Pivots threshold
threshold_multiplier = input.float(title="Deviation", defval=10, minval=0, tooltip=devTooltip)
depth = input.int(title="Depth", defval=3, minval=2, tooltip=depthTooltip)
reverse = input(false, "Reverse", display = display.data_window)
var extendLeft = input(false, "Extend Left | Extend Right", inline = "Extend Lines")
var extendRight = input(true, "", inline = "Extend Lines")
var extending = extend.none
if extendLeft and extendRight
extending := extend.both
if extendLeft and not extendRight
extending := extend.left
if not extendLeft and extendRight
extending := extend.right
prices = input(true, "Show Prices", display = display.data_window)
levels = input(true, "Show Levels", inline = "Levels", display = display.data_window)
labelsPosition = input.string("Left", "Labels Position", options = , display = display.data_window)
var int backgroundTransparency = input.int(85, "Background Transparency", minval = 0, maxval = 100, display = display.data_window)
// Text size input
textSize = input.string(title="Text Size", defval="normal", options= , display = display.data_window)
import TradingView/ZigZag/7 as zigzag
update() =>
var settings = zigzag.Settings.new(threshold_multiplier, depth, color(na), false, false, false, false, "Absolute", true)
var zigzag.ZigZag zigZag = zigzag.newInstance(settings)
var zigzag.Pivot lastP = na
var float startPrice = na
var float endPrice = na // End price değişkenini ekliyoruz
var float height = na
settings.devThreshold := ta.atr(10) / close * 100 * threshold_multiplier
if zigZag.update()
lastP := zigZag.lastPivot()
if not na(lastP)
var line lineLast = na
if na(lineLast)
lineLast := line.new(lastP.start, lastP.end, xloc=xloc.bar_time, color=color.gray, width=1, style=line.style_dashed)
else
line.set_first_point(lineLast, lastP.start)
line.set_second_point(lineLast, lastP.end)
startPrice := reverse ? lastP.start.price : lastP.end.price
endPrice := reverse ? lastP.end.price : lastP.start.price // End price'i burada atıyoruz
height := (startPrice > endPrice ? -1 : 1) * math.abs(startPrice - endPrice)
= update()
_draw_line(price, col) =>
var id = line.new(lastP.start.time, lastP.start.price, time, price, xloc=xloc.bar_time, color=col, width=1, extend=extending)
line.set_xy1(id, lastP.start.time, price)
line.set_xy2(id, lastP.end.time, price)
id
_draw_label(price, txt, txtColor) =>
x = labelsPosition == "Left" ? lastP.start.time : not extendRight ? lastP.end.time : time
labelStyle = labelsPosition == "Left" ? label.style_label_right : label.style_label_left
align = labelsPosition == "Left" ? text.align_right : text.align_left
var id = label.new(x=x, y=price, xloc=xloc.bar_time, text=txt, textcolor=txtColor, style=labelStyle, textalign=align, color=#00000000, size=textSize)
label.set_xy(id, x, price)
label.set_text(id, txt)
label.set_textcolor(id, txtColor)
_label_txt(level, price) =>
(levels ? level : "") + (prices ? " (" + str.tostring(price, format.mintick) + ")" : "")
_crossing_level(series float sr, series float r) =>
(r > sr and r < sr ) or (r < sr and r > sr )
processLevel(bool show, float value, string label, color colorL, line lineIdOther) =>
r = startPrice + height * value
crossed = _crossing_level(close, r)
if show and not na(lastP)
lineId = _draw_line(r, colorL)
_draw_label(r, _label_txt(label, r), colorL)
if crossed
alert("Autofib: " + syminfo.ticker + " crossing level " + str.tostring(label))
if not na(lineIdOther)
linefill.new(lineId, lineIdOther, color = color.new(colorL, backgroundTransparency))
lineId
else
lineIdOther
// Define the text values and colors for each level
show_tepe = input(true, "Show Tepe", display = display.data_window)
color_tepe = input(color.new(color.gray, 50), "Tepe Color", display = display.data_window)
show_tepeye_yakin = input(true, "Show Tepeye Yakın", display = display.data_window)
color_tepeye_yakin = input(color.new(color.green, 50), "Tepeye Yakın Color", display = display.data_window)
show_hala_duzeltiyor = input(true, "Show Düzeltiyor", display = display.data_window)
color_hala_duzeltiyor = input(color.new(color.red, 50), "Düzeltiyor Color", display = display.data_window)
show_alim_yerleri = input(true, "Show Alım Yerleri", display = display.data_window)
color_alim_yerleri = input(color.new(color.blue, 50), "Alım Yerleri Color", display = display.data_window)
show_alabilirsin = input(true, "Show Alabilirsin", display = display.data_window)
color_alabilirsin = input(color.new(color.orange, 50), "Alabilirsin Color", display = display.data_window)
show_almaya_devam = input(true, "Show Almaya Devam", display = display.data_window)
color_almaya_devam = input(color.new(color.purple, 50), "Almaya Devam Color", display = display.data_window)
show_maliyet_dusur = input(true, "Show Maliyet Düşür", display = display.data_window)
color_maliyet_dusur = input(color.new(color.yellow, 50), "Maliyet Düşür Color", display = display.data_window)
show_maliyet_dusur_stop_ol = input(true, "Show Maliyet Düşür - Altında Stop OL", display = display.data_window)
color_maliyet_dusur_stop_ol = input(color.new(color.red, 50), "Maliyet Düşür - Altında Stop OL Color", display = display.data_window)
// Determine the text labels based on the direction
labelTepe = startPrice > endPrice ? "Tepe" : "Dip"
labelTepeyeYakin = startPrice > endPrice ? "Tepeye Yakın" : "Dibe Yakın"
labelHalaDuzeltiyor = startPrice > endPrice ? "Düzeltiyor" : "Düşüşü Düzeltiyor"
labelAlimYerleri = startPrice > endPrice ? "Alış Yerleri" : "Satış Yerleri"
labelAlabilirsin = startPrice > endPrice ? "Alabilirsin" : "Satabilirsin"
labelAlmayaDevam = startPrice > endPrice ? "Almaya Devam" : "Satmaya Devam"
labelMaliyetDusur = startPrice > endPrice ? "Maliyet Düşür" : "Stop Hazırlan"
labelMaliyetDusurStopOl = startPrice > endPrice ? "Maliyet Düşür-Altında Stop OL" : "Son Seviye Üstünde Stop OL"
// Process each text level
lineIdTepe = processLevel(show_tepe, 0.0, labelTepe, color_tepe, line(na))
lineIdTepeyeYakin = processLevel(show_tepeye_yakin, 0.236, labelTepeyeYakin, color_tepeye_yakin, lineIdTepe)
lineIdHalaDuzeltiyor = processLevel(show_hala_duzeltiyor, 0.382, labelHalaDuzeltiyor, color_hala_duzeltiyor, lineIdTepeyeYakin)
lineIdAlimYerleri = processLevel(show_alim_yerleri, 0.5, labelAlimYerleri, color_alim_yerleri, lineIdHalaDuzeltiyor)
lineIdAlabilirsin = processLevel(show_alabilirsin, 0.618, labelAlabilirsin, color_alabilirsin, lineIdAlimYerleri)
lineIdAlmayaDevam = processLevel(show_almaya_devam, 0.65, labelAlmayaDevam, color_almaya_devam, lineIdAlabilirsin)
lineIdMaliyetDusur = processLevel(show_maliyet_dusur, 0.786, labelMaliyetDusur, color_maliyet_dusur, lineIdAlmayaDevam)
lineIdMaliyetDusurStopOl = processLevel(show_maliyet_dusur_stop_ol, 1.0, labelMaliyetDusurStopOl, color_maliyet_dusur_stop_ol, lineIdMaliyetDusur)
Fibonacci Trend - Aynet1. Inputs
lookbackPeriod: Defines the number of bars to consider for calculating swing highs and lows. Default is 20.
fibLevel1 to fibLevel5: Fibonacci retracement levels to calculate price levels (23.6%, 38.2%, 50%, 61.8%, 78.6%).
useTime: Enables or disables time-based Fibonacci projections.
riskPercent: Defines the percentage of risk for trading purposes (currently not used in calculations).
2. Functions
isSwingHigh(index): Identifies a swing high at the given index, where the high of that candle is higher than both its previous and subsequent candles.
isSwingLow(index): Identifies a swing low at the given index, where the low of that candle is lower than both its previous and subsequent candles.
3. Variables
swingHigh and swingLow: Store the most recent swing high and swing low prices.
swingHighTime and swingLowTime: Store the timestamps of the swing high and swing low.
fib1 to fib5: Fibonacci levels based on the difference between swingHigh and swingLow.
4. Swing Point Detection
The script checks if the last bar is a swing high or swing low using the isSwingHigh() and isSwingLow() functions.
If a swing high is detected:
The high price is stored in swingHigh.
The timestamp of the swing high is stored in swingHighTime.
If a swing low is detected:
The low price is stored in swingLow.
The timestamp of the swing low is stored in swingLowTime.
5. Fibonacci Levels Calculation
If both swingHigh and swingLow are defined, the script calculates the Fibonacci retracement levels (fib1 to fib5) based on the price difference (priceDiff = swingHigh - swingLow).
6. Plotting Fibonacci Levels
Fibonacci levels (fib1 to fib5) are plotted as horizontal lines using the line.new() function.
Labels (e.g., "23.6%") are added near the lines to indicate the level.
Lines and labels are color-coded:
23.6% → Blue
38.2% → Green
50.0% → Yellow
61.8% → Orange
78.6% → Red
7. Filling Between Fibonacci Levels
The plot() function creates lines for each Fibonacci level.
The fill() function is used to fill the space between two levels with semi-transparent colors:
Blue → Between fib1 and fib2
Green → Between fib2 and fib3
Yellow → Between fib3 and fib4
Orange → Between fib4 and fib5
8. Time-Based Fibonacci Projections
If useTime is enabled:
The time difference (timeDiff) between the swing high and swing low is calculated.
Fibonacci time projections are added based on multiples of 23.6%.
If the current time reaches a projected time, a label (e.g., "T1", "T2") is displayed near the high price.
9. Trading Logic
Two placeholder variables are defined for trading logic:
longCondition: Tracks whether a condition for a long trade is met (currently not implemented).
shortCondition: Tracks whether a condition for a short trade is met (currently not implemented).
These variables can be extended to define entry/exit signals based on Fibonacci levels.
How It Works
Detect Swing Points: It identifies recent swing high and swing low points on the chart.
Calculate Fibonacci Levels: Based on the swing points, it computes retracement levels.
Visualize Levels: Plots the levels on the chart with labels and fills between them.
Time Projections: Optionally calculates time-based projections for future price movements.
Trading Opportunities: The framework provides tools for detecting potential reversal or breakout zones using Fibonacci levels.
P/L CalculatorDescription of the P/L Calculator Indicator
The P/L Calculator is a dynamic TradingView indicator designed to provide traders with real-time insights into profit and loss metrics for their trades. It visualizes key levels such as entry price, profit target, and stop-loss, while also calculating percentage differences and net profit or loss, factoring in fees.
Features:
Customizable Input Parameters:
Entry Price: Define the starting price of the trade.
Profit and Stop-Loss Levels (%): Set percentage thresholds for targets and risk levels.
USDT Amount: Specify the trade size for precise calculations.
Trade Type: Choose between "Long" or "Short" positions.
Visual Representation:
Entry Price, Profit Target, and Stop-Loss levels are plotted as horizontal lines on the chart.
Line styles, colors, and thicknesses are fully customizable for better visibility.
Real-Time Metrics:
Percentage difference between the live price and the entry price is calculated dynamically.
Profit/Loss (P/L) and fees are computed in real time to display net profit or loss.
Alerts:
Alerts are triggered when:
The live price hits the profit target.
The live price crosses the stop-loss level.
The price reaches the specified entry level.
A user-defined percentage difference is reached.
Labels and Annotations:
Displays percentage difference, P/L, and fee information in a clear label near the live price.
Custom Fee Integration:
Allows input of trading fees (%), enabling accurate net profit or loss calculations.
Price Scale Visualization:
Displays the percentage difference on the price scale for enhanced context.
Use Case:
The P/L Calculator is ideal for traders who want to monitor their trades' performance and make informed decisions without manually calculating metrics. Its visual cues and alerts ensure you stay updated on critical levels and price movements.
This indicator supports a wide range of trading styles, including swing trading, scalping, and position trading, making it a versatile tool for anyone in the market.
KB Dinamik Grid Bot V8 TrailingThis Pine Script code aims to create a "Dynamic Grid Trading Bot" and perform automatic trading between price ranges. Let's break it down into sections to better understand its functions:
1. Settings and User Inputs
The user can specify the following parameters for the bot:
Lower and Upper Price Limit: Determines the price range where the grid levels are defined.
Number of Grid Lines: Defines how many levels the grid will consist of.
Transaction Amount: Specifies the trading volume for each trading transaction.
Start Date: The date when the bot will start trading.
Price Step (priceStep): Specifies specific steps after the comma to adjust the grid levels more precisely.
Trailing: A feature that activates dynamic selling by following price movements.
2. Calculating Grid Levels
Grid levels: Divides the specified price range into user-defined levels and rounds each level with priceStep.
Lines and labels: Lines and labels are created to visually represent grid levels.
3. Buying and Selling Logic
Buying Transaction: When the price approaches a lower grid level (as much as the offset) and the position is empty, a purchase is made.
Trailing Selling: If Trailing is active, a sale is made when the price passes the specified "trailing step" level.
Normal Selling: If Trailing is not active, a sale is made when the price approaches an upper grid level.
4. Profit and Statistics Tracking
The bot tracks the profit-loss status per transaction and in total.
The number of purchases and sales and net profit information are calculated from the start date.
5. Table Display
The bot places statistical data in a table:
Number of purchases and sales.
Starting date.
Total number of transactions.
Net profit.
Amount of open positions.
6. Drawing and Tracking
Each price movement is updated and the color of the grid lines (green or red) is changed depending on the price's status relative to the level.
This code is a strategy that aims to make a profit by continuously buying and selling in the event of price fluctuations within a range. The "Trailing" feature allows you to keep your profits when the price moves upwards. Net profit, open positions and other statistics are displayed in the table.
TDGS Dynamic Grid Trading Strategy [CoinFxPro]Advanced Dynamic Grid Trading Strategy
Logic and Working Principle:
This strategy uses a dynamic grid system to support both long and short trades. Grid trading aims to capitalize on price fluctuations within a predefined range by executing buy and sell orders systematically. The system calculates grid levels based on a base price and dynamically trades within these levels.
Grid Levels:
Grid levels are calculated based on the initial price and the user-defined grid spacing percentage.
Long Mode: Buys when the price decreases and sells when the price increases.
Short Mode: Sells when the price increases and buys when the price decreases.
Grid Updates:
Grid levels are recalculated based on the market price when the price moves by a user-defined update percentage.
For example;
In Long mode, when the price shows an upward trend, that is, when it rises by the Grid Update Percentage specified by the user, Grid levels are recreated and trades are made according to the new grid levels. While the price and grid levels are updated according to the new price, the Stop level is also updated upwards and the stop is followed with the TrailingStop logic.
In short mode, the same system operates with reverse logic. In other words, as prices decrease downwards, the grids are updated downwards when the Grid update percentage determined by the user decreases. The stop level is also updated accordingly.
The difference of the strategy from other Gridbots is that the grid levels are automatically updated and the levels are recreated with the price percentage difference determined by the user. Old levels can be tracked on the chart.
As the price updates, the self-updating grid levels are updated upwards in long mode and downwards in short mode.
The number of buying lots and selling lots are separated, allowing both trading within the position and the opportunity to collect lots and increase the position.
When trading with the grid trading logic, when buying and selling between grids, there is no repeated purchase at the same level unless there is a sale at the upper grid level. In this way, each level will be traded within itself.
For example, in a long condition, when the price is going up, after deducting the selling lot from the buying lot at each level, the remaining lots will be collected while the price is going up and an opportunity will be provided from the price rise.
Different preferences have been added to the profit taking conditions, allowing the robot to continue or stop after profit taking, if desired.
The system, which acts entirely according to user parameters, constantly updates itself as long as it moves in the direction determined by itself, and in these conditions, transactions are carried out according to profit or stop conditions.
Parameters:
Grid Parameters:
Settings such as buy lot size, sell lot size, grid count, and grid spacing percentage allow flexibility and customization.
Risk Management:
Stop loss (%) and take profit (%) levels help limit potential losses and secure profits at predefined thresholds.
Objective:
The goal of this strategy is to systematically capitalize on market price fluctuations through automated grid trading. This method is particularly effective in volatile markets where the price oscillates within a specific range.
The strategy works with a complete algorithm logic, and in appropriate instruments (especially instruments with depth and transaction volume should be preferred), buying and selling transactions are made according to the parameters determined at the beginning, and if the conditions go beyond the conditions, the stop is made, and when the profit taking conditions are met, it takes profit and prices according to the determined value. When it is updated, the values are updated again and the parameter works algorithmically.
Risk Management Recommendations:
Initial Capital: Grid trading involves frequent transactions, so sufficient initial capital is essential.
Stop Loss: Always set stop loss levels to prevent significant losses.
Grid Count and Spacing: A higher number of grids provides more trading opportunities but using grids that are too close may increase transaction costs due to small price movements.
First of all, it is important for risk management that you choose instruments that have depth and high transaction volume.
Strategy results may differ as a result of the parameters entered. Therefore, before trading in your real account, it is recommended that you start real transactions after backtesting with different parameters.
If you are stuck on something, you can mention it in the comments.
Bollinger Bands color candlesThis Pine Script indicator applies Bollinger Bands to the price chart and visually highlights candles based on their proximity to the upper and lower bands. The script plots colored candles as follows:
Bullish Close Above Upper Band: Candles are colored green when the closing price is above the upper Bollinger Band, indicating strong bullish momentum.
Bearish Close Below Lower Band: Candles are colored red when the closing price is below the lower Bollinger Band, signaling strong bearish momentum.
Neutral Candles: Candles that close within the bands remain their default color.
This visual aid helps traders quickly identify potential breakout or breakdown points based on Bollinger Band dynamics.
MEERU-72-FX-ALGO"Unlock Your Trading Potential with MEERU-72-FX-ALGO! 🚀💹
Are you ready to take your trading to the next level? Introducing *MEERU-72-FX-ALGO* — a powerful, automated trading algorithm designed for success. Whether you're a beginner or an experienced trader, MEERU-72-FX-ALGO is built to optimize your trades, increase accuracy, and maximize profits. Say goodbye to emotional trading and hello to consistent, data-driven results.
Get started today and let MEERU-72-FX-ALGO work for you! DM for more details or click the link below to join our exclusive community.
chat.whatsapp.com
#Trading #Forex #AlgorithmicTrading #MEERU72FXALGO #FinancialFreedom #Automation"