Sector Relative StrengthThis indicator measures a stock's Real Relative Strength against its sector benchmark, helping you identify stocks that are outperforming or underperforming their sector peers. 
The concept is based on the Real Relative Strength methodology popularized by the r/realdaytrading community.
Unlike traditional relative strength calculations that simply compare price ratios, this indicator uses a more sophisticated approach that accounts for volatility through ATR (Average True Range), providing a normalized view of true relative performance.
Key Features
Automatic Sector Detection
Automatically detects your stock's sector using TradingView's built-in sector classification
Maps to the appropriate SPDR Sector ETF (XLK, XLF, XLV, XLY, XLP, XLI, XLE, XLU, XLB, XLC)
Supports all 20 TradingView sectors
Sector ETF Mappings
The indicator automatically compares your stock against:
Technology: XLK (Technology Services, Electronic Technology)
Financials: XLF (Finance sector)
Healthcare: XLV (Health Technology, Health Services)
Consumer Discretionary: XLY (Retail Trade, Consumer Services, Consumer Durables)
Consumer Staples: XLP (Consumer Non-Durables)
Industrials: XLI (Producer Manufacturing, Industrial Services, Transportation, Commercial Services)
Energy: XLE (Energy Minerals)
Utilities: XLU
Materials: XLB (Non-Energy Minerals, Process Industries)
Communications: XLC
Default: SPY (for Miscellaneous or unclassified sectors)
Customizable Settings
Comparison Mode: Choose between automatic sector comparison or custom symbol
Length: Adjustable lookback period (default: 12)
Smoothing: Apply moving average to reduce noise (default: 3)
Visual Clarity
Green line: Stock is outperforming its sector
Red line: Stock is underperforming its sector
Zero baseline: Clear reference point for performance
Clean info box: Shows which ETF you're comparing against
How It Works
The indicator calculates relative strength using the following methodology:
Rolling Price Change: Measures the price movement over the specified length for both the stock and its sector ETF
ATR Normalization: Uses Average True Range to normalize for volatility differences
Power Index: Calculates the sector's strength relative to its volatility
Real Relative Strength: Compares the stock's performance against the sector's power index
Smoothing: Applies a moving average to reduce single-candle spikes
Formula:
Power Index = (Sector Price Change) / (Sector ATR)
RRS = (Stock Price Change - Power Index × Stock ATR) / Stock ATR
Smoothed RRS = SMA(RRS, Smoothing Length)
Indicators and strategies
RSI + Elder Bull-Bear pressure RSI + Bull/Bear (Elder-Ray enhanced RSI) 
 What it is 
An extended RSI that overlays Elder-Ray Bull/Bear Power on the same, zero-centered scale. You get classic RSI regime cues plus a live read of buy/sell pressure, with optional smoothing, bands, and right-edge value labels.
 Key features 
RSI with bands – default bands 30 / 50 / 70 (editable).
Bull/Bear Power (Elder) – ATR-normalized; optional EMA/SMA/RMA/HMA smoothing.
One-pane overlay – RSI and Bull/Bear share a common midline (RSI-50 ↔ panel 0).
Right-edge labels – always visible at the chart’s right margin with adjustable offsets.
 How to read it 
Cyan line = RSI (normalized)
Above the mid band = bullish regime; below = bearish regime.
Green = Bull Power, Red = Bear Power
Columns/lines above 0 show buy pressure; below 0 show sell pressure.
Smoothing reduces noise; zero-line remains your key reference.
 Trade logic (simple playbook)
Entry 
BUY (primary):
RSI crosses up through 50 (regime turns bullish), and
Bull (green) crosses up through 0 (buy pressure confirms).
SELL (primary):
RSI crosses down through 50, and
Bear (red) crosses down through 0 (sell pressure confirms).
 Alternative momentum entries 
Aggressive BUY: Bull (green) pushes above RSI-80 band (strong upside impulse).
Aggressive SELL: Bear (red) pushes below RSI-30 band (strong downside impulse).
 Exits / trade management 
In a long: consider exiting or tightening stops if Bear (red) dips below the 0 line (rising sell pressure) or RSI loses 50.
In a short: consider exiting or tightening if Bull (green) rises above 0 or RSI reclaims 50.
Tip: “0” on the panel is your pressure zero-line (maps to RSI-50). Most whipsaws happen near this line; smoothing (e.g., EMA 21) helps.
 Defaults (on first load) 
RSI bands: 30 / 50 / 70 with subtle fills.
Labels: tiny, pushed far right (large offsets).
Bull/Bear smoothing: EMA(21), smoothed line plot mode.
RSI plotted normalized so it overlaps the pressure lines cleanly.
Tighten or loosen the Bull/Bear thresholds (e.g., Bull ≥ +0.5 ATR, Bear ≤ −0.5 ATR) to demand stronger confirmation.
 Settings that matter 
Smoothing length/type – balances responsiveness vs. noise.
Power/RSI Gain – visual scaling only (doesn’t change logic).
Band placement – keep raw 30/50/80 or switch to “distance from 50” if you prefer symmetric spacing.
Label offsets – move values clear of the last bar/scale clutter.
 Good practices 
Combine with structure/ATR stops (e.g., 1–1.5× ATR, swing high/low).
In trends, hold while RSI stays above/below 50 and the opposite pressure line doesn’t dominate.
In ranges, favor signals occurring near the mid band and take profits at the opposite band.
Disclaimer: This is a research/visual tool, not financial advice at any kind. Test your rules on multiple markets/timeframes and size positions responsibly.
Funded Gang IndiciCustomized indicator to detect the opening bias of Indexes.
Timeframe 14:30 - 15:30
Mirpapa_Lib_boxLibrary   "Mirpapa_Lib_box" 
 AddFVG(boxes, htfTimeframe, htfBarIndex, top, bottom, isBull, _text) 
  AddFVG
@description FVG 박스 데이터 추가
  Parameters:
     boxes (array) : array 박스 배열
     htfTimeframe (string) : string HTF 시간대 ("60", "240", "D")
     htfBarIndex (int) : int HTF bar_index
     top (float) : float 상단 가격
     bottom (float) : float 하단 가격
     isBull (bool) : bool 방향 (true=상승, false=하락)
     _text (string) 
  Returns: void
 AddOB(boxes, htfTimeframe, htfBarIndex, top, bottom, isBull, _text) 
  AddOB
@description OB 박스 데이터 추가
  Parameters:
     boxes (array) : array 박스 배열
     htfTimeframe (string) : string HTF 시간대
     htfBarIndex (int) : int HTF bar_index
     top (float) : float 상단 가격
     bottom (float) : float 하단 가격
     isBull (bool) : bool 방향
     _text (string) 
  Returns: void
 AddBB(boxes, htfTimeframe, htfBarIndex, top, bottom, isBull, _text) 
  AddBB
@description BB 박스 데이터 추가
  Parameters:
     boxes (array) : array 박스 배열
     htfTimeframe (string) : string HTF 시간대
     htfBarIndex (int) : int HTF bar_index
     top (float) : float 상단 가격
     bottom (float) : float 하단 가격
     isBull (bool) : bool 방향
     _text (string) 
  Returns: void
 AddRB(boxes, htfTimeframe, htfBarIndex, top, bottom, isBull, _text) 
  AddRB
@description RB 박스 데이터 추가
  Parameters:
     boxes (array) : array 박스 배열
     htfTimeframe (string) : string HTF 시간대
     htfBarIndex (int) : int HTF bar_index
     top (float) : float 상단 가격
     bottom (float) : float 하단 가격
     isBull (bool) : bool 방향
     _text (string) 
  Returns: void
 ProcessBoxes(boxes, boxType, colorBull, colorBear, closeCount, useLine, textAlignH, textAlignV, closeColor) 
  ProcessBoxes
@description 박스 배열 처리 (생성→확장→터치→종료)
  Parameters:
     boxes (array) : array 박스 배열
     boxType (string) : string 박스 타입 ("FVG", "OB", "BB", "RB")
     colorBull (color) : color 상승 색상
     colorBear (color) : color 하락 색상
     closeCount (int) : int 터치 종료 횟수
     useLine (bool) : bool 중간라인 사용 여부
     textAlignH (string) : string 수평 정렬
     textAlignV (string) : string 수직 정렬
     closeColor (color) : color 종료 색상
  Returns: void
 GetActiveBoxCount(boxes) 
  GetActiveBoxCount
@description 활성 박스 개수 반환
  Parameters:
     boxes (array) : array 박스 배열
  Returns: int 활성 박스 개수
 ClearInactiveBoxes(boxes) 
  ClearInactiveBoxes
@description 비활성 박스 제거 (메모리 절약)
  Parameters:
     boxes (array) : array 박스 배열
  Returns: void
 BoxData 
  BoxData
  Fields:
     _isActive (series bool) : 박스 활성화 상태
     _isBull (series bool) : 방향 (true=상승, false=하락)
     _boxTop (series float) : 상단 가격
     _boxBot (series float) : 하단 가격
     _basePoint (series float) : 터치 감지 기준점
     _stage (series int) : 터치 횟수 카운터
     _type (series string) : 박스 타입 ("FVG", "OB", "BB", "RB")
     _htfTimeframe (series string) : HTF 시간대 ("60", "240", "D")
     _htfBarIndex (series int) : HTF 기준 bar_index
     _text (series string) : 사용자 추가 텍스트
     _box (series box) : 박스 객체 (ProcessBoxes에서 생성)
     _line (series line) : 라인 객체 (ProcessBoxes에서 생성)
Gold 15m: Trend + S/R + Liquidity Sweep (RR 1:2)This strategy is designed for short-term trading on XAUUSD (Gold) using the 15-minute timeframe. It combines trend direction, support/resistance pivots, liquidity sweep detection, and momentum confirmation to identify high-probability reversal setups in line with the dominant market trend.
⚙️ Core Logic:
Trend Filter (EMA 200):
The strategy only takes long positions when price is above the 200 EMA and short positions when price is below it.
Support/Resistance via Pivots:
Dynamic swing highs and lows are identified using pivot points. These act as local supply and demand levels where liquidity is likely to accumulate.
Liquidity Sweep Detection:
A bullish liquidity sweep occurs when price briefly breaks below the last pivot low (grabbing liquidity) and then closes back above it.
A bearish sweep occurs when price breaks above the last pivot high and then closes back below.
Momentum & Candle Strength:
The strategy filters signals based on candle range and body size to ensure entries occur during strong price reactions, not weak retracements.
Risk Management (1:2 RR):
Stop-loss is placed slightly beyond the last pivot level using ATR-based buffers, and take-profit is set at 2× the risk distance, maintaining a reward-to-risk ratio of 1:2.
💼 Trade Logic Summary:
Long Entry:
After a bullish liquidity sweep & reclaim, momentum confirmation, and trend alignment (above EMA 200).
Short Entry:
After a bearish sweep & reclaim, momentum confirmation, and trend alignment (below EMA 200).
Exit:
Automated via ATR-based Stop Loss and Take Profit targets.
📊 Customization Options:
Adjustable EMA length, pivot settings, ATR multipliers, and RR ratio.
Option to enable/disable trend filter.
Toggle display of S/R zones on chart.
🧠 Best Use:
Works best during London and New York sessions when Gold shows strong momentum.
Can be adapted for forex pairs and indices by tuning ATR and pivot parameters.
mysourcetypesncsLibrary   "mysourcetypes" 
Libreria personale per sorgenti estese (Close, Open, High, Low, Median, Typical, Weighted, Average, Average Median Body, Trend Biased, Trend Biased Extreme, Volume Body, Momentum Biased, Volatility Adjusted, Body Dominance, Shadow Biased, Gap Aware, Rejection Biased, Range Position, Adaptive Trend, Pressure Balanced, Impulse Wave)
 rclose() 
  Regular Close
  Returns: Close price
 ropen() 
  Regular Open
  Returns: Open price
 rhigh() 
  Regular High
  Returns: High price
 rlow() 
  Regular Low
  Returns: Low price
 rmedian() 
  Regular Median (HL2)
  Returns: (High + Low) / 2
 rtypical() 
  Regular Typical (HLC3)
  Returns: (High + Low + Close) / 3
 rweighted() 
  Regular Weighted (HLCC4)
  Returns: (High + Low + Close + Close) / 4
 raverage() 
  Regular Average (OHLC4)
  Returns: (Open + High + Low + Close) / 4
 ravemedbody() 
  Average Median Body
  Returns: (Open + Close) / 2
 rtrendb() 
  Trend Biased Regular
  Returns: Trend-weighted price
 rtrendbext() 
  Trend Biased Extreme
  Returns: Extreme trend-weighted price
 rvolbody() 
  Volume Weighted Body
  Returns: Body midpoint weighted by volume intensity
 rmomentum() 
  Momentum Biased
  Returns: Price biased towards momentum direction
 rvolatility() 
  Volatility Adjusted
  Returns: Price adjusted by candle's volatility
 rbodydominance() 
  Body Dominance
  Returns: Emphasizes body over wicks
 rshadowbias() 
  Shadow Biased
  Returns: Price biased by shadow length
 rgapaware() 
  Gap Aware
  Returns: Considers gap between candles
 rrejection() 
  Rejection Biased
  Returns: Emphasizes price rejection levels
 rrangeposition() 
  Range Position
  Returns: Where close sits within the candle range (0-100%)
 radaptivetrend() 
  Adaptive Trend
  Returns: Adapts based on recent trend strength
 rpressure() 
  Pressure Balanced
  Returns: Balances buying/selling pressure within candle
 rimpulse() 
  Impulse Wave
  Returns: Detects impulsive moves vs corrections
MTF Multi EMA - IntradayMTF Multi EMA – Intraday
Purpose:
To quickly analyze trend direction and alignment across multiple timeframes (1m, 3m, 5m, 15m, 30m, and 60m) using fast and slow EMAs for each timeframe — and combine them into a simple “stack score” for easy visual decision-making. The script is tuned for Intraday Trading indicator by default.
Concept
Each timeframe (TF) — like 1m, 3m, 5m, etc. — has two EMAs:
A fast EMA (shorter length)
A slow EMA (longer length)
When the fast EMA > slow EMA, that timeframe is bullish.
When the fast EMA < slow EMA, that timeframe is bearish.
By combining multiple timeframes together, the indicator helps you:
Identify when all trends align bullishly (strong buy bias)
Identify when all trends align bearishly (strong sell bias)
Stay out during mixed or sideways phases
Inputs Explained
Setting	Description
1m / 3m / 5m / 15m / 30m / 60m EMA Lengths	Controls the EMA period for each timeframe’s fast and slow EMAs.
Fast EMA Color	Color for all fast EMAs plotted on chart.
Slow EMA Color	Color for all slow EMAs plotted on chart.
Use Smooth Interpolation	Ensures smoother plots when merging higher TF data into a smaller chart (recommended ON).
Show  	Toggle visibility of each timeframe’s EMAs.
Table Position	Lets you move the mini dashboard to any chart corner.
Stack Score
The Stack Score measures how many timeframes are bullish vs bearish:
Stack Score	Meaning
+6	All timeframes bullish → Strong Uptrend
+3 to +5	Majority bullish → Bullish Bias
0	Neutral / Mixed → Sideways Market
−3 to −5	Majority bearish → Bearish Bias
−6	All timeframes bearish → Strong Downtrend
Table Display
At the chosen chart corner, you’ll see:
TF	Direction
1m	🟢 B (Bullish) / 🔴 S (Bearish)
3m	🟢 B (Bullish) / 🔴 S (Bearish)
5m	🟢 B (Bullish) / 🔴 S (Bearish)
15m	🟢 B (Bullish) / 🔴 S (Bearish)
30m	🟢 B (Bullish) / 🔴 S (Bearish)
60m	🟢 B (Bullish) / 🔴 S (Bearish)
Score	Final alignment score (color-coded)
Color meanings:
🟢 Green cell = bullish for that TF
🔴 Red cell = bearish for that TF
The Score cell background color changes with strength:
Bright green → strong bull
Yellow → neutral
Red / Maroon → strong bear
How to Use for Trading (Intraday NIFTY 5m)
Recommended Chart: 5-minute timeframe on NIFTY Futures or major index stocks.
🔹 1. Identify Trend Alignment
When Score ≥ +3 → Market bias is bullish.
→ Look for long entries (buy breakouts or EMA retests).
When Score ≤ −3 → Market bias is bearish.
→ Look for short entries (sell breakdowns or retests).
When Score is between −2 and +2 → Trend is mixed.
→ Best to wait — avoid trading in choppy conditions.
🔹 2. Combine with Price Action
Use it with:
Trendline breaks or retests
Candle confirmation (e.g. bullish engulfing or rejection)
Volume surge
Example:
On NIFTY 5m — if score = +5, price breaks above a descending trendline, and 1m–15m EMAs are all rising → strong long signal.
🔹 3. Avoid Conflicts
If lower timeframes (1m/3m/5m) are bullish but higher ones (30m/60m) are bearish,
→ Trend is short-term bullish but larger bias is down — scalps only, not swings.
Optional Alerts
If you add alert conditions (as suggested earlier):
“Strong Bullish Alignment” triggers when score ≥ +5
“Strong Bearish Alignment” triggers when score ≤ −5
This gives you early alerts when full trend alignment occurs — ideal for breakout setups.
Some more Tips
Use 5m or 15m chart as your main view.
Use Stack Score as a trend filter — trade with it, not against it.
Combine with Breakout + Retest strategy or Trendline color-coded system you’re building.
In sideways days (score near 0), reduce risk or skip trades.
Daily Range Zone This indicator shows the daily range (high to low) for each day.
Every day has its own unique color, making it easy to see each day’s price range at a glance.
チャットGPTimport yfinance as yf
import pandas as pd
import requests
from bs4 import BeautifulSoup
# 株たんのスクリーニング結果URL(例:200日線以下)
url = "https://kabutan.jp/warning/?mode=3_1"
r = requests.get(url)
soup = BeautifulSoup(r.text, "html.parser")
# 銘柄コードと企業名を抽出
stocks =  
for link in soup.select("td a "):
    code = link .split('=') 
    name = link.text.strip()
    if code.isdigit():
        stocks.append({"code": code, "name": name})
results =  
for stock in stocks :  # ←テスト用に10銘柄まで
    ticker = f"{stock }.T"
    df = yf.download(ticker, period="1y", interval="1d")
    # EMA200
    df  = df .ewm(span=200, adjust=False).mean()
    below_ema200 = df .iloc  < df .iloc 
    # 株たんの個別ページからPER・成長率を取得
    stock_url = f"https://kabutan.jp/stock/?code={stock }"
    res = requests.get(stock_url)
    s = BeautifulSoup(res.text, "html.parser")
    try:
        per = s.find(text="PER").find_next("td").text
        growth = s.find(text="売上高増減率").find_next("td").text
    except:
        per, growth = "N/A", "N/A"
    results.append({
        "銘柄コード": stock ,
        "企業名": stock ,
        "200EMA以下": below_ema200,
        "PER": per,
        "売上成長率": growth
    })
# 結果をCSV出力
df_result = pd.DataFrame(results)
df_result.to_csv("割安EMA200以下銘柄.csv", index=False, encoding="utf-8-sig")
print(df_result)
Vwap Daily By SamsungTitle
Daily VWAP with Historical Lookback (Logic Fix)
Description
This script calculates and plots the daily Volume-Weighted Average Price (VWAP), an essential tool for intraday traders.
What makes this indicator special is its robust plotting logic. Unlike many simple VWAP scripts that struggle to show data for previous days, this version includes a crucial fix that allows you to reliably display historical VWAP lines for as many days back as you need. This allows for more comprehensive backtesting and analysis of how price has interacted with the VWAP on previous trading days.
This is an indispensable tool for traders who use VWAP as a dynamic level of support/resistance, a benchmark for trade execution quality, or a gauge of the day's trend.
Key Features
Historical VWAP Display: Easily plot VWAP for multiple past days on your chart. Simply set the number of lookback days in the settings.
Accurate Daily Calculation: The VWAP calculation correctly resets at the beginning of each new trading session (00:00 server time).
Fully Customizable: You have full control over the appearance of the VWAP line, including its color, width, and style (Solid or Stepped).
Robust Plotting Engine: This script solves the common Pine Script issue where conditionally plotted historical lines fail to render. It works reliably on all intraday timeframes.
Built-in Debug Mode: For advanced users or those curious about the inner workings, a comprehensive debug mode can be enabled to display raw VWAP values, cumulative volume, and timeframe warnings.
How to Use
Add the "Daily VWAP with Historical Lookback" indicator to your chart.
IMPORTANT: Make sure you are on an intraday timeframe (e.g., 1H, 30M, 15M, 5M, 1M). This indicator is designed for intraday analysis and will display a warning if used on a daily or higher timeframe.
Open the indicator's settings.
In the "VWAP Settings" tab, adjust the "Lookback Days to Display" to set how many previous days of VWAP you want to see. (e.g., 0 for today only, 1 for today and yesterday, 10 for the last 10 days).
Customize the line's appearance in the "Line Style" tab.
The "Logic Fix" Explained (For Developers)
A common challenge in Pine Script is conditionally plotting data for historical bars. Many scripts attempt this by dynamically changing the plot color to na (transparent) for bars that shouldn't be displayed. This method is often unreliable and can result in the entire plot failing to render.
This script employs a more robust and standard approach: manipulating the data series itself.
The Problem: plot(vwap, color = shouldPlot ? color.red : na) can be buggy.
The Solution: plot(shouldPlot ? vwap : na, color = color.red) is reliable.
Instead of changing the color, we create a new data series (plotVwap). This series contains the vwapValue only on the bars that meet our date criteria. On all other bars, its value is na (Not a Number). The plot() function is designed to handle na values by simply "lifting the pen," creating a clean break in the line. This ensures that the VWAP is drawn only for the selected days, with 100% reliability across all historical data.
Settings Explained
Lookback Days to Display: Sets the number of past days (from the last visible bar) for which to display the VWAP.
Line Color, Width, and Style: Standard cosmetic settings for the VWAP line.
Enable Debug Mode (Master Switch): Toggles all debugging features on or off. It is enabled by default to help new users.
Display Debug: Cumulative Volume: When enabled, it shows the daily cumulative volume in a gray area on a separate pane.
Display Debug: Raw VWAP Value: When enabled, it plots the raw, unfiltered VWAP calculation for all days on the chart, helping to verify the core logic.
This script is provided for educational and informational purposes. Trading involves significant risk. Always conduct your own research and analysis before making any trading decisions.
If you find this script useful, a 'Like' is always appreciated! Happy trading
Multi-TF Gates (Labels + Alerts)//@version=6
indicator("PO9 – Multi-TF Gates (Labels + Alerts)", overlay=true, max_lines_count=500)
iYear=input.int(2024,"Anchor Year",minval=1970)
iMonth=input.int(11,"Anchor Month",minval=1,maxval=12)
iDay=input.int(6,"Anchor Day",minval=1,maxval=31)
useSymbolTZ=input.bool(true,"Use symbol's exchange timezone (syminfo.timezone)")
tzChoice=input.string("Etc/UTC","Custom timezone (if not using symbol TZ)",options= )
anchorType=input.string("FX NY 17:00","Anchor at",options= )
showEvery=input.int(9,"Mark every Nth candle",minval=1)
showD=input.bool(true,"Show Daily")
show3H=input.bool(true,"Show 3H")
show1H=input.bool(true,"Show 1H")
show15=input.bool(true,"Show 15M")
show5=input.bool(false,"Show 5M (optional)")
colD=input.color(color.new(color.red,0),"Daily color")
col3H=input.color(color.new(color.orange,0),"3H color")
col1H=input.color(color.new(color.yellow,0),"1H color")
col15=input.color(color.new(color.teal,0),"15M color")
col5=input.color(color.new(color.gray,0),"5M color")
styStr=input.string("dashed","Line style",options= )
lnW=input.int(2,"Line width",minval=1,maxval=4)
extendTop=input.float(1.5,"ATR multiples above high",minval=0.1)
extendBottom=input.float(1.5,"ATR multiples below low",minval=0.1)
showLabels=input.bool(true,"Show labels")
enableAlerts=input.bool(true,"Enable alerts")
f_style(s)=>s=="solid"?line.style_solid:s=="dashed"?line.style_dashed:line.style_dotted
var lines=array.new_line()
f_prune(maxKeep)=>
    if array.size(lines)>maxKeep
        old=array.shift(lines)
        line.delete(old)
tzEff=useSymbolTZ?syminfo.timezone:tzChoice
anchorTs=anchorType=="FX NY 17:00"?timestamp("America/New_York",iYear,iMonth,iDay,17,0):timestamp(tzEff,iYear,iMonth,iDay,0,0)
atr=ta.atr(14)
f_vline(_color,_tf,_idx)=>
    y1=low-atr*extendBottom
    y2=high+atr*extendTop
    lid=line.new(x1=bar_index,y1=y1,x2=bar_index,y2=y2,xloc=xloc.bar_index,extend=extend.none,color=_color,style=f_style(styStr),width=lnW)
    if showLabels
        label.new(x=bar_index,y=high+(atr*2),text=_tf+" #"+str.tostring(_idx),xloc=xloc.bar_index,style=label.style_label_down,color=_color,textcolor=color.black)
    array.push(lines,lid)
is_tf_open(tf)=> time==request.security(syminfo.tickerid,tf,time,barmerge.gaps_off,barmerge.lookahead_off)
f_tf(_tf,_show,_color,_name)=>
    var bool started=false
    var int idx=0
    isOpen=_show and is_tf_open(_tf)
    firstBar=isOpen and (time>=anchorTs) and (nz(time ,time)
Bitcoin: Price projection from previous cycles onto 2024 cycleAn indicator for displaying the  BITFINEX:BTCUSD  price movement pattern from previous cycles onto the 2024–2025 cycle.
Best checked on Bitfinex or the “Brave New Coin – Bitcoin Liquid Index” (though that one has gone offline).
Next time it should be done with embedded constants rather than by copying candles from previous cycles.
Publishing to share the idea.
negative/possitive day counterSimple script to find how many days were in profit and loss to get the probability edge. only for fundamental analysis
GL
Rank Correlation Index (RCI) Strategy newmy firsht scripy by test only test 
my firsht scripy by test only test 
my firsht scripy by test only test 
onli test 
TimezoneDiffLibLibrary   "TimezoneDiffLib" 
 get_tz_diff(tz1, tz2) 
  Parameters:
     tz1 (string) 
     tz2 (string)
Buy/Sell Zones – TV Style//@version=5
indicator("Buy/Sell Zones – TV Style", overlay=true, timeframe="", timeframe_gaps=true)
//=====================
// الإعدادات
//=====================
len     = input.int(100,  "Length", minval=10)
useATR  = input.bool(true, "Use ATR (بدل الانحراف المعياري)")
mult    = input.float(2.0, "Band Multiplier", step=0.1)
useRSI  = input.bool(true, "تفعيل فلتر RSI")
rsiOB   = input.int(70, "RSI Overbought", minval=50, maxval=90)
rsiOS   = input.int(30, "RSI Oversold",  minval=10, maxval=50)
//=====================
// القناة: أساس + انحراف
//=====================
basis = ta.linreg(close, len, 0)
off   = useATR ? ta.atr(len) * mult : ta.stdev(close, len) * mult
upper = basis + off
lower = basis - off
// نطاق علوي/سفلي بعيد لعمل تعبئة المناطق
lookback      = math.min(bar_index, 500)
topBand       = ta.highest(high, lookback)  + 50 * syminfo.mintick
bottomBand    = ta.lowest(low, lookback)    - 50 * syminfo.mintick
//=====================
// الرسم
//=====================
pUpper   = plot(upper, "Upper", color=color.new(color.blue, 0), linewidth=1)
pLower   = plot(lower, "Lower", color=color.new(color.red,  0), linewidth=1)
pBasis   = plot(basis, "Basis", color=color.new(color.gray, 60), linewidth=2)
// تعبئة المناطق: فوق القناة (أزرق)، تحت القناة (أحمر)
pTop     = plot(topBand,    display=display.none)
pBottom  = plot(bottomBand, display=display.none)
fill(pUpper, pTop,    color=color.new(color.blue, 80))   // منطقة مقاومة/بيع
fill(pBottom, pLower, color=color.new(color.red,  80))   // منطقة دعم/شراء
//=====================
// خط أفقي من قمّة قريبة (يمثل مقاومة) – قريب من الخط المنقّط في الصورة
//=====================
resLen   = math.round(len * 0.6)
dynRes   = ta.highest(high, resLen)
plot(dynRes, "Recent Resistance", color=color.new(color.white, 0), linewidth=1)
//=====================
// إشارات BUY / SELL + فلتر RSI (اختياري)
//=====================
rsi = ta.rsi(close, 14)
touchLower = ta.crossover(close, lower) or close <= lower
touchUpper = ta.crossunder(close, upper) or close >= upper
buyOK  = useRSI ? (touchLower and rsi <= rsiOS) : touchLower
sellOK = useRSI ? (touchUpper and rsi >= rsiOB) : touchUpper
plotshape(buyOK,  title="BUY",  location=location.belowbar, style=shape.labelup,
     text="BUY",  color=color.new(color.green, 0), textcolor=color.white, size=size.tiny, offset=0)
plotshape(sellOK, title="SELL", location=location.abovebar, style=shape.labeldown,
     text="SELL", color=color.new(color.red,   0), textcolor=color.white, size=size.tiny, offset=0)
// تنبيهات
alertcondition(buyOK,  title="BUY",  message="BUY signal: price touched/closed below lower band (RSI filter may apply).")
alertcondition(sellOK, title="SELL", message="SELL signal: price touched/closed above upper band (RSI filter may apply).")
10 EMA + 20 EMA + Previous Day High/Low (Day-Bounded)it gives the reand and also plot the day's lowest volume.it is very helpful in reversals
Mirpapa_Lib_DivergenceLibrary   "Mirpapa_Lib_Divergence" 
다이버전스 감지 및 시각화 라이브러리 (범용 설계)
 newPivot(bar, priceVal, indVal) 
  피벗 포인트 생성
  Parameters:
     bar (int) : 바 인덱스
     priceVal (float) : 가격
     indVal (float) : 지표값
  Returns: PivotPoint
 newDivSettings(pivotLen, maxStore, maxShow) 
  다이버전스 설정 생성
  Parameters:
     pivotLen (int) : 피벗 좌우 캔들
     maxStore (int) : 저장 개수
     maxShow (int) : 표시 라인 개수
  Returns: DivergenceSettings
 emptyDivResult() 
  빈 다이버전스 결과
  Returns: 감지 안 된 DivergenceResult
 checkPivotHigh(length, source) 
  고점 피벗 감지
  Parameters:
     length (int) : 좌우 비교 캔들 수
     source (float) : 비교할 데이터 (지표값)
  Returns: 피벗 값 또는 na
 checkPivotLow(length, source) 
  저점 피벗 감지
  Parameters:
     length (int) : 좌우 비교 캔들 수
     source (float) : 비교할 데이터 (지표값)
  Returns: 피벗 값 또는 na
 addPivotToArray(pivotArray, pivot, maxSize) 
  피벗을 배열에 추가 (FIFO 방식)
  Parameters:
     pivotArray (array) : 피벗 배열
     pivot (PivotPoint) : 추가할 피벗
     maxSize (int) : 최대 크기
 checkBullishDivergence(pivotArray) 
  상승 다이버전스 체크 (Bullish)
  Parameters:
     pivotArray (array) : 저점 피벗 배열
  Returns: DivergenceResult
 checkBearishDivergence(pivotArray) 
  하락 다이버전스 체크 (Bearish)
  Parameters:
     pivotArray (array) : 고점 피벗 배열
  Returns: DivergenceResult
 createDivLine(result, lineColor, isOverlay) 
  다이버전스 라인 생성
  Parameters:
     result (DivergenceResult) : DivergenceResult
     lineColor (color) : 라인 색상
     isOverlay (bool) : true면 가격 기준, false면 지표 기준
  Returns:  
 cleanupLines(lineArray, labelArray, maxLines) 
  오래된 라인/라벨 정리
  Parameters:
     lineArray (array) : 라인 배열
     labelArray (array) : 라벨 배열
     maxLines (int) : 최대 유지 개수
 addLineAndCleanup(lineArray, labelArray, newLine, newLabel, maxLines) 
  라인/라벨 추가 및 자동 정리
  Parameters:
     lineArray (array) : 라인 배열
     labelArray (array) : 라벨 배열
     newLine (line) : 새 라인
     newLabel (label) : 새 라벨
     maxLines (int) : 최대 개수
 PivotPoint 
  피벗 데이터 저장
  Fields:
     barIndex (series int) : 바 인덱스
     price (series float) : 종가
     indicatorValue (series float) : 지표값
 DivergenceSettings 
  다이버전스 설정
  Fields:
     pivotLength (series int) : 피벗 좌우 캔들 수
     maxPivotsStore (series int) : 저장할 최대 피벗 개수
     maxLinesShow (series int) : 표시할 최대 라인 개수
 DivergenceResult 
  다이버전스 감지 결과
  Fields:
     detected (series bool) : 다이버전스 감지 여부
     isBullish (series bool) : true면 상승, false면 하락
     bar1 (series int) : 첫 번째 피벗 바 인덱스
     value1_price (series float) : 첫 번째 가격
     value1_ind (series float) : 첫 번째 지표값
     bar2 (series int) : 두 번째 피벗 바 인덱스
     value2_price (series float) : 두 번째 가격
     value2_ind (series float) : 두 번째 지표값
No-Trade Zones UTC+7This indicator helps you visualize and backtest your preferred trading hours. For example, if you have a 9-to-5 job, you obviously can’t trade during that time — and when backtesting, you should avoid those hours too. It also marks weekends if you prefer not to trade on those days.
By highlighting no-trade periods directly on the chart, you can easily see when you shouldn’t be taking trades, without constantly checking the time or date by hovering over the chart. It makes backtesting smoother and more realistic for your personal schedule.
Mirpapa_Lib_MACDLibrary   "Mirpapa_Lib_MACD" 
MACD 계산 및 크로스 체크를 위한 라이브러리
 calc_smma(src, len) 
  SMMA (Smoothed Moving Average) 계산
  Parameters:
     src (float) : 소스 데이터
     len (simple int) : 길이
  Returns: SMMA 값
 calc_zlema(src, length) 
  ZLEMA (Zero Lag EMA) 계산
  Parameters:
     src (float) : 소스 데이터
     length (simple int) : 길이
  Returns: ZLEMA 값
 checkMacdCross(lengthMA, lengthSignal, src, enabled) 
  MACD 크로스오버 체크
  Parameters:
     lengthMA (simple int) : MACD 길이
     lengthSignal (int) : 시그널 길이
     src (float) : 소스 (기본값: hlc3)
     enabled (bool) : 계산 활성화 여부 (기본값: true)
  Returns: 
LUMAR – ORB 15m + VWAP + EMAs + Asia/London HLThe LUMAR – ORB 15m + VWAP + EMA9/20 + Asia/London HL (NY RTH) indicator combines institutional levels and global session tools for intraday traders.
It automatically plots:
• Opening Range (09:30–09:45 NY) with box and lines
• VWAP & EMAs (9/20) for trend confirmation
• Previous Highs/Lows (Day, Week, Month)
• Asia & London Session High/Lows extended to NY close
Perfect for day traders and scalpers seeking session liquidity zones, structure, and confluence within the New York trading hours.
Created by LuMar Trading — “Where Vision Meets Strength.”
ADX +DI/-DI Confirmation after SuperTrend Signals by ISadx + supertrend confirmation
buy when super trend and adx confirms
sell when supertrend and adx confirms






















