EMA36ssasdasdsaasddsasaddasdassaddsadasasddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
Breadth Indicators
RAJ larg Daily, Weekly & Monthly OHLC Lines - Extra Longhjdgasdgkajfkudhf.sdndsc.jdwnfiljewinD.CN/lwiv/wklf /mwmecW
BTC Multi-Timeframe Perfect SignalsCe script, intitulé "BTC Multi-Timeframe Perfect Signals", est conçu pour détecter des signaux de trading robustes et fiables pour le Bitcoin en utilisant des critères provenant de plusieurs périodes de temps. Voici une description détaillée de ses fonctionnalités et de sa logique :
Objectif Principal
Le script identifie des signaux parfaits longs et courts en combinant des indicateurs techniques (RSI, MACD, EMA, volume) sur trois horizons temporels :
Hebdomadaire (Weekly) – pour analyser la tendance à long terme.
Journalier (Daily) – pour confirmer la dynamique intermédiaire.
Intra-journalier (4H) – pour des points d’entrée précis.
Les Composantes du Script
1. Paramètres Configurables
RSI Period : Période pour calculer l'indicateur RSI.
MACD Fast, Slow, Signal : Périodes utilisées pour les lignes MACD et Signal.
Ces paramètres permettent de personnaliser les signaux en fonction des préférences de l’utilisateur ou des caractéristiques du marché.
2. Indicateurs Multi-Timeframes (MTF)
Le script extrait les données suivantes depuis des périodes spécifiques grâce à request.security :
RSI Hebdomadaire et Journalier : Force relative du prix sur des périodes différentes.
EMA Hebdomadaire (20 et 50) : Moyennes mobiles exponentielles pour la tendance à long terme.
Prix de clôture journalier : Positionnement quotidien par rapport à l'EMA 20.
Volume Hebdomadaire : Pour évaluer l'intérêt du marché sur une longue période.
Pour la période actuelle (4H), il utilise :
MACD (4H) : Détection des croisements MACD/Signal.
RSI (4H) : Confirmation des conditions de surachat ou de survente.
ATR (Average True Range) : Mesure de la volatilité actuelle.
3. Signaux Parfaits
Les signaux se déclenchent si toutes les conditions suivantes sont remplies :
Signal Long :
Hebdomadaire :
RSI < 35 (Survente).
EMA 20 > EMA 50 (Tendance haussière).
Volume > Moyenne mobile du volume (20).
Journalier :
RSI < 40 (Confirmation de la survente intermédiaire).
Clôture > EMA 20 (Prix au-dessus de la moyenne mobile journalière).
4H :
Croisement MACD/Signal vers le haut.
RSI < 35.
Bonne volatilité (ATR supérieur à 80% de sa moyenne).
Signal Court :
Critères inverses : RSI > 65, EMA 20 < EMA 50, etc.
4. Alertes Détaillées
Lorsque les signaux parfaits sont détectés, le script génère une alerte avec :
Les conditions des trois périodes (RSI, tendance, etc.).
Les niveaux de Stop Loss (SL) et de Take Profit (TP1, TP2, TP3).
Une indication de la force maximale du signal et un "Win Rate" théorique.
5. Affichage Visuel
Les signaux longs sont représentés par des triangles verts sous les bougies.
Les signaux courts par des triangles rouges au-dessus des bougies.
Les couleurs de fond (optionnelles) peuvent indiquer un contexte haussier ou baissier.
Forces du Script
Robustesse : Combine plusieurs indicateurs et horizons pour réduire les faux signaux.
Personnalisation : Les paramètres ajustables permettent d’affiner les résultats.
Alertes Pratiques : Donne des détails complets pour agir rapidement.
Fiabilité : En intégrant volume, volatilité et tendance, il maximise la probabilité de réussite des signaux.
Limites et Améliorations Possibles
Complexité des Conditions : Les critères restrictifs peuvent limiter le nombre de signaux.
Manque de Backtesting : Pas de suivi de capital ou d’évaluation des performances historiques.
Dépendance à un seul actif : Conçu spécifiquement pour BTC.
Ce script est particulièrement utile pour des traders recherchant des points d'entrée/sortie précis et basés sur une analyse multi-timeframe complète. Si tu veux des ajustements ou un ajout de backtesting, fais-le-moi savoir !
Fair Value Gap DetectorHow this indicator works:
It detects two types of FVGs:
Bullish FVG: Occurs when the low of the current candle is higher than the high of the candle from 2 bars ago (creates an upward gap)
Bearish FVG: Occurs when the high of the current candle is lower than the low of the candle from 2 bars ago (creates a downward gap)
Features:
Allows users to toggle both bullish and bearish FVG detection independently
Customizable colors for both bullish (default green) and bearish (default red) FVGs
Visualizes FVGs using:
Boxes that highlight the gap area (with 80% transparency)
Labels that mark each FVG ("Bull FVG" or "Bear FVG")
Visual representation:
Bullish FVGs are marked with green boxes and downward-pointing labels
Bearish FVGs are marked with red boxes and upward-pointing labels
This indicator can be useful for :
Identifying potential areas where price might return to
Finding potential support and resistance zones
Understanding market structure and momentum shifts
Supply and Demand ZonesDeskripsi Skrip:
Skrip ini berfungsi untuk mengidentifikasi dan menggambar zona supply (penawaran) dan demand (permintaan) pada grafik harga berdasarkan analisis harga tinggi dan rendah dalam periode tertentu.
Fitur Utama:
Identifikasi Zona Supply dan Demand:
Skrip ini mencari level supply di mana harga mengalami puncak tertinggi dalam periode lookback (jumlah periode yang dipilih pengguna).
Demand adalah titik terendah dalam periode lookback, di mana harga memiliki penurunan yang signifikan.
Input Pengguna:
Lookback Period: Jumlah periode (bar) yang digunakan untuk mencari harga tertinggi dan terendah, yang menentukan potensi zona supply atau demand.
Price Move Threshold: Persentase yang menentukan seberapa besar level harga harus bergerak (dalam hal demand atau supply) untuk membentuk zona tersebut.
Zone Width: Lebar zona yang digunakan untuk menggambar area supply/demand dalam jumlah periode setelah menemukan level supply/demand yang sesuai.
Penggambaran Zona Supply dan Demand:
Setelah menemukan level harga supply (harga tertinggi) atau demand (harga terendah), skrip ini menggambar sebuah box pada chart yang memperlihatkan rentang antara harga atas (top) dan bawah (bottom) zona tersebut.
Warna border box akan berwarna merah untuk zona supply dan hijau untuk zona demand, sementara area dalam kotak diwarnai dengan transparansi agar dapat dengan mudah terlihat di atas chart.
Penghapusan Kotak Lama:
Setiap kali ditemukan zona supply atau demand baru, kotak sebelumnya akan dihapus untuk menghindari tumpang tindih kotak, yang memastikan hanya ada satu kotak aktif di setiap waktu.
Proses yang Terjadi dalam Skrip:
Perhitungan Zona:
Fungsi f_find_supply_demand() digunakan untuk memeriksa apakah harga tertinggi atau terendah dalam periode lookback memenuhi kriteria untuk dianggap sebagai zona supply atau demand.
Pembuatan Box Supply dan Demand:
Setelah zona yang valid ditemukan (supply atau demand), fungsi utama membuat kotak menggunakan fungsi box.new(), yang menggambar zona pada chart dengan batas-batas yang disesuaikan.
Pembuangan Box Lama:
Jika ada zona supply atau demand sebelumnya, kotak tersebut dihapus dengan box.delete() untuk memastikan bahwa hanya ada satu kotak yang digambar di chart pada suatu waktu.
Parameter yang Dapat Disesuaikan Pengguna:
Lookback Period (Periode untuk Mencari Harga Tertinggi dan Terendah): Menentukan berapa lama periode pencarian untuk level tertinggi dan terendah harga dalam grafik.
Price Move Threshold (%): Persentase pergerakan harga yang digunakan untuk menggambar kotak supply dan demand.
Zone Width (Lebar Zona): Menentukan seberapa panjang kotak itu akan digambar di grafik berdasarkan perhitungan titik bar_index (indeks batang/kursi pada grafik).
Output:
Zona Supply (Zona Penawaran) digambar dengan kotak merah, menggambarkan area harga tinggi di mana mungkin ada penjual besar yang memasuki pasar.
Zona Demand (Zona Permintaan) digambar dengan kotak hijau, menggambarkan area harga rendah di mana mungkin ada pembeli besar yang memasuki pasar.
Dengan skrip ini, Anda bisa memvisualisasikan dengan mudah area supply dan demand di grafik dan mendapatkan wawasan yang lebih baik mengenai potensi pembalikan harga atau titik pembelian dan penjualan berdasarkan analisis teknikal.
Advanced Buy/Sell Signals with Sessions 2025 KravchenkoНаданий вами скрипт — це торгова стратегія, реалізована в Pine Script, яка використовується для створення сигналів купівлі та продажу на основі комбінації різних технічних індикаторів. Ось розбивка компонентів: ### Ключові компоненти: 1. **RSI (індекс відносної сили)**: використовується для визначення умов перекупленості або перепроданості на ринку. - **Умова**: стратегія шукає RSI нижче 30 (перепроданість) для сигналів купівлі та RSI вище 70 (перекупленість) для сигналів продажу. 2.
SMA & RSI Al Sinyalleri kendi özel ayarlarımdır her grafikte çalışmaz genelde 4s 2s gibi grafiklerde çalışır
MERCURY-PRO by DrAbhiramSivprasd“MERCURYPRO”
The MERCURYPRO indicator is a custom technical analysis tool designed to provide dynamic trend signals based on a combination of the Chande Momentum Oscillator (CMO) and Standard Deviation (StDev). This indicator helps traders identify trend reversals or continuation based on the behavior of the price and momentum.
Key Features:
• Source Input: The indicator works with any price data, with the default set to close, which represents the closing price of each bar.
• Length Input: A period (default value 9) is used to determine the calculation window for the Chande Momentum Oscillator and Standard Deviation.
• Fixed CMO Length Option: Users can choose whether to use a fixed CMO length of 9 or adjust the length to the user-defined pds value.
• Calculation Method: The indicator allows switching between using the Chande Momentum Oscillator (CMO) or Standard Deviation (StDev) for the momentum calculation.
• Alpha: The smoothing factor used in the calculation of the MERCURYPRO value, which is based on the length of the period input (pds).
Core Calculation:
1. Momentum Calculation: The script calculates the momentum by determining the change in the source price (e.g., close) from one period to the next.
2. Chande Momentum Oscillator (CMO): The positive and negative momentum components are calculated and then summed over the specified period. This value is normalized to a percentage to determine the momentum strength.
3. K Value Calculation: The script selects either the CMO or Standard Deviation (depending on the user setting) to calculate the k value, which represents the dynamic price momentum.
4. MERCURYPRO Line: The final output of the indicator, MERCURYPRO, is computed using a weighted average of the k value and the previous MERCURYPRO value. The line is smoothed using the Alpha parameter.
Plot and Signal Generation:
• Color Coding: The line is color-coded based on the direction of MERCURYPRO:
• Blue: The trend is bullish (MERCURYPRO is rising).
• Maroon: The trend is bearish (MERCURYPRO is falling).
• Default Blue: Neutral or sideways market conditions.
• Plotting: The MERCURYPRO line is plotted with varying colors depending on the trend direction.
Alerts:
• Color Change Alert: The indicator has an alert condition based on when the MERCURYPRO line crosses its previous value. This helps traders stay informed about potential trend reversals or continuation signals.
Use Case:
• Trend Confirmation: Traders can use the MERCURYPRO indicator to identify whether the market is in a strong trend or not.
• Signal for Entries/Exits: The color change and crossovers of the MERCURYPRO line can be used as entry or exit signals, depending on the trader’s strategy.
Overall Purpose:
The MERCURYPRO indicator combines momentum analysis with smoothing techniques to offer a dynamic, responsive tool for identifying market trends and potential reversals. It is particularly useful in conjunction with other technical indicators to provide confirmation for trade setups.
How to Use the MERCURYPRO Indicator:
The MERCURYPRO indicator is designed to help traders identify trend reversals and market conditions. Here are a few ways you can use it:
1. Trend Confirmation (Bullish or Bearish)
• Bullish Trend: When the MERCURYPRO line is colored Blue, it indicates a rising trend, suggesting that the market is bullish.
• Action: You can consider entering long positions when the line turns blue, or holding your existing positions if you’re already long.
• Bearish Trend: When the MERCURYPRO line is colored Maroon, it signals a downward trend, indicating a bearish market.
• Action: You may consider entering short positions or closing any long positions when the line turns maroon.
2. Trend Reversal Alerts
• Color Change: The MERCURYPRO indicator changes color when there’s a trend reversal. The alert condition triggers when the MERCURYPRO crosses above or below its previous value, signaling a potential shift in the trend.
• Action: You can use this alert as a signal to monitor potential entry or exit points for trades. For example, a crossover from maroon to blue could indicate a potential buying opportunity, while a crossover from blue to maroon could suggest a selling opportunity.
3. Use with Other Indicators for Confirmation
• While the MERCURYPRO provides valuable trend insights, it’s often more effective when used in combination with other indicators like RSI (Relative Strength Index), MACD, or moving averages to confirm signals.
• Example: If MERCURYPRO turns blue and RSI is above 50, it may signal a strong bullish trend, enhancing the confidence to enter a long trade.
4. Divergence
• Watch for divergence between the MERCURYPRO line and the price chart:
• Bullish Divergence: If the price makes new lows while MERCURYPRO is showing higher lows, it suggests a potential bullish reversal.
• Bearish Divergence: If the price makes new highs while MERCURYPRO is showing lower highs, it suggests a potential bearish reversal.
Example of Use:
• Example 1: If the MERCURYPRO line changes from maroon to blue, you might enter a long position. After the MERCURYPRO line turns blue, use an alert to monitor the price action. If other indicators (like RSI) also suggest strength, your confidence in the trade will increase.
• Example 2: If the MERCURYPRO line shifts from blue to maroon, it could be a signal to close long positions and consider shorting the market if other conditions align (e.g., moving averages also turn bearish).
Warning for Using the MERCURYPRO Indicator:
1. Lagging Indicator:
• The MERCURYPRO is a lagging indicator, meaning it responds to price changes after they have occurred. This may delay entry and exit signals, and it’s crucial to combine it with other leading indicators to get timely information.
2. False Signals in Range-bound Markets:
• In choppy or sideways markets, the MERCURYPRO line can produce false signals, flipping between blue and maroon frequently without showing a clear trend. It’s important to avoid trading based on these false signals when the market is not trending.
3. Overreliance on One Indicator:
• Relying solely on MERCURYPRO can be risky. Always confirm signals with additional tools like volume analysis, price action, or other indicators to increase the accuracy of your trades.
4. Market Conditions Matter:
• The indicator may work well in trending markets, but in highly volatile or news-driven environments, it may provide misleading signals. Ensure that you take market fundamentals and external news events into consideration before acting on the indicator’s signals.
5. Risk Management:
• As with any technical indicator, MERCURYPRO is not infallible. Always use appropriate risk management techniques such as stop-loss orders to protect your capital. Never risk more than you can afford to lose on a trade.
6. Backtest First:
• Before implementing MERCURYPRO in live trading, make sure to backtest it on historical data. Test the strategy with various market conditions to assess its effectiveness and identify any potential weaknesses.
By considering these guidelines and warnings, you can use the MERCURYPRO indicator more effectively and mitigate potential risks in your trading strategy.
ROC with AveragesMain Idea
This script provides traders with a comprehensive view of market momentum by calculating the Rate of Change (ROC) and categorizing its impact into averages of positive, negative, and total values.
Key Features
Rate of Change (ROC) Calculation: Measures the percentage change in closing prices over a user-defined period.
Categorical Averages:
Positive Average: Average ROC for upward movements.
Negative Average: Average ROC for downward movements.
Total Average: Aggregate average across all movements.
Dynamic Visualization: Plots ROC alongside its categorized averages for better trend analysis.
Benefits
Simplifies the evaluation of market trends by breaking down data into actionable insights.
Helps traders identify the strength of upward or downward movements.
Offers a clear visual representation for quick decision-making.
This structure highlights the purpose and value of the script while aligning with the Minto Pyramid Principle. Let me know if you'd like further refinements!
الفكرة الرئيسية
يوفر هذا السكربت للمتداولين رؤية شاملة لزخم السوق من خلال حساب معدل التغير (ROC) وتصنيفه إلى متوسطات القيم الإيجابية والسلبية والإجمالية.
المميزات الرئيسية
حساب معدل التغير (ROC): يقيس النسبة المئوية للتغير في أسعار الإغلاق خلال فترة محددة يختارها المستخدم.
المتوسطات التصنيفية:
المتوسط الإيجابي: متوسط معدل التغير للحركات الصعودية.
المتوسط السلبي: متوسط معدل التغير للحركات الهبوطية.
المتوسط الإجمالي: متوسط إجمالي يشمل جميع الحركات.
تصور ديناميكي: يعرض معدل التغير إلى جانب المتوسطات المصنفة لتسهيل تحليل الاتجاهات.
الفوائد
يبسط تقييم اتجاهات السوق من خلال تقسيم البيانات إلى رؤى قابلة للتنفيذ.
يساعد المتداولين على تحديد قوة الحركات الصعودية أو الهبوطية.
يقدم تمثيلاً بصرياً واضحاً لاتخاذ قرارات سريعة ودقيقة.
Agrupación de velas 5m en una vela 15mcon este indicador podras saber en el grafico de 5 minutos, cuales velas pertenecen al grupo de una vela de 15 minutos
Cripto Indicator SwingTradeInclui em um único indicador vários métodos visando ajudar aqueles que usam a conta free do tradingview e somente podem ter dois indicadores simultaneamente nos graficos.
EMA
AMA
Pivot
Super Trend
Nuvem de Ishimoku
EMA RSI Strategy harih1 zone based 5min entry 10 ema cross 20 ema for h1 timeframe bullish bios anr 5min rsi signal entry
6 Moving Average SimpleYou can display 6 SMAs. It’s simple, so feel free to adjust it as you like. Your support would be a great motivator for creating new indicators.
6本のSMAを表示できます。
シンプルですので、ご自由に調整してください。
応援頂けると新たなインジケーター作成の糧になります。
ST+SQZMOM v.3// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// © syahdan modifying LazyBear script and many sources
//======================================================================================================================
//@version=6
indicator('ST+SQZMOM v.3', overlay = true, max_lines_count = 40)
import TradingView/ta/9
//======================================================================================================================
//groups
Alerts = 'alert'
Supertrend = 'supertrend'
SqzMom = 'sqzMom'
Sma = 'ma'
TS = 'tp/sl'
// Input switches for alerts
alertTrendChange = input.bool(true, title='Enable Trend Change Alert', group = Alerts)
alertSQZMOM = input.bool(true, title='Enable SQZMOM Alerts', group = Alerts)
// Supertrend Inputs
atrPeriod = input.int(10, 'ATR Length', minval = 1, group = Supertrend)
factor = input.float(2.5, 'Factor', minval = 0.01, step = 0.01, group = Supertrend)
// Squeeze Momentum Indicator Inputs
sources = input(close, 'Source', group = SqzMom)
bbLength = input.int(20, 'Bollinger Bands Length', minval = 1, group = SqzMom)
bbMult = input.float(2, 'Bollinger Bands MultFactor', step = 0.25, group = SqzMom)
kcLength = input(20, 'Keltner\'s Channel Length', group = SqzMom)
kcMult = input.float(1.5, 'Keltner\'s Channel MultFactor', step = 0.25, group = SqzMom)
useTrueRange = input(true, 'Use TrueRange (Keltner\'s Channel)', group = SqzMom)
addSignal = input.bool(false, title = 'add Signal to Calculate direction', group = SqzMom)
signalLength = input(5, 'Signal Length', group = SqzMom)
tooltip_sqz = 'show momentum direction, BB band and KC band'
showBB = input.bool(false, 'show BBand', tooltip = tooltip_sqz, group = SqzMom)
showKC = input.bool(false, 'show keltner channel', tooltip = tooltip_sqz, group = SqzMom)
showDir= input.bool(false, 'show squeeze direction', tooltip = tooltip_sqz, group = SqzMom)
// Customizable thresholds
lowerThreshold = input(-1.0, title = 'Lower Threshold', group = SqzMom)
upperThreshold = input(1.0, title = 'Upper Threshold', group = SqzMom)
// SMA Input settings
lengthMA = input(200, title="MA Period", group = Sma)
showMA = input.bool(true, title="Show MA", group = Sma)
addsave = input.bool(true, title = 'add MA as filter', group = Alerts)
// Hardcoded tp + sl multipliers
targetMultiplier1 = input.int(1, 'TP1 multiply', minval = 1, group = TS)
targetMultiplier2 = input.int(2, 'TP2 multiply', minval = 2, group = TS)
targetMultiplier3 = input.int(3, 'TP3 multiply', minval = 3, group = TS)
stopLossMultiplier = input.int(3, 'SL multiply', minval = 3, group = TS)
//======================================================================================================================
// Calculate Supertrend
= ta.supertrend(factor, atrPeriod)
// Plot the Supertrend line
plot(supertrend, color = direction < 0 ? color.green : color.red, title = 'ST', style = plot.style_stepline_diamond)
// Determine if the trend is up or down
upTrend = direction < 0
downTrend = direction > 0
// Track previous trend state
var int previousDirection = na
previousDirection := upTrend ? 1 : -1
// Calculate ATR for targets and stop loss
atrValue = ta.atr(atrPeriod)
// Initialize target and stop loss levels
var float entryPrice = na
var float targetLevel1 = na
var float targetLevel2 = na
var float targetLevel3 = na
var float stopLossLevel = na
// Initialize counters for lines and labels
var int count_up = 0
var int count_down = 0
// Initialize a new variable to track if new lines and labels are drawn
var bool newLinesDrawn = false
// Calculate BB
basis = ta.sma(sources, bbLength)
dev = bbMult * ta.stdev(sources, bbLength)
bbUpper = basis + dev
bbLower = basis - dev
// Calculate KC
ma = ta.sma(sources, kcLength)
trRange = useTrueRange ? ta.tr : high - low
rangema = ta.sma(trRange, kcLength)
kcUpper = ma + rangema * kcMult
kcLower = ma - rangema * kcMult
sqzOn = bbLower > kcLower and bbUpper < kcUpper
sqzOff = bbLower < kcLower and bbUpper > kcUpper
noSqz = sqzOn == false and sqzOff == false
val = ta.linreg(sources - math.avg(math.avg(ta.highest(high, kcLength), ta.lowest(low, kcLength)), ta.sma(sources, kcLength)), kcLength, 0)
signal = ta.sma(val, signalLength)
dir = not addSignal ? val : val - signal
// Calculate SMA
MA = ta.sma(sources,lengthMA)
saveEntryBuy = addsave ? MA < close : false
saveEntrySell = addsave ? MA > close : false
//======================================================================================================================
// Plot SMA
plot(showMA ? MA : na, color=color.white, linewidth=2, title='MA')
triangUp = sqzOff and dir > dir and dir >= upperThreshold
triangDown = sqzOff and dir < dir and dir <= lowerThreshold
triangUpR = sqzOff and dir < dir and dir >= upperThreshold
triangDownR = sqzOff and dir > dir and dir <= lowerThreshold
insideThreshold = sqzOff and upperThreshold > dir and dir > lowerThreshold
// Calculate target and stop loss levels
if upTrend and triangUp
entryPrice := close
targetLevel1 := close + atrValue * targetMultiplier1
targetLevel2 := close + atrValue * targetMultiplier2
targetLevel3 := close + atrValue * targetMultiplier3
stopLossLevel := close - atrValue * stopLossMultiplier
count_up := count_up + 1
count_down := 0
else if downTrend and triangDown
entryPrice := close
targetLevel1 := close - atrValue * targetMultiplier1
targetLevel2 := close - atrValue * targetMultiplier2
targetLevel3 := close - atrValue * targetMultiplier3
stopLossLevel := close + atrValue * stopLossMultiplier
count_down := count_down + 1
count_up := 0
// Plotting Squeeze Momentum Indicator
plotshape(sqzOn or noSqz, 'In Squeeze', shape.square, location.top, color=sqzOn or noSqz ? color.new(color.orange, 0) : color.new(color.white, 0))
plotshape(triangUp or triangUpR, 'Squeeze Release UpTrend', shape.triangleup, location.top, color=triangUp ? color.new(color.green, 0) : color.new(color.yellow, 0))
plotshape(triangDown or triangDownR, 'Squeeze Release DownTrend', shape.triangledown, location.top, color=triangDown ? color.new(color.red, 0) : color.new(color.yellow, 0))
plotshape(insideThreshold, 'inside threshold', shape.diamond, location.top, color.new(color.white, 0) )
// Draw lines and labels for targets and stop loss
var line stopLossLine = na
var line entryLine = na
var line targetLine1 = na
var line targetLine2 = na
var line targetLine3 = na
var label stopLossLabel = na
var label entryLabel = na
var label targetLabel1 = na
var label targetLabel2 = na
var label targetLabel3 = na
// Clear previous lines and labels if a new trend is confirmed
if upTrend and triangUp and count_up == 1
// Clear previous lines and labels
line.delete(stopLossLine)
line.delete(entryLine)
line.delete(targetLine1)
line.delete(targetLine2)
line.delete(targetLine3)
label.delete(stopLossLabel)
label.delete(entryLabel)
label.delete(targetLabel1)
label.delete(targetLabel2)
label.delete(targetLabel3)
// Draw new lines + 10 bars into the future
stopLossLine := line.new(bar_index, stopLossLevel, last_bar_index + 10, stopLossLevel, color = color.red, width = 2)
entryLine := line.new(bar_index, close, last_bar_index + 10, close, color = color.green, width = 2)
targetLine1 := line.new(bar_index, targetLevel1, last_bar_index + 10, targetLevel1, color = color.blue, width = 2)
if saveEntryBuy
targetLine2 := line.new(bar_index, targetLevel2, last_bar_index + 10, targetLevel2, color = color.blue, width = 2)
targetLine3 := line.new(bar_index, targetLevel3, last_bar_index + 10, targetLevel3, color = color.blue, width = 2)
// Set the newLinesDrawn flag to true
newLinesDrawn := true
// Draw new labels with three decimal places
stopLossLabel := label.new(last_bar_index + 10, stopLossLevel, 'SL: ' + str.tostring(stopLossLevel, '#.###'), style = label.style_label_left, color = color.red, textcolor = color.white)
entryLabel := label.new(last_bar_index + 10, close, 'Entry: ' + str.tostring(close, '#.###'), style = label.style_label_left, color = color.green, textcolor = color.white)
targetLabel1 := label.new(last_bar_index + 10, targetLevel1, 'TP 1: ' + str.tostring(targetLevel1, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
if saveEntryBuy
targetLabel2 := label.new(last_bar_index + 10, targetLevel2, 'TP 2: ' + str.tostring(targetLevel2, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
targetLabel3 := label.new(last_bar_index +10, targetLevel3, 'TP 3: ' + str.tostring(targetLevel3, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
if downTrend and triangDown and count_down == 1
// Clear previous lines and labels
line.delete(stopLossLine)
line.delete(entryLine)
line.delete(targetLine1)
line.delete(targetLine2)
line.delete(targetLine3)
label.delete(stopLossLabel)
label.delete(entryLabel)
label.delete(targetLabel1)
label.delete(targetLabel2)
label.delete(targetLabel3)
// Draw new lines + 10 bars into the future
stopLossLine := line.new(bar_index, stopLossLevel, last_bar_index + 10, stopLossLevel, color = color.red, width = 2)
entryLine := line.new(bar_index, close, last_bar_index + 10, close, color = color.green, width = 2)
targetLine1 := line.new(bar_index, targetLevel1, last_bar_index + 10, targetLevel1, color = color.blue, width = 2)
if saveEntrySell
targetLine2 := line.new(bar_index, targetLevel2, last_bar_index + 10, targetLevel2, color = color.blue, width = 2)
targetLine3 := line.new(bar_index, targetLevel3, last_bar_index + 10, targetLevel3, color = color.blue, width = 2)
// Set the newLinesDrawn flag to true
newLinesDrawn := true
// Draw new labels with three decimal places
stopLossLabel := label.new(last_bar_index + 10, stopLossLevel, 'SL: ' + str.tostring(stopLossLevel, '#.###'), style = label.style_label_left, color = color.red, textcolor = color.white)
entryLabel := label.new(last_bar_index + 10, close, 'Entry: ' + str.tostring(close, '#.###'), style = label.style_label_left, color = color.green, textcolor = color.white)
targetLabel1 := label.new(last_bar_index + 10, targetLevel1, 'TP 1: ' + str.tostring(targetLevel1, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
if saveEntrySell
targetLabel2 := label.new(last_bar_index + 10, targetLevel2, 'TP 2: ' + str.tostring(targetLevel2, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
targetLabel3 := label.new(last_bar_index + 10, targetLevel3, 'TP 3: ' + str.tostring(targetLevel3, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
// Plot momentum strength/direction
plotarrow(showDir ? dir : na, 'Momentum Strength/Direction', color.new(color.aqua, 50), color.new(color.orange, 50), show_last = 500)
plot(showBB ? bbUpper : na, 'BBUpper', color.new(color.blue, 25), show_last = 500)
plot(showBB ? bbLower : na, 'BBLower', color.new(color.blue, 25), show_last = 500)
plot(showKC ? kcUpper : na, 'KCUpper', color.new(color.red, 25), show_last = 500)
plot(showKC ? kcLower : na, 'KCLower', color.new(color.red, 25), show_last = 500)
//======================================================================================================================
// Trigger alert when squeeze is released
if sqzOn and not sqzOn
alert('Squeeze On : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if sqzOff and not sqzOff // Only trigger alert if the squeeze was previously on
alert('Squeeze Off : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangDown and not triangDown // Only trigger alert if the squeeze was previously on
alert('Weak TrendDown or Reverse : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangUp and not triangUp // Only trigger alert if the squeeze was previously on
alert('Weak TrendUp or Reverse : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if insideThreshold and not insideThreshold //trigger when entering threshold channel
alert('inside threshold : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangUpR and triangUp
alert('Trend Up Cont : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangDownR and triangDown
alert('Trend Down Cont : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
// Alert for trend change when new lines and labels are drawn
if newLinesDrawn
saveEntry = addsave ? 'safe' : 'adrenaline'
trendType = upTrend ? 'Buy' : 'Sell'
stopLossValue = str.tostring(stopLossLevel, '#.###')
entryValue = str.tostring(close, '#.###')
targetValue1 = str.tostring(targetLevel1, '#.###')
targetValue2 = saveEntryBuy or saveEntrySell ? str.tostring(targetLevel2, '#.###') : '---'
targetValue3 = saveEntryBuy or saveEntrySell ? str.tostring(targetLevel3, '#.###') : '---'
alertMessage = 'Mode : '+ saveEntry +' ' +
'Pair : ' + syminfo.tickerid + ' | ' + timeframe.period + ' ' +
'Trend : ' + trendType + ' ' +
'SL : ' + stopLossValue + ' ' +
'Ent : ' + entryValue + ' ' +
'TP1 : ' + targetValue1 + ' ' +
'TP2 : ' + targetValue2 + ' ' +
'TP3 : ' + targetValue3
if alertTrendChange
alert(alertMessage, alert.freq_once_per_bar_close)
// Reset the newLinesDrawn flag
newLinesDrawn := false
ST+SQZMOM v.3// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// © syahdan modifying LazyBear script and many sources
//======================================================================================================================
//@version=6
indicator('ST+SQZMOM v.3', overlay = true, max_lines_count = 40)
import TradingView/ta/9
//======================================================================================================================
//groups
Alerts = 'alert'
Supertrend = 'supertrend'
SqzMom = 'sqzMom'
Sma = 'ma'
TS = 'tp/sl'
// Input switches for alerts
alertTrendChange = input.bool(true, title='Enable Trend Change Alert', group = Alerts)
alertSQZMOM = input.bool(true, title='Enable SQZMOM Alerts', group = Alerts)
// Supertrend Inputs
atrPeriod = input.int(10, 'ATR Length', minval = 1, group = Supertrend)
factor = input.float(2.5, 'Factor', minval = 0.01, step = 0.01, group = Supertrend)
// Squeeze Momentum Indicator Inputs
sources = input(close, 'Source', group = SqzMom)
bbLength = input.int(20, 'Bollinger Bands Length', minval = 1, group = SqzMom)
bbMult = input.float(2, 'Bollinger Bands MultFactor', step = 0.25, group = SqzMom)
kcLength = input(20, 'Keltner\'s Channel Length', group = SqzMom)
kcMult = input.float(1.5, 'Keltner\'s Channel MultFactor', step = 0.25, group = SqzMom)
useTrueRange = input(true, 'Use TrueRange (Keltner\'s Channel)', group = SqzMom)
addSignal = input.bool(false, title = 'add Signal to Calculate direction', group = SqzMom)
signalLength = input(5, 'Signal Length', group = SqzMom)
tooltip_sqz = 'show momentum direction, BB band and KC band'
showBB = input.bool(false, 'show BBand', tooltip = tooltip_sqz, group = SqzMom)
showKC = input.bool(false, 'show keltner channel', tooltip = tooltip_sqz, group = SqzMom)
showDir= input.bool(false, 'show squeeze direction', tooltip = tooltip_sqz, group = SqzMom)
// Customizable thresholds
lowerThreshold = input(-1.0, title = 'Lower Threshold', group = SqzMom)
upperThreshold = input(1.0, title = 'Upper Threshold', group = SqzMom)
// SMA Input settings
lengthMA = input(200, title="MA Period", group = Sma)
showMA = input.bool(true, title="Show MA", group = Sma)
addsave = input.bool(true, title = 'add MA as filter', group = Alerts)
// Hardcoded tp + sl multipliers
targetMultiplier1 = input.int(1, 'TP1 multiply', minval = 1, group = TS)
targetMultiplier2 = input.int(2, 'TP2 multiply', minval = 2, group = TS)
targetMultiplier3 = input.int(3, 'TP3 multiply', minval = 3, group = TS)
stopLossMultiplier = input.int(3, 'SL multiply', minval = 3, group = TS)
//======================================================================================================================
// Calculate Supertrend
= ta.supertrend(factor, atrPeriod)
// Plot the Supertrend line
plot(supertrend, color = direction < 0 ? color.green : color.red, title = 'ST', style = plot.style_stepline_diamond)
// Determine if the trend is up or down
upTrend = direction < 0
downTrend = direction > 0
// Track previous trend state
var int previousDirection = na
previousDirection := upTrend ? 1 : -1
// Calculate ATR for targets and stop loss
atrValue = ta.atr(atrPeriod)
// Initialize target and stop loss levels
var float entryPrice = na
var float targetLevel1 = na
var float targetLevel2 = na
var float targetLevel3 = na
var float stopLossLevel = na
// Initialize counters for lines and labels
var int count_up = 0
var int count_down = 0
// Initialize a new variable to track if new lines and labels are drawn
var bool newLinesDrawn = false
// Calculate BB
basis = ta.sma(sources, bbLength)
dev = bbMult * ta.stdev(sources, bbLength)
bbUpper = basis + dev
bbLower = basis - dev
// Calculate KC
ma = ta.sma(sources, kcLength)
trRange = useTrueRange ? ta.tr : high - low
rangema = ta.sma(trRange, kcLength)
kcUpper = ma + rangema * kcMult
kcLower = ma - rangema * kcMult
sqzOn = bbLower > kcLower and bbUpper < kcUpper
sqzOff = bbLower < kcLower and bbUpper > kcUpper
noSqz = sqzOn == false and sqzOff == false
val = ta.linreg(sources - math.avg(math.avg(ta.highest(high, kcLength), ta.lowest(low, kcLength)), ta.sma(sources, kcLength)), kcLength, 0)
signal = ta.sma(val, signalLength)
dir = not addSignal ? val : val - signal
// Calculate SMA
MA = ta.sma(sources,lengthMA)
saveEntryBuy = addsave ? MA < close : false
saveEntrySell = addsave ? MA > close : false
//======================================================================================================================
// Plot SMA
plot(showMA ? MA : na, color=color.white, linewidth=2, title='MA')
triangUp = sqzOff and dir > dir and dir >= upperThreshold
triangDown = sqzOff and dir < dir and dir <= lowerThreshold
triangUpR = sqzOff and dir < dir and dir >= upperThreshold
triangDownR = sqzOff and dir > dir and dir <= lowerThreshold
insideThreshold = sqzOff and upperThreshold > dir and dir > lowerThreshold
// Calculate target and stop loss levels
if upTrend and triangUp
entryPrice := close
targetLevel1 := close + atrValue * targetMultiplier1
targetLevel2 := close + atrValue * targetMultiplier2
targetLevel3 := close + atrValue * targetMultiplier3
stopLossLevel := close - atrValue * stopLossMultiplier
count_up := count_up + 1
count_down := 0
else if downTrend and triangDown
entryPrice := close
targetLevel1 := close - atrValue * targetMultiplier1
targetLevel2 := close - atrValue * targetMultiplier2
targetLevel3 := close - atrValue * targetMultiplier3
stopLossLevel := close + atrValue * stopLossMultiplier
count_down := count_down + 1
count_up := 0
// Plotting Squeeze Momentum Indicator
plotshape(sqzOn or noSqz, 'In Squeeze', shape.square, location.top, color=sqzOn or noSqz ? color.new(color.orange, 0) : color.new(color.white, 0))
plotshape(triangUp or triangUpR, 'Squeeze Release UpTrend', shape.triangleup, location.top, color=triangUp ? color.new(color.green, 0) : color.new(color.yellow, 0))
plotshape(triangDown or triangDownR, 'Squeeze Release DownTrend', shape.triangledown, location.top, color=triangDown ? color.new(color.red, 0) : color.new(color.yellow, 0))
plotshape(insideThreshold, 'inside threshold', shape.diamond, location.top, color.new(color.white, 0) )
// Draw lines and labels for targets and stop loss
var line stopLossLine = na
var line entryLine = na
var line targetLine1 = na
var line targetLine2 = na
var line targetLine3 = na
var label stopLossLabel = na
var label entryLabel = na
var label targetLabel1 = na
var label targetLabel2 = na
var label targetLabel3 = na
// Clear previous lines and labels if a new trend is confirmed
if upTrend and triangUp and count_up == 1
// Clear previous lines and labels
line.delete(stopLossLine)
line.delete(entryLine)
line.delete(targetLine1)
line.delete(targetLine2)
line.delete(targetLine3)
label.delete(stopLossLabel)
label.delete(entryLabel)
label.delete(targetLabel1)
label.delete(targetLabel2)
label.delete(targetLabel3)
// Draw new lines + 10 bars into the future
stopLossLine := line.new(bar_index, stopLossLevel, last_bar_index + 10, stopLossLevel, color = color.red, width = 2)
entryLine := line.new(bar_index, close, last_bar_index + 10, close, color = color.green, width = 2)
targetLine1 := line.new(bar_index, targetLevel1, last_bar_index + 10, targetLevel1, color = color.blue, width = 2)
if saveEntryBuy
targetLine2 := line.new(bar_index, targetLevel2, last_bar_index + 10, targetLevel2, color = color.blue, width = 2)
targetLine3 := line.new(bar_index, targetLevel3, last_bar_index + 10, targetLevel3, color = color.blue, width = 2)
// Set the newLinesDrawn flag to true
newLinesDrawn := true
// Draw new labels with three decimal places
stopLossLabel := label.new(last_bar_index + 10, stopLossLevel, 'SL: ' + str.tostring(stopLossLevel, '#.###'), style = label.style_label_left, color = color.red, textcolor = color.white)
entryLabel := label.new(last_bar_index + 10, close, 'Entry: ' + str.tostring(close, '#.###'), style = label.style_label_left, color = color.green, textcolor = color.white)
targetLabel1 := label.new(last_bar_index + 10, targetLevel1, 'TP 1: ' + str.tostring(targetLevel1, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
if saveEntryBuy
targetLabel2 := label.new(last_bar_index + 10, targetLevel2, 'TP 2: ' + str.tostring(targetLevel2, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
targetLabel3 := label.new(last_bar_index +10, targetLevel3, 'TP 3: ' + str.tostring(targetLevel3, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
if downTrend and triangDown and count_down == 1
// Clear previous lines and labels
line.delete(stopLossLine)
line.delete(entryLine)
line.delete(targetLine1)
line.delete(targetLine2)
line.delete(targetLine3)
label.delete(stopLossLabel)
label.delete(entryLabel)
label.delete(targetLabel1)
label.delete(targetLabel2)
label.delete(targetLabel3)
// Draw new lines + 10 bars into the future
stopLossLine := line.new(bar_index, stopLossLevel, last_bar_index + 10, stopLossLevel, color = color.red, width = 2)
entryLine := line.new(bar_index, close, last_bar_index + 10, close, color = color.green, width = 2)
targetLine1 := line.new(bar_index, targetLevel1, last_bar_index + 10, targetLevel1, color = color.blue, width = 2)
if saveEntrySell
targetLine2 := line.new(bar_index, targetLevel2, last_bar_index + 10, targetLevel2, color = color.blue, width = 2)
targetLine3 := line.new(bar_index, targetLevel3, last_bar_index + 10, targetLevel3, color = color.blue, width = 2)
// Set the newLinesDrawn flag to true
newLinesDrawn := true
// Draw new labels with three decimal places
stopLossLabel := label.new(last_bar_index + 10, stopLossLevel, 'SL: ' + str.tostring(stopLossLevel, '#.###'), style = label.style_label_left, color = color.red, textcolor = color.white)
entryLabel := label.new(last_bar_index + 10, close, 'Entry: ' + str.tostring(close, '#.###'), style = label.style_label_left, color = color.green, textcolor = color.white)
targetLabel1 := label.new(last_bar_index + 10, targetLevel1, 'TP 1: ' + str.tostring(targetLevel1, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
if saveEntrySell
targetLabel2 := label.new(last_bar_index + 10, targetLevel2, 'TP 2: ' + str.tostring(targetLevel2, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
targetLabel3 := label.new(last_bar_index + 10, targetLevel3, 'TP 3: ' + str.tostring(targetLevel3, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
// Plot momentum strength/direction
plotarrow(showDir ? dir : na, 'Momentum Strength/Direction', color.new(color.aqua, 50), color.new(color.orange, 50), show_last = 500)
plot(showBB ? bbUpper : na, 'BBUpper', color.new(color.blue, 25), show_last = 500)
plot(showBB ? bbLower : na, 'BBLower', color.new(color.blue, 25), show_last = 500)
plot(showKC ? kcUpper : na, 'KCUpper', color.new(color.red, 25), show_last = 500)
plot(showKC ? kcLower : na, 'KCLower', color.new(color.red, 25), show_last = 500)
//======================================================================================================================
// Trigger alert when squeeze is released
if sqzOn and not sqzOn
alert('Squeeze On : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if sqzOff and not sqzOff // Only trigger alert if the squeeze was previously on
alert('Squeeze Off : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangDown and not triangDown // Only trigger alert if the squeeze was previously on
alert('Weak TrendDown or Reverse : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangUp and not triangUp // Only trigger alert if the squeeze was previously on
alert('Weak TrendUp or Reverse : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if insideThreshold and not insideThreshold //trigger when entering threshold channel
alert('inside threshold : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangUpR and triangUp
alert('Trend Up Cont : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangDownR and triangDown
alert('Trend Down Cont : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
// Alert for trend change when new lines and labels are drawn
if newLinesDrawn
saveEntry = addsave ? 'safe' : 'adrenaline'
trendType = upTrend ? 'Buy' : 'Sell'
stopLossValue = str.tostring(stopLossLevel, '#.###')
entryValue = str.tostring(close, '#.###')
targetValue1 = str.tostring(targetLevel1, '#.###')
targetValue2 = saveEntryBuy or saveEntrySell ? str.tostring(targetLevel2, '#.###') : '---'
targetValue3 = saveEntryBuy or saveEntrySell ? str.tostring(targetLevel3, '#.###') : '---'
alertMessage = 'Mode : '+ saveEntry +' ' +
'Pair : ' + syminfo.tickerid + ' | ' + timeframe.period + ' ' +
'Trend : ' + trendType + ' ' +
'SL : ' + stopLossValue + ' ' +
'Ent : ' + entryValue + ' ' +
'TP1 : ' + targetValue1 + ' ' +
'TP2 : ' + targetValue2 + ' ' +
'TP3 : ' + targetValue3
if alertTrendChange
alert(alertMessage, alert.freq_once_per_bar_close)
// Reset the newLinesDrawn flag
newLinesDrawn := false
ST+SQZMOM v.3// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// © syahdan modifying LazyBear script and many sources
//======================================================================================================================
//@version=6
indicator('ST+SQZMOM v.3', overlay = true, max_lines_count = 40)
import TradingView/ta/9
//======================================================================================================================
//groups
Alerts = 'alert'
Supertrend = 'supertrend'
SqzMom = 'sqzMom'
Sma = 'ma'
TS = 'tp/sl'
// Input switches for alerts
alertTrendChange = input.bool(true, title='Enable Trend Change Alert', group = Alerts)
alertSQZMOM = input.bool(true, title='Enable SQZMOM Alerts', group = Alerts)
// Supertrend Inputs
atrPeriod = input.int(10, 'ATR Length', minval = 1, group = Supertrend)
factor = input.float(2.5, 'Factor', minval = 0.01, step = 0.01, group = Supertrend)
// Squeeze Momentum Indicator Inputs
sources = input(close, 'Source', group = SqzMom)
bbLength = input.int(20, 'Bollinger Bands Length', minval = 1, group = SqzMom)
bbMult = input.float(2, 'Bollinger Bands MultFactor', step = 0.25, group = SqzMom)
kcLength = input(20, 'Keltner\'s Channel Length', group = SqzMom)
kcMult = input.float(1.5, 'Keltner\'s Channel MultFactor', step = 0.25, group = SqzMom)
useTrueRange = input(true, 'Use TrueRange (Keltner\'s Channel)', group = SqzMom)
addSignal = input.bool(false, title = 'add Signal to Calculate direction', group = SqzMom)
signalLength = input(5, 'Signal Length', group = SqzMom)
tooltip_sqz = 'show momentum direction, BB band and KC band'
showBB = input.bool(false, 'show BBand', tooltip = tooltip_sqz, group = SqzMom)
showKC = input.bool(false, 'show keltner channel', tooltip = tooltip_sqz, group = SqzMom)
showDir= input.bool(false, 'show squeeze direction', tooltip = tooltip_sqz, group = SqzMom)
// Customizable thresholds
lowerThreshold = input(-1.0, title = 'Lower Threshold', group = SqzMom)
upperThreshold = input(1.0, title = 'Upper Threshold', group = SqzMom)
// SMA Input settings
lengthMA = input(200, title="MA Period", group = Sma)
showMA = input.bool(true, title="Show MA", group = Sma)
addsave = input.bool(true, title = 'add MA as filter', group = Alerts)
// Hardcoded tp + sl multipliers
targetMultiplier1 = input.int(1, 'TP1 multiply', minval = 1, group = TS)
targetMultiplier2 = input.int(2, 'TP2 multiply', minval = 2, group = TS)
targetMultiplier3 = input.int(3, 'TP3 multiply', minval = 3, group = TS)
stopLossMultiplier = input.int(3, 'SL multiply', minval = 3, group = TS)
//======================================================================================================================
// Calculate Supertrend
= ta.supertrend(factor, atrPeriod)
// Plot the Supertrend line
plot(supertrend, color = direction < 0 ? color.green : color.red, title = 'ST', style = plot.style_stepline_diamond)
// Determine if the trend is up or down
upTrend = direction < 0
downTrend = direction > 0
// Track previous trend state
var int previousDirection = na
previousDirection := upTrend ? 1 : -1
// Calculate ATR for targets and stop loss
atrValue = ta.atr(atrPeriod)
// Initialize target and stop loss levels
var float entryPrice = na
var float targetLevel1 = na
var float targetLevel2 = na
var float targetLevel3 = na
var float stopLossLevel = na
// Initialize counters for lines and labels
var int count_up = 0
var int count_down = 0
// Initialize a new variable to track if new lines and labels are drawn
var bool newLinesDrawn = false
// Calculate BB
basis = ta.sma(sources, bbLength)
dev = bbMult * ta.stdev(sources, bbLength)
bbUpper = basis + dev
bbLower = basis - dev
// Calculate KC
ma = ta.sma(sources, kcLength)
trRange = useTrueRange ? ta.tr : high - low
rangema = ta.sma(trRange, kcLength)
kcUpper = ma + rangema * kcMult
kcLower = ma - rangema * kcMult
sqzOn = bbLower > kcLower and bbUpper < kcUpper
sqzOff = bbLower < kcLower and bbUpper > kcUpper
noSqz = sqzOn == false and sqzOff == false
val = ta.linreg(sources - math.avg(math.avg(ta.highest(high, kcLength), ta.lowest(low, kcLength)), ta.sma(sources, kcLength)), kcLength, 0)
signal = ta.sma(val, signalLength)
dir = not addSignal ? val : val - signal
// Calculate SMA
MA = ta.sma(sources,lengthMA)
saveEntryBuy = addsave ? MA < close : false
saveEntrySell = addsave ? MA > close : false
//======================================================================================================================
// Plot SMA
plot(showMA ? MA : na, color=color.white, linewidth=2, title='MA')
triangUp = sqzOff and dir > dir and dir >= upperThreshold
triangDown = sqzOff and dir < dir and dir <= lowerThreshold
triangUpR = sqzOff and dir < dir and dir >= upperThreshold
triangDownR = sqzOff and dir > dir and dir <= lowerThreshold
insideThreshold = sqzOff and upperThreshold > dir and dir > lowerThreshold
// Calculate target and stop loss levels
if upTrend and triangUp
entryPrice := close
targetLevel1 := close + atrValue * targetMultiplier1
targetLevel2 := close + atrValue * targetMultiplier2
targetLevel3 := close + atrValue * targetMultiplier3
stopLossLevel := close - atrValue * stopLossMultiplier
count_up := count_up + 1
count_down := 0
else if downTrend and triangDown
entryPrice := close
targetLevel1 := close - atrValue * targetMultiplier1
targetLevel2 := close - atrValue * targetMultiplier2
targetLevel3 := close - atrValue * targetMultiplier3
stopLossLevel := close + atrValue * stopLossMultiplier
count_down := count_down + 1
count_up := 0
// Plotting Squeeze Momentum Indicator
plotshape(sqzOn or noSqz, 'In Squeeze', shape.square, location.top, color=sqzOn or noSqz ? color.new(color.orange, 0) : color.new(color.white, 0))
plotshape(triangUp or triangUpR, 'Squeeze Release UpTrend', shape.triangleup, location.top, color=triangUp ? color.new(color.green, 0) : color.new(color.yellow, 0))
plotshape(triangDown or triangDownR, 'Squeeze Release DownTrend', shape.triangledown, location.top, color=triangDown ? color.new(color.red, 0) : color.new(color.yellow, 0))
plotshape(insideThreshold, 'inside threshold', shape.diamond, location.top, color.new(color.white, 0) )
// Draw lines and labels for targets and stop loss
var line stopLossLine = na
var line entryLine = na
var line targetLine1 = na
var line targetLine2 = na
var line targetLine3 = na
var label stopLossLabel = na
var label entryLabel = na
var label targetLabel1 = na
var label targetLabel2 = na
var label targetLabel3 = na
// Clear previous lines and labels if a new trend is confirmed
if upTrend and triangUp and count_up == 1
// Clear previous lines and labels
line.delete(stopLossLine)
line.delete(entryLine)
line.delete(targetLine1)
line.delete(targetLine2)
line.delete(targetLine3)
label.delete(stopLossLabel)
label.delete(entryLabel)
label.delete(targetLabel1)
label.delete(targetLabel2)
label.delete(targetLabel3)
// Draw new lines + 10 bars into the future
stopLossLine := line.new(bar_index, stopLossLevel, last_bar_index + 10, stopLossLevel, color = color.red, width = 2)
entryLine := line.new(bar_index, close, last_bar_index + 10, close, color = color.green, width = 2)
targetLine1 := line.new(bar_index, targetLevel1, last_bar_index + 10, targetLevel1, color = color.blue, width = 2)
if saveEntryBuy
targetLine2 := line.new(bar_index, targetLevel2, last_bar_index + 10, targetLevel2, color = color.blue, width = 2)
targetLine3 := line.new(bar_index, targetLevel3, last_bar_index + 10, targetLevel3, color = color.blue, width = 2)
// Set the newLinesDrawn flag to true
newLinesDrawn := true
// Draw new labels with three decimal places
stopLossLabel := label.new(last_bar_index + 10, stopLossLevel, 'SL: ' + str.tostring(stopLossLevel, '#.###'), style = label.style_label_left, color = color.red, textcolor = color.white)
entryLabel := label.new(last_bar_index + 10, close, 'Entry: ' + str.tostring(close, '#.###'), style = label.style_label_left, color = color.green, textcolor = color.white)
targetLabel1 := label.new(last_bar_index + 10, targetLevel1, 'TP 1: ' + str.tostring(targetLevel1, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
if saveEntryBuy
targetLabel2 := label.new(last_bar_index + 10, targetLevel2, 'TP 2: ' + str.tostring(targetLevel2, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
targetLabel3 := label.new(last_bar_index +10, targetLevel3, 'TP 3: ' + str.tostring(targetLevel3, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
if downTrend and triangDown and count_down == 1
// Clear previous lines and labels
line.delete(stopLossLine)
line.delete(entryLine)
line.delete(targetLine1)
line.delete(targetLine2)
line.delete(targetLine3)
label.delete(stopLossLabel)
label.delete(entryLabel)
label.delete(targetLabel1)
label.delete(targetLabel2)
label.delete(targetLabel3)
// Draw new lines + 10 bars into the future
stopLossLine := line.new(bar_index, stopLossLevel, last_bar_index + 10, stopLossLevel, color = color.red, width = 2)
entryLine := line.new(bar_index, close, last_bar_index + 10, close, color = color.green, width = 2)
targetLine1 := line.new(bar_index, targetLevel1, last_bar_index + 10, targetLevel1, color = color.blue, width = 2)
if saveEntrySell
targetLine2 := line.new(bar_index, targetLevel2, last_bar_index + 10, targetLevel2, color = color.blue, width = 2)
targetLine3 := line.new(bar_index, targetLevel3, last_bar_index + 10, targetLevel3, color = color.blue, width = 2)
// Set the newLinesDrawn flag to true
newLinesDrawn := true
// Draw new labels with three decimal places
stopLossLabel := label.new(last_bar_index + 10, stopLossLevel, 'SL: ' + str.tostring(stopLossLevel, '#.###'), style = label.style_label_left, color = color.red, textcolor = color.white)
entryLabel := label.new(last_bar_index + 10, close, 'Entry: ' + str.tostring(close, '#.###'), style = label.style_label_left, color = color.green, textcolor = color.white)
targetLabel1 := label.new(last_bar_index + 10, targetLevel1, 'TP 1: ' + str.tostring(targetLevel1, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
if saveEntrySell
targetLabel2 := label.new(last_bar_index + 10, targetLevel2, 'TP 2: ' + str.tostring(targetLevel2, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
targetLabel3 := label.new(last_bar_index + 10, targetLevel3, 'TP 3: ' + str.tostring(targetLevel3, '#.###'), style = label.style_label_left, color = color.blue, textcolor = color.white)
// Plot momentum strength/direction
plotarrow(showDir ? dir : na, 'Momentum Strength/Direction', color.new(color.aqua, 50), color.new(color.orange, 50), show_last = 500)
plot(showBB ? bbUpper : na, 'BBUpper', color.new(color.blue, 25), show_last = 500)
plot(showBB ? bbLower : na, 'BBLower', color.new(color.blue, 25), show_last = 500)
plot(showKC ? kcUpper : na, 'KCUpper', color.new(color.red, 25), show_last = 500)
plot(showKC ? kcLower : na, 'KCLower', color.new(color.red, 25), show_last = 500)
//======================================================================================================================
// Trigger alert when squeeze is released
if sqzOn and not sqzOn
alert('Squeeze On : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if sqzOff and not sqzOff // Only trigger alert if the squeeze was previously on
alert('Squeeze Off : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangDown and not triangDown // Only trigger alert if the squeeze was previously on
alert('Weak TrendDown or Reverse : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangUp and not triangUp // Only trigger alert if the squeeze was previously on
alert('Weak TrendUp or Reverse : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if insideThreshold and not insideThreshold //trigger when entering threshold channel
alert('inside threshold : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangUpR and triangUp
alert('Trend Up Cont : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
if triangDownR and triangDown
alert('Trend Down Cont : '+ syminfo.tickerid + ' | ' + timeframe.period, alert.freq_once_per_bar_close)
// Alert for trend change when new lines and labels are drawn
if newLinesDrawn
saveEntry = addsave ? 'safe' : 'adrenaline'
trendType = upTrend ? 'Buy' : 'Sell'
stopLossValue = str.tostring(stopLossLevel, '#.###')
entryValue = str.tostring(close, '#.###')
targetValue1 = str.tostring(targetLevel1, '#.###')
targetValue2 = saveEntryBuy or saveEntrySell ? str.tostring(targetLevel2, '#.###') : '---'
targetValue3 = saveEntryBuy or saveEntrySell ? str.tostring(targetLevel3, '#.###') : '---'
alertMessage = 'Mode : '+ saveEntry +' ' +
'Pair : ' + syminfo.tickerid + ' | ' + timeframe.period + ' ' +
'Trend : ' + trendType + ' ' +
'SL : ' + stopLossValue + ' ' +
'Ent : ' + entryValue + ' ' +
'TP1 : ' + targetValue1 + ' ' +
'TP2 : ' + targetValue2 + ' ' +
'TP3 : ' + targetValue3
if alertTrendChange
alert(alertMessage, alert.freq_once_per_bar_close)
// Reset the newLinesDrawn flag
newLinesDrawn := false
Optimize Al-Sat Stratejisi (ADX ile)Strateji, teknik analiz araçlarını kullanarak piyasa trendlerini, fiyat hareketlerini ve hacim değişimlerini analiz eden bir algoritmadır. Bu sistem, alım ve satım sinyalleri üreterek yatırımcılara karar desteği sağlar. Ayrıca, risk yönetimi ve kâr hedefleriyle optimize edilmiştir.
onder-mam//@version=5
indicator("Basitleştirilmiş Multi-Indicator System (Sadeleştirilmiş Görünürlük)", overlay=true)
// --- Kullanıcı Ayarları ---
macdShortLength = input.int(12, title="MACD Kısa Periyot", minval=1)
macdLongLength = input.int(26, title="MACD Uzun Periyot", minval=1)
macdSignalSmoothing = input.int(9, title="MACD Signal Periyodu", minval=1)
smaLength = input.int(50, title="SMA Periyodu", minval=1)
emaLength = input.int(200, title="EMA Periyodu", minval=1)
atrLength = input.int(14, title="ATR Periyodu", minval=1)
factor = input.float(3.0, title="Supertrend Çarpanı", minval=1.0, step=0.1)
bbLength = input.int(20, title="Bollinger Bands Periyot", minval=1)
bbMultiplier = input.float(2.0, title="Bollinger Band Çarpanı", minval=0.1, step=0.1)
src = close
// --- MACD Hesaplamaları ---
= ta.macd(src, macdShortLength, macdLongLength, macdSignalSmoothing)
macdBuySignal = ta.crossover(macdLine, signalLine)
macdSellSignal = ta.crossunder(macdLine, signalLine)
// --- SMA ve EMA Hesaplamaları ---
smaLine = ta.sma(src, smaLength)
emaLine = ta.ema(src, emaLength)
maBuySignal = ta.crossover(smaLine, emaLine)
maSellSignal = ta.crossunder(smaLine, emaLine)
// --- Supertrend Hesaplamaları ---
atrValue = ta.atr(atrLength)
upperBand = hl2 - factor * atrValue
lowerBand = hl2 + factor * atrValue
var float supertrend = na
if (na(supertrend ))
supertrend := upperBand
else
if (close > supertrend )
supertrend := math.max(upperBand, supertrend )
else
supertrend := math.min(lowerBand, supertrend )
supertrendBuySignal = ta.crossover(close, supertrend)
supertrendSellSignal = ta.crossunder(close, supertrend)
// --- Bollinger Bands Hesaplamaları ---
basis = ta.sma(src, bbLength)
dev = bbMultiplier * ta.stdev(src, bbLength)
bbUpper = basis + dev
bbLower = basis - dev
bbBuySignal = ta.crossover(src, bbLower)
bbSellSignal = ta.crossunder(src, bbUpper)
// --- Çizimler ---
// MACD Çizgileri - sadece sinyal olduğunda gösterilecek
plot(macdLine, title="MACD Line", color=color.blue, linewidth=2)
plot(signalLine, title="Signal Line", color=color.orange, linewidth=2)
// SMA ve EMA Çizgileri - sadece geçerli sinyallerde gösterilecek
plot(smaLine, title="SMA Line", color=color.green, linewidth=2)
plot(emaLine, title="EMA Line", color=color.red, linewidth=2)
// Supertrend Çizgisi - sadece sinyal olduğunda gösterilecek
plot(supertrend, title="Supertrend", color=color.blue, linewidth=2)
// Bollinger Bands Çizgileri - sadece sinyal olduğunda gösterilecek
plot(basis, title="Bollinger Bands Orta Band", color=color.blue, linewidth=2)
plot(bbUpper, title="Bollinger Bands Üst Band", color=color.red, linewidth=2)
plot(bbLower, title="Bollinger Bands Alt Band", color=color.green, linewidth=2)
// --- Sinyaller ve Arka Plan Rengi ---
// Alım ve Satım sinyalleri için şekiller - sadece sinyal olduğunda gösterecek
plotshape(series=macdBuySignal, title="MACD Alım Sinyali", location=location.belowbar, color=color.green, style=shape.triangleup, text="BUY", size=size.small)
plotshape(series=macdSellSignal, title="MACD Satım Sinyali", location=location.abovebar, color=color.red, style=shape.triangledown, text="SELL", size=size.small)
plotshape(series=maBuySignal, title="SMA/EMA Alım Sinyali", location=location.belowbar, color=color.green, style=shape.triangleup, text="BUY", size=size.small)
plotshape(series=maSellSignal, title="SMA/EMA Satım Sinyali", location=location.abovebar, color=color.red, style=shape.triangledown, text="SELL", size=size.small)
plotshape(series=supertrendBuySignal, title="Supertrend Alım Sinyali", location=location.belowbar, color=color.green, style=shape.triangleup, text="BUY", size=size.small)
plotshape(series=supertrendSellSignal, title="Supertrend Satım Sinyali", location=location.abovebar, color=color.red, style=shape.triangledown, text="SELL", size=size.small)
plotshape(series=bbBuySignal, title="Bollinger Bands Alım Sinyali", location=location.belowbar, color=color.green, style=shape.triangleup, text="BUY", size=size.small)
plotshape(series=bbSellSignal, title="Bollinger Bands Satım Sinyali", location=location.abovebar, color=color.red, style=shape.triangledown, text="SELL", size=size.small)
// Arka plan renkleri (trend doğrulama için)
bgcolor(macdBuySignal or maBuySignal or supertrendBuySignal or bbBuySignal ? color.new(color.green, 90) : na, title="Alım Trend Arka Planı")
bgcolor(macdSellSignal or maSellSignal or supertrendSellSignal or bbSellSignal ? color.new(color.red, 90) : na, title="Satım Trend Arka Planı")
// Alerjler (Alert Conditions)
alertcondition(macdBuySignal, title="MACD Alım Sinyali", message="MACD çizgisi, Signal çizgisini yukarıya kesiyor. Alım sinyali!")
alertcondition(macdSellSignal, title="MACD Satım Sinyali", message="MACD çizgisi, Signal çizgisini aşağıya kesiyor. Satım sinyali!")
alertcondition(maBuySignal, title="SMA/EMA Alım Sinyali", message="SMA çizgisi, EMA çizgisini yukarıya doğru kesiyor. Alım sinyali!")
alertcondition(maSellSignal, title="SMA/EMA Satım Sinyali", message="SMA çizgisi, EMA çizgisini aşağıya doğru kesiyor. Satım sinyali!")
alertcondition(supertrendBuySignal, title="Supertrend Alım Sinyali", message="Supertrend çizgisi, fiyatı yukarıya doğru kesiyor. Alım sinyali!")
alertcondition(supertrendSellSignal, title="Supertrend Satım Sinyali", message="Supertrend çizgisi, fiyatı aşağıya doğru kesiyor. Satım sinyali!")
alertcondition(bbBuySignal, title="Bollinger Bands Alım Sinyali", message="Fiyat alt Bollinger Band'ını yukarı kesiyor. Alım sinyali!")
alertcondition(bbSellSignal, title="Bollinger Bands Satım Sinyali", message="Fiyat üst Bollinger Band'ını aşağı kesiyor. Satım sinyali!")
rsi 1450The code has been reverted to its original version without the arrow modifications. Let me know if you need any further adjustments!