Ehlers Adaptive RSIThe Ehlers Adaptive RSI improves on the traditional RSI by dynamically adjusting its period based on market conditions.
Problem with the Classic RSI:
The traditional Relative Strength Index (RSI) uses a fixed period (e.g., 14), making it slow to react in volatile markets and too sensitive in stable conditions.
How the Adaptive RSI Solves This:
Instead of a fixed period, this version automatically adapts based on market volatility using a combination of ATR (Average True Range) and EMA (Exponential Moving Average).
Key Benefits:
More Responsive – Quickly adapts to market shifts, reducing lag.
Less Noise – Filters out unnecessary fluctuations in stable trends.
Self-Adjusting – No need to manually change RSI settings for different market conditions.
Better Signal Accuracy – Helps detect real trend reversals without false alarms.
This script is for informational and educational purposes only. It does not constitute financial advice, and past performance does not guarantee future results. Use it at your own risk.
Indicadores de amplitud
B.TB.T Trading
You can create simple trading notes by looking at the index, such as changing the active index of an existing index.
For those who have difficulty setting it up on their own,
This is an indicator that can be set to report the set value.
kedo BANAS C5 op3mntini merupakan indikator khusus Binary Option, dengan menggunakan informasi dari candle sinyal diberi tanda bulat putih, dan kemudian panah informasi dari candle sinyal itu buy(biru)/ sell(merah) nya baru dipasang pada candle ke-4 setelah candle sinyal. lakukan open posisi 3 menit setelah panah biru/merah muncul.
pastikan untuk melakukan latihan sebelum menggunakan dana asli anda. semoga sukses.
//@version=5
indicator("Kedo BANAS C5 op3mnt", overlay=true)
// Menghitung body, sumbu atas, dan sumbu bawah
body = math.abs(close - open)
upper_wick = close > open ? high - close : high - open
lower_wick = close > open ? open - low : close - low
// Menentukan apakah candle bullish atau bearish
is_bullish = close > open
is_bearish = close < open
// Definisi tipe candle sinyal
type1 = is_bullish and body > 0 and upper_wick >= 0.51 * body and upper_wick <= 1.00 * body and lower_wick >= 0.10 * body and lower_wick <= 0.50 * body
type2 = is_bullish and body > 0 and lower_wick >= 0.51 * body and lower_wick <= 1.00 * body and upper_wick >= 0.10 * body and upper_wick <= 0.50 * body
type3 = is_bearish and body > 0 and upper_wick >= 0.51 * body and upper_wick <= 1.00 * body and lower_wick >= 0.10 * body and lower_wick <= 0.50 * body
type4 = is_bearish and body > 0 and lower_wick >= 0.51 * body and lower_wick <= 1.00 * body and upper_wick >= 0.10 * body and upper_wick <= 0.50 * body
// Menentukan tipe sinyal: 0 = tidak ada sinyal, 1 = buy, 2 = sell
signal_type = type1 or type4 ? 1 : type2 or type3 ? 2 : 0
// Menampilkan panah putih pada candle sinyal
plotshape(signal_type != 0, title="Signal", location=location.abovebar, color=color.white, style=shape.arrowdown)
// Menampilkan panah buy (biru) atau sell (merah) pada candle ke-4 setelah sinyal
plotshape(signal_type == 1, title="Buy", location=location.belowbar, color=color.blue, style=shape.arrowup)
plotshape(signal_type == 2, title="Sell", location=location.abovebar, color=color.red, style=shape.arrowdown)
// Menghitung SMA 4 dan SMA 13
sma4 = ta.sma(close, 4)
sma13 = ta.sma(close, 13)
// Menampilkan SMA di grafik
plot(sma4, title="SMA 4", color=color.red, linewidth=2)
plot(sma13, title="SMA 13", color=color.yellow, linewidth=2)
Optimized DMA Strategy for Short-Term StocksHere’s a simple explanation of when to enter going long, when to enter going short, when to stop out, and how this trading script works.
When to Enter Going Long (Buy)
The script gives you a green "BUY" signal when:
The price is above a slow-moving line (DMA) and a fast-moving line (EMA).
Momentum is good (not too high, but rising).
Trading volume is higher than usual.
The trend is strong.
The price just broke above yesterday’s high.
Simple Rule: See the green "BUY"? That’s your signal to buy!
When to Enter Going Short (Sell or Short)
The script shows a red "SELL" signal when:
The price is below the slow DMA and fast EMA.
Momentum is bad (not too low, but falling).
Volume is higher than usual.
The trend is strong.
The price just broke below yesterday’s low.
Simple Rule: See the red "SELL"? That’s your signal to sell or short!
When to Stop Out (Get Out)
After Buying (Long):
If the price closes below the fast EMA, you’ll see a gray "X".
That’s your signal to get out.
After Selling (Short):
If the price closes above the fast EMA, you’ll see a gray "X".
That’s your signal to get out.
Simple Rule: Gray "X" means stop and exit, no matter if you’re long or short.
How It Works (Very Simply)
The script is like a traffic light for trading:
Green "BUY" = Go long (buy).
Red "SELL" = Go short (sell).
Gray "X" = Stop (get out).
It uses:
Two lines (slow DMA and fast EMA) to check the price trend.
Momentum tools to make sure the move has energy.
Volume and trend strength to confirm it’s a real move.
A breakout (up for buy, down for sell) to time your entry.
The fast EMA to tell you when the trend flips and it’s time to exit.
It’s built to catch quick, short-term moves and keep you safe with a clear stop.
Summary
Buy: Green "BUY" when price breaks up and everything lines up.
Sell/Short: Red "SELL" when price breaks down and everything lines up.
Stop: Gray "X" when price crosses the fast EMA the wrong way.
It’s a simple checklist that says "go" or "stop" so you can trade fast and smart!
Disclaimer: Grok is not a financial adviser; please consult one. Don't share information that can identify you.
Optimized Short-Term Trading SignalsKey Improvements for 5-Min and 15-Min Timeframes
Faster Indicators:
Reduced MA period to 10 (from 20) for quicker trend detection.
Shortened RSI, MACD (6/13/5 vs. 12/26/9), Stochastic (9/3 vs. 14/3), and Williams %R (9 vs. 14) periods to react faster to price changes.
Tighter Pattern Detection:
Cut pattern_lookback to 10 (from 20) to spot Double Bottoms/Tops in fewer bars.
Adjusted tolerances (e.g., 0.5% for lows/highs, 2% for peaks/troughs) to catch smaller, more frequent patterns on short timeframes.
Stricter Volume Filter:
Added a vol_multiplier (default 1.5) so signals require volume 50% above the 10-period SMA, ensuring stronger moves.
Refined Momentum Conditions:
Buy: RSI > 40 (momentum building) but < 70 (not overbought).
Sell: RSI < 60 (momentum fading) but > 30 (not oversold).
Williams %R thresholds adjusted (-70 for buy, -30 for sell) for faster signals.
Shorter Cooldown:
Reduced cooldown_bars to 3 (from 5) to allow more frequent trades in active markets.
Exit Signals:
Added basic exit signals (orange "X"):
Exit Long: Price drops below MA and MACD histogram turns negative.
Exit Short: Price rises above MA and MACD histogram turns positive.
Helps lock in profits or cut losses in volatile short-term trading.
When to Buy (Go Long) and Short (Sell)
Buy (Go Long)
Trigger: Green "BUY" below the bar.
Meaning: Price is above the 10-period MA, shows a Double Bottom, has rising momentum (RSI, MACD, Stochastic, Williams %R), and volume is 1.5x the average.
Action: Buy, expecting a quick upward move.
Short (Sell)
Trigger: Red "SELL" above the bar.
Meaning: Price is below the 10-period MA, shows a Double Top, has falling momentum, and volume is 1.5x the average.
Action: Short, expecting a quick downward move.
Exit
Exit Long: Orange "X" below the bar—price falls below MA with bearish momentum.
Exit Short: Orange "X" above the bar—price rises above MA with bullish momentum.
Why It’s Better for 5-Min and 15-Min
Speed: Faster indicators and shorter lookbacks catch rapid price shifts.
Precision: Tighter patterns and stricter volume filter out noise.
Flexibility: Exit signals help manage trades in choppy markets.
Adaptability: Works well for day trading or scalping on these timeframes.
Tips
Test It: Backtest on your asset (e.g., stocks, forex, crypto) to fine-tune periods or the volume multiplier.
Risk: Use tight stop-losses (e.g., below recent low for longs, above recent high for shorts).
Context: Pair with support/resistance levels for better entries/exits.
Let me know if you want to tweak it further!
What It Does
This Pine Script indicator overlays signals on your TradingView chart to help you trade:
Green "BUY": Time to buy (go long), expecting the price to rise.
Red "SELL": Time to sell (go short), expecting the price to drop.
Orange "X": Time to exit your trade (close a long or short position).
It uses a mix of trend, momentum, volume, and price patterns to decide these signals.
How It Works
The indicator checks several things to spot good trading opportunities:
Moving Average (MA):
A 10-period average of the closing price (blue line).
Price above MA = uptrend (favor buy).
Price below MA = downtrend (favor sell).
Momentum Indicators:
RSI (9-period): Measures if the price is moving too fast (overbought >70, oversold <30).
MACD (6/13/5): Tracks momentum direction (positive = bullish, negative = bearish).
Stochastic (9/3): Compares price to its recent range (K > D = bullish, K < D = bearish).
Williams %R (9-period): Shows overbought (>-30) or oversold (<-70) conditions.
Volume:
Compares current volume to a 10-period average (multiplied by 1.5).
Signals only trigger if volume is 50% higher than average, showing strong interest.
Price Patterns:
Double Bottom: A "W" shape—two lows close together (within 0.5%) with a higher peak between (2% above lows). Hints at a price rise.
Double Top: An "M" shape—two highs close together (within 0.5%) with a lower dip between (2% below highs). Hints at a price drop.
Cooldown:
Waits 3 bars after any signal (buy, sell, or exit) before showing another. This avoids too many trades in a row.
Exit Logic:
Suggests closing trades when the trend reverses (price crosses MA and momentum shifts).
When to Buy (Go Long)
Trigger: Green "BUY" label appears below the bar.
What It Means:
Price is above the 10-period MA (uptrend).
A Double Bottom pattern forms (bullish signal).
Momentum is rising (RSI > 40 but < 70, MACD positive, Stochastic K > D, Williams %R > -70).
Volume is 1.5x higher than its 10-period average (strong buying).
Action: Buy the asset, expecting the price to go up soon.
Why: The price is showing a reversal or continuation upward with solid momentum and volume.
When to Sell (Go Short)
Trigger: Red "SELL" label appears above the bar.
What It Means:
Price is below the 10-period MA (downtrend).
A Double Top pattern forms (bearish signal).
Momentum is falling (RSI < 60 but > 30, MACD negative, Stochastic K < D, Williams %R < -30).
Volume is 1.5x higher than its 10-period average (strong selling).
Action: Sell or short the asset, expecting the price to drop soon.
Why: The price is showing a reversal or continuation downward with solid momentum and volume.
When to Exit
Exit Long (Close a Buy):
Trigger: Orange "X" below the bar.
What It Means: Price falls below the MA and MACD turns negative (trend and momentum shift bearish).
Action: Sell to take profits or cut losses.
Exit Short (Close a Sell):
Trigger: Orange "X" above the bar.
What It Means: Price rises above the MA and MACD turns positive (trend and momentum shift bullish).
Action: Buy back to cover the short and take profits or cut losses.
Why: These exits help you get out when the trade starts going against you.
Simplified Flow
Buy: Green "BUY" = price is up, "W" shape, strong momentum, big volume.
Sell: Red "SELL" = price is down, "M" shape, weak momentum, big volume.
Exit: Orange "X" = trend flips against your trade.
Why It’s Good for 5-Min and 15-Min
Fast: Uses shorter periods (e.g., 10-bar MA, 9-bar RSI) to catch quick moves.
Precise: Tight patterns and high volume filter out weak signals.
Safe: Exit signals help you avoid holding losers too long.
Tips for Using It
Watch the MA: Stick to buys in uptrends, sells in downtrends.
Set Stops: Place a stop-loss below the recent low (for buys) or above the recent high (for sells).
Test It: Try it on your asset (e.g., BTC, stocks) to see if it fits.
Let me know if you need more details or tweaks!
Disclaimer: this is not a financial adviser; please consult one. Don't share information that can identify you.
Smart Money Concepts [LuxAlgo]Smart money concepts and 4sma + 4 ema
Doing this compressed indicators for people that cant afford premium tradingview and just can use 2 indicators at once
Support & Resistance with RSI BreakoutsThe script is a TradingView Pine Script (v5) indicator that identifies support and resistance levels using RSI (Relative Strength Index) breakouts. Here’s a breakdown of what it does:
Features:
RSI Calculation:
The script calculates the 14-period RSI (default) using the closing price.
The user can modify the RSI period through an input setting.
Buy and Sell Signals:
A buy signal is triggered when RSI drops below 20 (indicating oversold conditions).
A sell signal is triggered when RSI rises above 80 (indicating overbought conditions).
Visual Representation:
Buy signals are marked with a green upward arrow (↑) below the price bars.
Sell signals are marked with a red downward arrow (↓) above the price bars.
The arrows help traders easily spot potential trade opportunities.
Usage:
This script is useful for traders looking to buy at oversold conditions and sell at overbought conditions based on RSI.
It works best when combined with other indicators or price action strategies to confirm signals.
Nasdaq Mega-Cap BreadthThis algo is essentially and advance decline for just the top stocks on the nasdaq - removing all the noise frm companies that do not have much weight behind them
5-Min ORB with Volume SpikeThis indicator identifies Opening Range Breakouts (ORB) based on the high and low of the first 5 minutes of the trading day and confirms the breakout with a volume spike.
🔍 What It Does:
Automatically captures the Opening Range High and Low from 9:30 AM to 9:35 AM (configurable).
Plots green (high) and red (low) lines across the chart once the opening range is set.
Highlights long breakout signals when price breaks above the OR High with above-average volume.
Highlights short breakout signals when price breaks below the OR Low with above-average volume.
Volume confirmation is based on a customizable 20-period simple moving average (SMA) of volume.
⚙️ Best Used On:
5-minute or lower intraday charts (e.g., SPY, QQQ, futures, etc.)
Highly liquid, high-volatility instruments
U.S. equity market open (customizable for other sessions)
📈 Trading Edge: This strategy helps traders identify strong, momentum-driven breakouts early in the trading session — especially when confirmed by increased institutional activity (volume spike).
My Indicatorjust DMA 9/21/50/200 for DAILY moving avarage
u can turn on and OF each DMA 9
u can turn on and OF each DMA21
u can turn on and OF each DMA 50
u can turn on and OF each DMA 200
Optimized DMA Strategy for Short-Term Stocksere’s a simple explanation of when to enter going long, when to enter going short, when to stop out, and how this trading script works.
When to Enter Going Long (Buy)
The script gives you a green "BUY" signal when:
The price is above a slow-moving line (DMA) and a fast-moving line (EMA).
Momentum is good (not too high, but rising).
Trading volume is higher than usual.
The trend is strong.
The price just broke above yesterday’s high.
Simple Rule: See the green "BUY"? That’s your signal to buy!
When to Enter Going Short (Sell or Short)
The script shows a red "SELL" signal when:
The price is below the slow DMA and fast EMA.
Momentum is bad (not too low, but falling).
Volume is higher than usual.
The trend is strong.
The price just broke below yesterday’s low.
Simple Rule: See the red "SELL"? That’s your signal to sell or short!
When to Stop Out (Get Out)
After Buying (Long):
If the price closes below the fast EMA, you’ll see a gray "X".
That’s your signal to get out.
After Selling (Short):
If the price closes above the fast EMA, you’ll see a gray "X".
That’s your signal to get out.
Simple Rule: Gray "X" means stop and exit, no matter if you’re long or short.
How It Works (Very Simply)
The script is like a traffic light for trading:
Green "BUY" = Go long (buy).
Red "SELL" = Go short (sell).
Gray "X" = Stop (get out).
It uses:
Two lines (slow DMA and fast EMA) to check the price trend.
Momentum tools to make sure the move has energy.
Volume and trend strength to confirm it’s a real move.
A breakout (up for buy, down for sell) to time your entry.
The fast EMA to tell you when the trend flips and it’s time to exit.
It’s built to catch quick, short-term moves and keep you safe with a clear stop.
Summary
Buy: Green "BUY" when price breaks up and everything lines up.
Sell/Short: Red "SELL" when price breaks down and everything lines up.
Stop: Gray "X" when price crosses the fast EMA the wrong way.
It’s a simple checklist that says "go" or "stop" so you can trade fast and smart!
Disclaimer: Grok is not a financial adviser; please consult one. Don't share information that can identify you.
MACD Divergence IndicatorMACD Divergence Indicator
Displays deviations in the indicator according to the graph.
Volume Weighted Average Price And 5 EMAVolume Weighted Average Price (VWAP) + Multi-EMA Overlay
Track trends, momentum, and key support/resistance levels with this versatile indicator combining VWAP and multiple EMAs.
Overview
This indicator overlays 5 customizable Exponential Moving Averages (EMAs) and Volume Weighted Average Price (VWAP) with volatility-based bands to help traders:
Identify trend direction and strength
Spot potential support/resistance zones
Gauge market momentum
Make informed entry/exit decisions
Key Features
Multi-Timeframe EMAs
Preconfigured EMAs: 200 (long-term trend), 55 (medium-term), 34, 21, and 8 (short-term)
Adjust lengths via inputs to match your strategy
Smart VWAP with Bands
Customizable anchor periods (Session/Week/Month/Quarter/Year/Earnings/etc)
Bands calculated using Standard Deviation or Percentage modes
Toggle visibility of up to 3 volatility bands
Clean Visualization
Semi-transparent EMA colors for minimal chart clutter
Optional VWAP hiding on daily/wee
kly/monthly timeframes
How to Use
EMAs : Look for bullish/bearish crosses between price and EMAs, or between EMAs themselves
VWAP Bands : Use as dynamic support/resistance or overbought/oversold zones
Combination : Align EMA trends with VWAP position for confluence signals
Settings
Adjust EMA lengths to match your trading style
Modify VWAP anchor period for intraday/swing/position trading
Customize band multipliers and calculation mode
No repainting. Works on all symbols and timeframes.
5-Minute EMA Pre-Cross Alert is a dynamic trading strategy designed to leverage the Exponential Moving Average (EMA) to identify short-term price trends in fast-moving markets. Using two EMAs with different periods (typically a shorter and a longer EMA), the strategy aims to capitalize on crossovers as signals for potential entry and exit points. When the shorter EMA crosses above the longer EMA, it indicates a potential bullish move, while a cross below suggests a bearish trend.
The 5-minute timeframe makes it particularly useful for day traders and scalpers, allowing them to take advantage of quick market shifts. This strategy is ideal for those looking for high-frequency trades with a relatively short holding period, aiming to profit from quick price fluctuations within the market's microstructure.
多维度高级形态脚本脚本名称
多维度高级形态脚本:K线形态+MACD背离+RSI+前高卖点+EMA买点+远离EMA52信号+MACD死叉标识+反转信号+支撑压力线
主要功能
K线形态识别:
识别看涨形态(如反包形态、锤头线)和看跌反转形态(如吞没形态、等实体回撤等)。
结合成交量和趋势过滤,增强信号可靠性。
MACD底背离检测:
检测价格新低但 MACD 指标未创新低的底背离信号,结合 RSI 限制(如 RSI < 40 或 50)确认信号强度。
卖点信号:
基于 RSI 超买(>80)和 MACD 死叉(快线跌破慢线)生成卖点信号。
包含冷却期,避免信号过于频繁。
EMA买点信号:
基于价格突破并站稳 EMA52(52周期指数移动平均线)生成买点信号。
包含多种买点条件(如从下往上突破、阳线紧贴 EMA52 等),并通过冷却期和远离限制优化信号。
远离EMA52信号:
检测价格跌破 EMA52 后的第 2-3 根 K 线,提示可能的回调或反转。
反转信号:
看涨反转:结合大阳线和 2B 反转形态,需在下跌趋势中、EMA52 以下且成交量放大。
看跌反转:检测 EMA20 上方的看跌形态,结合成交量确认。
EMA52触碰信号:
检测价格触碰、击穿或站稳 EMA52 的情况,生成买点信号。
包含从上往下触碰的限制,避免错误信号。
支撑/压力线:
使用 ta.pivothigh 和 ta.pivotlow 检测关键高低点,绘制动态支撑和压力线。
支持用户自定义样式(实线、虚线、点线)、颜色、粗细,以及关键支撑/压力位的标记。
包含价格范围过滤和最大回溯限制,避免图表压缩和 bar index 错误。
其他技术指标:
使用 EMA20 和 EMA52 进行趋势判断。
结合 RSI 和 MACD 提供超买/超卖和趋势反转信号。
成交量分析用于确认信号(如大成交量放大)。
特点
多维度分析:结合 K 线形态、技术指标(MACD、RSI)、均线(EMA)和支撑/压力线,提供全面的交易信号。
用户可调节:提供大量输入参数,允许用户自定义检测周期、颜色、样式、冷却期等。
信号过滤:通过成交量、趋势过滤、K线大小过滤和冷却期机制,减少噪音信号。
可视化:在图表上绘制买点(绿色三角)、卖点(红色三角)、反转信号、支撑/压力线,并提供调试标签。
警报支持:为买入、卖出、远离 EMA52、MACD 死叉、RSI 超买、反转信号等设置了警报条件。
适用场景
适合短线和中线交易者,用于识别趋势反转、支撑/压力位、买卖点。
可应用于多种市场(如股票、加密货币、外汇),尤其在 1 小时图等周期上效果较好。
优化与调试
包含冷却期和信号过滤机制,避免频繁信号。
提供调试标签,显示关键变量(如 EMA52 触碰状态、K 线大小等),便于用户优化参数。
这个脚本是一个功能强大且灵活的交易工具,适合有一定技术分析基础的交易者使用。
DIY Entry Signals//@version=5
//
// Author: benso87
//
// Credit to:
// The_Caretaker for BBWP and PMARP indicators
//
indicator(title='DIY Entry Signals', shorttitle='DIY Signals', format=format.price, precision=2, timeframe='', timeframe_gaps=true, overlay=true, max_bars_back=500)
noColor = color.new(color.white, transp=100)
//////////////////////////////////////////////////////////////
// Inputs
// Signal Types
includeLong = input.bool (true, title='Long', inline='1', group='Signal Types')
includeShort = input.bool (true, title='Short', inline='2', group='Signal Types')
onlyConfirmed = input.bool (true, title='Only Confirmed Candles', inline='3', group='Signal Types')
useSigCheck = input.bool (false, title='No More Signals For # Bars', inline='5', group='Signal Types')
sigCheckBars = input.int (10, title='', minval=1, maxval=50, inline='5', group='Signal Types')
plotType = input.string ('Shape', title='Signal Marker', options= , group='Signal Types')
barColorLong = input.color (#0bff00, title='Long Bar Color', group='Signal Types')
barColorShort = input.color (#ff0014, title='Short Bar Color', group='Signal Types')
// Price
priceSource = input.source(close, title='Price Source', group='Price')
// Volume
vMaLength = input.int (20, title='MA Length', minval=1, group='Volume')
vMaType = input.string ('SMA', title='MA Type', options= , group='Volume')
vMult = input.float (1.5, title='Multiplier', minval=0, group='Volume', tooltip='Volume needs to be above this much times the previous volume bar to trigger a signal.')
// Moving Averages
maSource = input.source (close, title='Source', inline='source', group='Moving Averages')
includeMA1 = input.bool (false, title='', inline='MA 1', group='Moving Averages')
ma1Color = input.color (#ffeb3b, title='MA 1', inline='MA 1', group='Moving Averages')
ma1Length = input.int (21, title='Length', minval=1, inline='MA 1', group='Moving Averages')
ma1Type = input.string ('EMA', title='Type', options= , inline='MA 1', group='Moving Averages')
includeMA2 = input.bool (false, title='', inline='MA 2', group='Moving Averages')
ma2Color = input.color (#00e676, title='MA 2', inline='MA 2', group='Moving Averages')
ma2Length = input.int (55, title='Length', minval=1, inline='MA 2', group='Moving Averages')
ma2Type = input.string ('EMA', title='Type', options= , inline='MA 2', group='Moving Averages')
includeMA3 = input.bool (false, title='', inline='MA 3', group='Moving Averages')
ma3Color = input.color (#00bcd4, title='MA 3', inline='MA 3', group='Moving Averages')
ma3Length = input.int (100, title='Length', minval=1, inline='MA 3', group='Moving Averages')
ma3Type = input.string ('EMA', title='Type', options= , inline='MA 3', group='Moving Averages')
includeMA4 = input.bool (false, title='', inline='MA 4', group='Moving Averages')
ma4Color = input.color (#e040fb, title='MA 4', inline='MA 4', group='Moving Averages')
ma4Length = input.int (200, title='Length', minval=1, inline='MA 4', group='Moving Averages')
ma4Type = input.string ('EMA', title='Type', options= , inline='MA 4', group='Moving Averages')
includeMA5 = input.bool (false, title='', inline='MA 5', group='Moving Averages')
ma5Color = input.color (color.red, title='MA 5', inline='MA 5', group='Moving Averages')
ma5Length = input.int (300, title='Length', minval=1, inline='MA 5', group='Moving Averages')
ma5Type = input.string ('EMA', title='Type', options= , inline='MA 5', group='Moving Averages')
includeMA6 = input.bool (false, title='', inline='MA 6', group='Moving Averages')
ma6Color = input.color (color.blue, title='MA 6', inline='MA 6', group='Moving Averages')
ma6Length = input.int (400, title='Length', minval=1, inline='MA 6', group='Moving Averages')
ma6Type = input.string ('EMA', title='Type', options= , inline='MA 6', group='Moving Averages')
includeMA7 = input.bool (false, title='', inline='MA 7', group='Moving Averages')
ma7Color = input.color (color.white, title='MA 7', inline='MA 7', group='Moving Averages')
ma7Length = input.int (500, title='Length', minval=1, inline='MA 7', group='Moving Averages')
ma7Type = input.string ('EMA', title='Type', options= , inline='MA 7', group='Moving Averages')
includeMA8 = input.bool (false, title='', inline='MA 8', group='Moving Averages')
ma8Color = input.color (color.orange, title='MA 8', inline='MA 8', group='Moving Averages')
ma8Length = input.int (600, title='Length', minval=1, inline='MA 8', group='Moving Averages')
ma8Type = input.string ('EMA', title='Type', options= , inline='MA 8', group='Moving Averages')
// Moving Average Crosses
maCrosses = input.bool (false, title='Highlight moving average crosses', group='Moving Average Crosses', inline='1')
useCross1 = input.bool (false, title='Pair 1', group='Moving Average Crosses', inline='pair1')
cross1Color1 = input.color (color.new(color.silver, transp=50), title='', group='Moving Average Crosses', inline='pair1')
cross1Color2 = input.color (color.new(color.purple, transp=50), title='', group='Moving Average Crosses', inline='pair1')
cross1ma1Str = input.string ('MA 1', title='', options= , group='Moving Average Crosses', inline='pair1')
cross1ma2Str = input.string ('MA 2', title='', options= , group='Moving Average Crosses', inline='pair1')
useCross2 = input.bool (false, title='Pair 2', group='Moving Average Crosses', inline='pair2')
cross2Color1 = input.color (color.new(color.yellow, transp=50), title='', group='Moving Average Crosses', inline='pair2')
cross2Color2 = input.color (color.new(color.red, transp=50), title='', group='Moving Average Crosses', inline='pair2')
cross2ma1Str = input.string ('MA 2', title='', options= , group='Moving Average Crosses', inline='pair2')
cross2ma2Str = input.string ('MA 4', title='', options= , group='Moving Average Crosses', inline='pair2')
useCross3 = input.bool (false, title='Pair 3', group='Moving Average Crosses', inline='pair3')
cross3Color1 = input.color (color.new(color.blue, transp=50), title='', group='Moving Average Crosses', inline='pair3')
cross3Color2 = input.color (color.new(color.orange, transp=50), title='', group='Moving Average Crosses', inline='pair3')
cross3ma1Str = input.string ('MA 3', title='', options= , group='Moving Average Crosses', inline='pair3')
cross3ma2Str = input.string ('MA 4', title='', options= , group='Moving Average Crosses', inline='pair3')
// RSI
rsiSource = input.source (close, title='Source', group='RSI')
rsiPeriod = input.int (14, minval=1, title='RSI Period', group='RSI')
// Stochastic
stochSource = input.source (close, title='Source', group='Stochastic')
periodK = input.int (14, title='K Length', minval=1, group='Stochastic')
smoothK = input.int (3, title='K Smoothing', minval=1, group='Stochastic')
periodD = input.int (3, title='D Smoothing', minval=1, group='Stochastic')
kdSig = input.bool (false, title='K & D', group='Stochastic', tooltip='Turn this on to only signal when both K and D are in the selected range.')
// Stoch RSI
srsiSmoothK = input.int (3, title='K', minval=1, group='Stochastic RSI')
srsiSmoothD = input.int (3, title='D', minval=1, group='Stochastic RSI')
srsiLength = input.int (14, title='Stoch Length', minval=1, group='Stochastic RSI')
srsiKDSig = input.bool (false, title='K & D', group='Stochastic RSI', tooltip='Turn this on to only signal when both K and D are in the selected range.')
srsiOwnRSI = input.bool (false, title='Use Separate RSI', group='Stochastic RSI', tooltip='If unchecked, use RSI from the RSI section. If checked, use RSI settings in this section')
srsiSource = input.source (close, title='RSI Source for Stoch RSI', group='Stochastic RSI', tooltip='Only used if "Use Seaprate RSI" is checked.')
srsiPeriod = input.int (14, title='RSI Length for Stoch RSI', group='Stochastic RSI', tooltip='Only used if "Use Seaprate RSI" is checked.')
// Bollinger Bands
bbSource = input.source (close, title='Source', group='Bollinger Bands')
bbLength = input.int (20, minval=1, group='Bollinger Bands')
bbMult = input.float (2.0, minval=0.001, maxval=50, title="StdDev", group='Bollinger Bands')
bbBiasMAStr = input.string ('MA 4', title='Moving Average for Bias', options= , group='Bollinger Bands', tooltip='Bias is determined by the BB midline being above or below the chosen moving average.')
plotBB = input.bool (false, title='Plot', group='Bollinger Bands')
bbFill = input.color (noColor, title='Fill Color', group='Bollinger Bands')
biasFill = input.bool (false, title='Color Based on Bias', group='Bollinger Bands')
longFill = input.color (color.new(color.green, transp=80), title='Long Bias', group='Bollinger Bands')
shortFill = input.color (color.new(color.red, transp=80), title='Short Bias', group='Bollinger Bands')
// BBWP
bbwpPriceSource = input.source (close, title='Source', inline='1', group='BBWP')
bbwpBasisType = input.string ('SMA', title='Basis Type', options= , inline='1', group='BBWP')
bbwpLength = input.int (13, title='Length', minval=1, inline='2', group='BBWP')
bbwpLookback = input.int (252, title='Lookback', minval=1, inline='2', group='BBWP')
bbwpMaType = input.string ('SMA', 'MA Type', options= , inline='3', group='BBWP')
bbwpMaLength = input.int (5, 'MA Length', minval=1, inline='3', group='BBWP')
// PMARP
pmarpSource = input.source (close, title='Source', inline='1', group='PMARP')
pmarpLookback = input.int (350, title='Lookback', minval=1, maxval=1900, inline='1', group='PMARP')
pmarpLength = input.int (20, title='PMAR Length', minval=1, inline='2', group='PMARP')
pmarpMAType = input.string ('VWMA', title='MA Type', options= , inline='2', group='PMARP')
pmarpSigMAType = input.string ('SMA', title='Signal MA Type', options= , inline='3', group='PMARP')
pmarpSigLength = input.int (20, title='PMAR SignalLength', minval=1, inline='3', group='PMARP')
// ADX/DMI
adxLength = input.int(14, title="ADX Length", group='ADX/DMI')
diLength = input.int(14, title="DI Length", group='ADX/DMI')
// VWAP
vwapPlot = input.bool(false, title='Plot VWAP', group='VWAP')
hideonDWM = input.bool(false, title="Hide VWAP on 1D or Above", group="VWAP")
anchor = input.string(defval = 'Session', title='Anchor Period', options= , group='VWAP')
vwapSrc = input.source(hlc3, title='Source', group='VWAP')
vwapColor = input.color(color.blue, title='Color', group='VWAP')
vwapWidth = input.int(2, title='Line Width', minval=1, maxval=4, group='VWAP')
vwapOffset = input.int(0, title='Offset', group='VWAP')
vwapShowBands = input.bool(false, title='Calculate Bands', group='VWAP')
vwapStDev = input.float(1, title='Bands Multiplier', group='VWAP')
// Days Off
useOffDays = input.bool (false, title='Days Off', group='Days Off')
offSun = input.bool (true, title='Sunday', group='Days Off')
offMon = input.bool (false, title='Monday', group='Days Off')
offTue = input.bool (false, title='Tuesday', group='Days Off')
offWed = input.bool (false, title='Wednesday', group='Days Off')
offThur = input.bool (false, title='Thursday', group='Days Off')
offFri = input.bool (false, title='Friday', group='Days Off')
offSat = input.bool (true, title='Saturday', group='Days Off')
// Time Off
useTimeOff = input.bool (false, title='Time Off', group='Time Off')
timeOffRange = input.session ('0500-1300', title='Time Off', group='Time Off')
// Long Conditions
usePriceAbMaLong = input.bool (false, title='Price Above', inline='price1', group='Long Conditions')
priceAbMaLongStr = input.string ('MA 1', title='', options= , inline='price1', group='Long Conditions')
usePriceBlMaLong = input.bool (false, title='Price Below', inline='price2', group='Long Conditions')
priceBlMaLongStr = input.string ('MA 1', title='', options= , inline='price2', group='Long Conditions')
useVolumeLong = input.bool (false, title='Volume', inline='volume1', group='Long Conditions')
volumeAboveLong = input.string ('Both', title='Above', options= , inline='volume1', group='Long Conditions', tooltip='See volume section for criteria used here.')
i_ma1Above2 = input.bool (false, title='MA 1 > MA 2', inline='ma above 1', group='Long Conditions')
i_ma2Above3 = input.bool (false, title='MA 2 > MA 3', inline='ma above 2', group='Long Conditions')
i_ma3Above4 = input.bool (false, title='MA 3 > MA 4', inline='ma above 3', group='Long Conditions')
i_ma4Above5 = input.bool (false, title='MA 4 > MA 5', inline='ma above 4', group='Long Conditions')
i_ma5Above6 = input.bool (false, title='MA 5 > MA 6', inline='ma above 5', group='Long Conditions')
i_ma6Above7 = input.bool (false, title='MA 6 > MA 7', inline='ma above 6', group='Long Conditions')
i_ma7Above8 = input.bool (false, title='MA 7 > MA 8', inline='ma above 7', group='Long Conditions')
useCross1UpLong = input.bool (false, title='Price Cross Up: MA 1', inline='cross up', group='Long Conditions')
useCross2UpLong = input.bool (false, title='MA 2', inline='cross up', group='Long Conditions')
useCross3UpLong = input.bool (false, title='MA 3', inline='cross up', group='Long Conditions')
useCross4UpLong = input.bool (false, title='MA 4', inline='cross up', group='Long Conditions')
useCross5UpLong = input.bool (false, title='MA 5', inline='cross up', group='Long Conditions')
useCross6UpLong = input.bool (false, title='MA 6', inline='cross up', group='Long Conditions')
useCross7UpLong = input.bool (false, title='MA 7', inline='cross up', group='Long Conditions')
useCross8UpLong = input.bool (false, title='MA 8', inline='cross up', group='Long Conditions')
useCross1DnLong = input.bool (false, title='Price Cross Down: MA 1', inline='cross dn', group='Long Conditions')
useCross2DnLong = input.bool (false, title='MA 2', inline='cross dn', group='Long Conditions')
useCross3DnLong = input.bool (false, title='MA 3', inline='cross dn', group='Long Conditions')
useCross4DnLong = input.bool (false, title='MA 4', inline='cross dn', group='Long Conditions')
useCross5DnLong = input.bool (false, title='MA 5', inline='cross dn', group='Long Conditions')
useCross6DnLong = input.bool (false, title='MA 6', inline='cross dn', group='Long Conditions')
useCross7DnLong = input.bool (false, title='MA 7', inline='cross dn', group='Long Conditions')
useCross8DnLong = input.bool (false, title='MA 8', inline='cross dn', group='Long Conditions')
useMATestLong = input.bool (false, title='MA Test (beta)', inline='ma test', group='Long Conditions', tooltip='Experimental. This will check to see if the candle touches the moving average and closes above it, or if the previous candle opened above and closed below, and the signal candle closes back above.')
i_maTestedLong = input.string ('MA 1', title='', options= , inline='ma test', group='Long Conditions')
includeRSILong = input.bool (false, title='RSI', inline='rsi', group='Long Conditions')
rsiLowLong = input.float (38, title='Above', inline='rsi', group='Long Conditions')
rsiHighLong = input.float (62, title='Below', inline='rsi', group='Long Conditions')
useRsiCrossLong = input.bool (false, title='RSI cross', inline='rsi cross', group='Long Conditions')
rsiCrossDirLong = input.string ('Above', title='', options= , inline='rsi cross', group='Long Conditions')
rsiCrossLevelLong = input.float (50, title='', minval=0, maxval=100, inline='rsi cross', group='Long Conditions')
includeStochLong = input.bool (false, title='Stoch', inline='stoch', group='Long Conditions')
stochKAboveD = input.bool (false, title='K > D', inline='stoch', group='Long Conditions')
useStochRangeLong = input.bool (false, title='Stoch In Range?',inline='stoch 2', group='Long Conditions')
stochLowLong = input.float (20, title='Low', inline='stoch 2', group='Long Conditions')
stochHighLong = input.float (80, title='High', inline='stoch 2', group='Long Conditions')
includeSRSILong = input.bool (false, title='Stoch RSI', inline='srsi', group='Long Conditions')
srsiLowLong = input.float (0, title='Low', minval=0, maxval=100, inline='srsi', group='Long Conditions')
srsiHighLong = input.float (10, title='High', minval=0, maxval=100, inline='srsi', group='Long Conditions')
includeBBLong = input.bool (false, title='Bollinger Bands', inline='bb', group='Long Conditions')
includBBBiasLong = input.bool (false, title='Bias', inline='bb', group='Long Conditions', tooltip='Signal only if the BB midline is above the chose moving average.')
includeBBTestLong = input.bool (false, title='Test Lower (Experimental)', inline='bb', group='Long Conditions', tooltip='Signal only on a test of the lower band.')
includeBBRLong = input.bool (false, title='BB%B', inline='bb2', group='Long Conditions')
bbrDirLong = input.string ('Below', title='', options= , inline='bb2', group='Long Conditions')
bbrLevelLong = input.float (0.1, title='', minval=-1, maxval=2, inline='bb2', group='Long Conditions')
includeBBWPLong = input.bool (false, title='BBWP', inline='bbwp', group='Long Conditions')
bbwpMinLong = input.float (0, title='Min', minval=0, maxval=100, step=0.01, inline='bbwp', group='Long Conditions')
bbwpMaxLong = input.float (35, title='Max', minval=0, maxval=100, step=0.01, inline='bbwp', group='Long Conditions')
includeBBWPMaDLong = input.bool (false, title='BBWP MA Direction', inline='bbwpMa', group='Long Conditions')
bbwpMaDLong = input.string ('Down', title='', options= , inline='bbwpMa', group='Long Conditions')
includePMARPLong = input.bool (false, title='PMARP', inline='pmarp', group='Long Conditions')
pmarpLongAB = input.string ('Below', title='', options= , inline='pmarp', group='Long Conditions')
pmarpThresholdLong = input.float (15, title='', inline='pmarp', group='Long Conditions')
usePmarpCrossMaLong = input.bool (false, title='PMARP Crossing MA', inline='pmarp2', group='Long Conditions')
pmarpCrossDirLong = input.string ('Up', title='', options= , inline='pmarp2', group='Long Conditions')
useDMILong = input.bool (false, title='DMI', inline='dmi', group='Long Conditions')
dmiPNLong = input.string ('Positive', title='', options= , inline='dmi', group='Long Conditions')
dmiABLong = input.string ('Above', title='DMI', options= , inline='dmi 2', group='Long Conditions')
dmiThresholdLong = input.float (20, title='', inline='dmi 2', tooltip='DMI level to be below or above for "Custom" option', group='Long Conditions')
dmiFlipLong = input.bool (false, title='Only on flip', inline='dmi 3', group='Long Conditions', tooltip='Signal only on the bar where the DMI flip occurs.')
useADXLong = input.bool (false, title='ADX Range', inline='adx', group='Long Conditions')
adxABLong = input.string ('Below', title='', options= , inline='adx', group='Long Conditions')
adxThresholdLong = input.float (20, title='', inline='adx', group='Long Conditions')
useADXDirLong = input.bool (false, title='ADX Direction', inline='adx 2', group='Long Conditions')
adxDirLong = input.string ('Rising', title='', options= , inline='adx 2', group='Long Conditions')
useVwapLong = input.bool (false, title='VWAP', inline='vwap', group='Long Conditions')
vwapABLong = input.string ('Below', title='', options= , inline='vwap', group='Long Conditions')
vwapLevelLong = input.string ('VWAP', title='', options= , inline='vwap', group='Long Conditions')
// Short Conditions
usePriceAbMaShort = input.bool (false, title='Price Above', inline='price1', group='Short Conditions')
priceAbMaShortStr = input.string ('MA 1', title='', options= , inline='price1', group='Short Conditions')
usePriceBlMaShort = input.bool (false, title='Price Below', inline='price2', group='Short Conditions')
priceBlMaShortStr = input.string ('MA 1', title='', options= , inline='price2', group='Short Conditions')
useVolumeShort = input.bool (false, title='Volume', inline='volume1', group='Short Conditions')
volumeAboveShort = input.string ('Both', title='Above', options= , inline='volume1', group='Short Conditions', tooltip='See volume section for criteria used here.')
i_ma1Below2 = input.bool (false, title='MA 1 < MA 2', inline='ma below 1', group='Short Conditions')
i_ma2Below3 = input.bool (false, title='MA 2 < MA 3', inline='ma below 2', group='Short Conditions')
i_ma3Below4 = input.bool (false, title='MA 3 < MA 4', inline='ma below 3', group='Short Conditions')
i_ma4Below5 = input.bool (false, title='MA 4 < MA 5', inline='ma below 4', group='Short Conditions')
i_ma5Below6 = input.bool (false, title='MA 5 < MA 6', inline='ma below 5', group='Short Conditions')
i_ma6Below7 = input.bool (false, title='MA 6 < MA 7', inline='ma below 6', group='Short Conditions')
i_ma7Below8 = input.bool (false, title='MA 7 < MA 8', inline='ma below 7', group='Short Conditions')
useCross1UpShort = input.bool (false, title='Price Cross Up: MA 1', inline='cross up', group='Short Conditions')
useCross2UpShort = input.bool (false, title='MA 2', inline='cross up', group='Short Conditions')
useCross3UpShort = input.bool (false, title='MA 3', inline='cross up', group='Short Conditions')
useCross4UpShort = input.bool (false, title='MA 4', inline='cross up', group='Short Conditions')
useCross5UpShort = input.bool (false, title='MA 5', inline='cross up', group='Short Conditions')
useCross6UpShort = input.bool (false, title='MA 6', inline='cross up', group='Short Conditions')
useCross7UpShort = input.bool (false, title='MA 7', inline='cross up', group='Short Conditions')
useCross8UpShort = input.bool (false, title='MA 8', inline='cross up', group='Short Conditions')
useCross1DnShort = input.bool (false, title='Price Cross Down: MA 1', inline='cross dn', group='Short Conditions')
useCross2DnShort = input.bool (false, title='MA 2', inline='cross dn', group='Short Conditions')
useCross3DnShort = input.bool (false, title='MA 3', inline='cross dn', group='Short Conditions')
useCross4DnShort = input.bool (false, title='MA 4', inline='cross dn', group='Short Conditions')
useCross5DnShort = input.bool (false, title='MA 5', inline='cross dn', group='Short Conditions')
useCross6DnShort = input.bool (false, title='MA 6', inline='cross dn', group='Short Conditions')
useCross7DnShort = input.bool (false, title='MA 7', inline='cross dn', group='Short Conditions')
useCross8DnShort = input.bool (false, title='MA 8', inline='cross dn', group='Short Conditions')
useMATestShort = input.bool (false, title='MA Test (beta)', inline='ma test', group='Short Conditions', tooltip='Experimental. This will check to see if the candle touches the moving average and closes below it, or if the previous candle opened below and closed above, and the signal candle closes back below.')
i_maTestedShort = input.string ('MA 1', title='', options= , inline='ma test', group='Short Conditions')
includeRSIShort = input.bool (false, title='RSI', inline='rsi', group='Short Conditions')
rsiLowShort = input.float (38, title='Above', inline='rsi', group='Short Conditions')
rsiHighShort = input.float (62, title='Below', inline='rsi', group='Short Conditions')
useRsiCrossShort = input.bool (false, title='RSI cross', inline='rsi cross', group='Short Conditions')
rsiCrossDirShort = input.string ('Below', title='', options= , inline='rsi cross', group='Short Conditions')
rsiCrossLevelShort = input.float (50, title='', minval=0, maxval=100, inline='rsi cross', group='Short Conditions')
includeStochShort = input.bool (false, title='Stoch', inline='stoch', group='Short Conditions')
stochKBelowD = input.bool (false, title='K < D', inline='stoch', group='Short Conditions')
useStochRangeShort = input.bool (false, title='Stoch In Range?',inline='stoch 2', group='Short Conditions')
stochLowShort = input.float (20, title='Low', inline='stoch 2', group='Short Conditions')
stochHighShort = input.float (80, title='High', inline='stoch 2', group='Short Conditions')
includeSRSIShort = input.bool (false, title='Stoch RSI', inline='srsi', group='Short Conditions')
srsiLowShort = input.float (90, title='Low', minval=0, maxval=100, inline='srsi', group='Short Conditions')
srsiHighShort = input.float (100, title='High', minval=0, maxval=100, inline='srsi', group='Short Conditions')
includeBBShort = input.bool (false, title='Bollinger Bands', inline='bb', group='Short Conditions')
includBBBiasShort = input.bool (false, title='Bias', inline='bb', group='Short Conditions', tooltip='Signal only if the BB midline is below the chosen moving average.')
includeBBTestShort = input.bool (false, title='Test Upper (Experimental)', inline='bb', group='Short Conditions', tooltip='Signal only on a test of the upper band.')
includeBBRShort = input.bool (false, title='BB%B', inline='bb2', group='Short Conditions')
bbrDirShort = input.string ('Above', title='', options= , inline='bb2', group='Short Conditions')
bbrLevelShort = input.float (0.9, title='', minval=-1, maxval=2, inline='bb2', group='Short Conditions')
includeBBWPShort = input.bool (false, title='BBWP', inline='bbwp', group='Short Conditions')
bbwpMinShort = input.float (0, title='Min', minval=0, maxval=100, step=0.01, inline='bbwp', group='Short Conditions')
bbwpMaxShort = input.float (35, title='Max', minval=0, maxval=100, step=0.01, inline='bbwp', group='Short Conditions')
includeBBWPMaDShort = input.bool (false, title='BBWP MA Direction', inline='bbwpMa', group='Short Conditions')
bbwpMaDShort = input.string ('Down', title='', options= , inline='bbwpMa', group='Short Conditions')
includePMARPShort = input.bool (false, title='PMARP', inline='pmarp', group='Short Conditions')
pmarpShortAB = input.string ('Above', title='', options= , inline='pmarp', group='Short Conditions')
pmarpThresholdShort = input.float (85, title='', inline='pmarp', group='Short Conditions')
usePmarpCrossMaShort= input.bool (false, title='PMARP Crossing MA', inline='pmarp2', group='Short Conditions')
pmarpCrossDirShort = input.string ('Down', title='', options= , inline='pmarp2', group='Short Conditions')
useDMIShort = input.bool (false, title='DMI', inline='dmi', group='Short Conditions')
dmiPNShort = input.string ('Positive', title='', options= , inline='dmi', group='Short Conditions')
dmiABShort = input.string ('Above', title='DMI', options= , inline='dmi 2', group='Short Conditions')
dmiThresholdShort = input.float (-20, title='', inline='dmi 2', tooltip='DMI level to be below or above for "Custom" option', group='Short Conditions')
dmiFlipShort = input.bool (false, title='Only on flip', inline='dmi 3', group='Short Conditions', tooltip='Signal only on the bar where the DMI flip occurs.')
useADXShort = input.bool (false, title='ADX Range', inline='adx', group='Short Conditions')
adxABShort = input.string ('Below', title='', options= , inline='adx', group='Short Conditions')
adxThresholdShort = input.float (20, title='', inline='adx', group='Short Conditions')
useADXDirShort = input.bool (false, title='ADX Direction', inline='adx 2', group='Short Conditions')
adxDirShort = input.string ('Rising', title='', options= , inline='adx 2', group='Short Conditions')
useVwapShort = input.bool (false, title='VWAP', inline='vwap', group='Short Conditions')
vwapABShort = input.string ('Above', title='', options= , inline='vwap', group='Short Conditions')
vwapLevelShort = input.string ('VWAP', title='', options= , inline='vwap', group='Short Conditions')
//////////////////////////////////////////////////////////////
// Calculations
// Function to calculate moving averages based on chosen type
f_ma(source, length, type) =>
switch type
'SMA' => ta.sma(source, length)
'EMA' => ta.ema(source, length)
'RMA' => ta.rma(source, length)
'WMA' => ta.wma(source, length)
// volume
vMa = f_ma(volume, vMaLength, vMaType)
vAboveMa = volume > vMa
vAboveMult = volume >= volume * vMult
vAboveBoth = vAboveMa and vAboveMult
vAboveLong = volumeAboveLong == 'MA' ? vAboveMa : volumeAboveLong == 'Mult' ? vAboveMult : vAboveBoth
vAboveShort = volumeAboveShort == 'MA' ? vAboveMa : volumeAboveShort == 'Mult' ? vAboveMult : vAboveBoth
// Moving Averages
ma1 = f_ma(maSource, ma1Length, ma1Type)
ma2 = f_ma(maSource, ma2Length, ma2Type)
ma3 = f_ma(maSource, ma3Length, ma3Type)
ma4 = f_ma(maSource, ma4Length, ma4Type)
ma5 = f_ma(maSource, ma5Length, ma5Type)
ma6 = f_ma(maSource, ma6Length, ma6Type)
ma7 = f_ma(maSource, ma7Length, ma7Type)
ma8 = f_ma(maSource, ma8Length, ma8Type)
// Function to convert chosen MA to MA series
f_convertMA (ma) =>
switch ma
'MA 1' => ma1
'MA 2' => ma2
'MA 3' => ma3
'MA 4' => ma4
'MA 5' => ma5
'MA 6' => ma6
'MA 7' => ma7
'MA 8' => ma8
ma1Above2 = ma1 > ma2
ma1Above3 = ma1 > ma3
ma1Above4 = ma1 > ma4
ma1Above5 = ma1 > ma5
ma1Above6 = ma1 > ma6
ma1Above7 = ma1 > ma7
ma1Above8 = ma1 > ma8
ma2Above1 = ma2 > ma1
ma2Above3 = ma2 > ma3
ma2Above4 = ma2 > ma4
ma2Above5 = ma2 > ma5
ma2Above6 = ma2 > ma6
ma2Above7 = ma2 > ma7
ma2Above8 = ma2 > ma8
ma3Above1 = ma3 > ma1
ma3Above2 = ma3 > ma2
ma3Above4 = ma3 > ma4
ma3Above5 = ma3 > ma5
ma3Above6 = ma3 > ma6
ma3Above7 = ma3 > ma7
ma3Above8 = ma3 > ma8
ma4Above1 = ma4 > ma1
ma4Above2 = ma4 > ma2
ma4Above3 = ma4 > ma3
ma4Above5 = ma4 > ma5
ma4Above6 = ma4 > ma6
ma4Above7 = ma4 > ma7
ma4Above8 = ma4 > ma8
ma5Above1 = ma5 > ma1
ma5Above2 = ma5 > ma2
ma5Above3 = ma5 > ma3
ma5Above4 = ma5 > ma4
ma5Above6 = ma5 > ma6
ma5Above7 = ma5 > ma7
ma5Above8 = ma5 > ma8
ma6Above1 = ma6 > ma1
ma6Above2 = ma6 > ma2
ma6Above3 = ma6 > ma3
ma6Above4 = ma6 > ma4
ma6Above5 = ma6 > ma5
ma6Above7 = ma6 > ma7
ma6Above8 = ma6 > ma8
ma7Above1 = ma7 > ma1
ma7Above2 = ma7 > ma2
ma7Above3 = ma7 > ma3
ma7Above4 = ma7 > ma4
ma7Above5 = ma7 > ma5
ma7Above6 = ma7 > ma6
ma7Above8 = ma7 > ma8
ma8Above1 = ma8 > ma1
ma8Above2 = ma8 > ma2
ma8Above3 = ma8 > ma3
ma8Above4 = ma8 > ma4
ma8Above5 = ma8 > ma5
ma8Above6 = ma8 > ma6
ma8Above7 = ma8 > ma7
// Price crossing moving average checks
pCrossUp1 = ta.crossover(close, ma1)
pCrossUp2 = ta.crossover(close, ma2)
pCrossUp3 = ta.crossover(close, ma3)
pCrossUp4 = ta.crossover(close, ma4)
pCrossUp5 = ta.crossover(close, ma5)
pCrossUp6 = ta.crossover(close, ma6)
pCrossUp7 = ta.crossover(close, ma7)
pCrossUp8 = ta.crossover(close, ma8)
pCrossDn1 = ta.crossunder(close, ma1)
pCrossDn2 = ta.crossunder(close, ma2)
pCrossDn3 = ta.crossunder(close, ma3)
pCrossDn4 = ta.crossunder(close, ma4)
pCrossDn5 = ta.crossunder(close, ma5)
pCrossDn6 = ta.crossunder(close, ma6)
pCrossDn7 = ta.crossunder(close, ma7)
pCrossDn8 = ta.crossunder(close, ma8)
pCrossLong = (not useCross1UpLong or pCrossUp1) and (not useCross2UpLong or pCrossUp2) and (not useCross3UpLong or pCrossUp3) and (not useCross4UpLong or pCrossUp4) and (not useCross5UpLong or pCrossUp5) and (not useCross6UpLong or pCrossUp6) and (not useCross7UpLong or pCrossUp7) and (not useCross8UpLong or pCrossUp8) and (not useCross1DnLong or pCrossDn1) and (not useCross2DnLong or pCrossDn2) and (not useCross3DnLong or pCrossDn3) and (not useCross4DnLong or pCrossDn4) and (not useCross5DnLong or pCrossDn5) and (not useCross6DnLong or pCrossDn6) and (not useCross7DnLong or pCrossDn7) and (not useCross8DnLong or pCrossDn8)
pCrossShort = (not useCross1UpShort or pCrossUp1) and (not useCross2UpShort or pCrossUp2) and (not useCross3UpShort or pCrossUp3) and (not useCross4UpShort or pCrossUp4) and (not useCross5UpShort or pCrossUp5) and (not useCross6UpShort or pCrossUp6) and (not useCross7UpShort or pCrossUp7) and (not useCross8UpShort or pCrossUp8) and (not useCross1DnShort or pCrossDn1) and (not useCross2DnShort or pCrossDn2) and (not useCross3DnShort or pCrossDn3) and (not useCross4DnShort or pCrossDn4) and (not useCross5DnShort or pCrossDn5) and (not useCross6DnShort or pCrossDn6) and (not useCross7DnShort or pCrossDn7) and (not useCross8DnShort or pCrossDn8)
// Moving average crossover checks
cross1ma1 = f_convertMA(cross1ma1Str)
cross1ma2 = f_convertMA(cross1ma2Str)
cross2ma1 = f_convertMA(cross2ma1Str)
cross2ma2 = f_convertMA(cross2ma2Str)
cross3ma1 = f_convertMA(cross3ma1Str)
cross3ma2 = f_convertMA(cross3ma2Str)
cross1Up = maCrosses and useCross1 ? ta.crossover(cross1ma1, cross1ma2) : false
cross1Down = maCrosses and useCross1 ? ta.crossunder(cross1ma1, cross1ma2) : false
cross2Up = maCrosses and useCross2 ? ta.crossover(cross2ma1, cross2ma2) : false
cross2Down = maCrosses and useCross2 ? ta.crossunder(cross2ma1, cross2ma2) : false
cross3Up = maCrosses and useCross3 ? ta.crossover(cross3ma1, cross3ma2) : false
cross3Down = maCrosses and useCross3 ? ta.crossunder(cross3ma1, cross3ma2) : false
crossColor = cross3Up ? cross3Color1 : cross3Down ? cross3Color2 : cross2Up ? cross2Color1 : cross2Down ? cross2Color2 : cross1Up ? cross1Color1 : cross1Down ? cross1Color2 : na
// Moving average test
maTestedLong = f_convertMA(i_maTestedLong)
maTestedShort = f_convertMA(i_maTestedShort)
maTestLong = (low <= maTestedLong and close >= maTestedLong) or (open >= maTestedLong and close <= maTestedLong and close >= maTestedLong)
maTestShort = (high >= maTestedShort and close <= maTestedShort) or (open <= maTestedShort and close >= maTestedShort and close <= maTestedShort)
// Price check conversions
priceAbMaLong = f_convertMA(priceAbMaLongStr)
priceBlMaLong = f_convertMA(priceBlMaLongStr)
priceAbMaShort = f_convertMA(priceAbMaShortStr)
priceBlMaShort = f_convertMA(priceBlMaShortStr)
// RSI
up = ta.rma(math.max(ta.change(rsiSource), 0), rsiPeriod)
down = ta.rma(-math.min(ta.change(rsiSource), 0), rsiPeriod)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
rsiCrossLong = rsiCrossDirLong == 'Above' ? ta.crossover(rsi, rsiCrossLevelLong) : ta.crossunder(rsi, rsiCrossLevelLong)
rsiCrossShort = rsiCrossDirShort == 'Above' ? ta.crossover(rsi, rsiCrossLevelShort) : ta.crossunder(rsi, rsiCrossLevelShort)
// Stochastic
k = ta.sma(ta.stoch(stochSource, high, low, periodK), smoothK)
d = ta.sma(k, periodD)
stochInRangeLong = kdSig ? stochHighLong >= k and k >= stochLowLong and stochHighLong >= d and d >= stochLowLong : stochHighLong >= k and k >= stochLowLong
stochInRangeShort = kdSig ? stochHighShort >= k and k >= stochLowShort and stochHighShort >= d and d >= stochLowShort : stochHighShort >= k and k >= stochLowShort
// Stoch RSI
sUp = ta.rma(math.max(ta.change(srsiSource), 0), srsiPeriod)
sDown = ta.rma(-math.min(ta.change(srsiSource), 0), srsiPeriod)
srsiRSI = sDown == 0 ? 100 : sUp == 0 ? 0 : 100 - (100 / (1 + sUp / sDown))
rsiSelect = srsiOwnRSI ? srsiRSI : rsi
srsiK = ta.sma(ta.stoch(rsiSelect, rsiSelect, rsiSelect, srsiLength), srsiSmoothK)
srsiD = ta.sma(srsiK, srsiSmoothD)
srsiInRangeLong = srsiKDSig ? srsiHighLong >= srsiK and srsiK >= srsiLowLong and srsiHighLong >= srsiD and srsiD >= srsiLowLong : srsiHighLong >= srsiK and srsiK >= srsiLowLong
srsiInRangeShort = srsiKDSig ? srsiHighShort >= srsiK and srsiK >= srsiLowShort and srsiHighShort >= srsiD and srsiD >= srsiLowShort : srsiHighShort >= srsiK and srsiK >= srsiLowShort
// Bollinger Bands
basis = ta.sma(bbSource, bbLength)
dev = bbMult * ta.stdev(bbSource, bbLength)
upper = basis + dev
lower = basis - dev
bbr = (bbSource - lower) / (upper - lower)
bbrSignalLong = bbrDirLong == 'Above' ? bbr >= bbrLevelLong : bbr <= bbrLevelLong
bbrSignalShort = bbrDirShort == 'Above' ? bbr >= bbrLevelShort : bbr <= bbrLevelShort
bbUpTest = (high >= upper and close < upper and close > basis) or (close >= upper and close < upper and close > basis)
bbLowTest = (low <= lower and close > lower and close < basis) or (close <= lower and close > lower and close < basis)
bbBiasMA = f_convertMA(bbBiasMAStr)
longBias = basis > bbBiasMA
shortBias = basis < bbBiasMA
fillColor = biasFill and longBias ? longFill : biasFill and shortBias ? shortFill : bbFill
// BBWP
// Credit to The_Caretaker
f_maType ( _price, _len, _type ) =>
_type == 'SMA' ? ta.sma ( _price, _len ) : _type == 'EMA' ? ta.ema ( _price, _len ) : ta.vwma ( _price, _len )
f_bbwp ( _price, _bbwLen, _bbwpLen, _type ) =>
float _basis = f_maType ( _price, _bbwLen, _type )
float _dev = ta.stdev ( _price, _bbwLen )
_bbw = ( _basis + _dev - ( _basis - _dev )) / _basis
_bbwSum = 0.0
_len = bar_index < _bbwpLen ? bar_index : _bbwpLen
for _i = 1 to _len by 1
_bbwSum += ( _bbw > _bbw ? 0 : 1 )
_bbwSum
_return = bar_index >= _bbwLen ? ( _bbwSum / _len) * 100 : na
_return
bbwp = f_bbwp ( bbwpPriceSource, bbwpLength, bbwpLookback, bbwpBasisType )
bbwpMa = f_ma (bbwp, bbwpMaLength, bbwpMaType)
bbwpMaDirection = bbwpMa > bbwpMa ? 'Up' : bbwpMa < bbwpMa ? 'Down' : na
// PMARP
// Credit to The_Caretaker
f_prior_sum ( _P, _X ) =>
math.sum ( _P , _X - 1 )
f_ma_val ( _P, _typ, _len ) =>
_typ == 'SMA' ? ta.sma ( _P, _len ) : _typ == 'EMA' ? ta.ema ( _P, _len ) : _typ == 'RMA' ? ta.rma ( _P, _len ) : _typ == 'HMA' ? ta.hma ( _P, _len ) : ta.vwma ( _P, _len )
f_pmarp ( _price, _pmarLen, _pmarpLen, _type_p ) =>
_pmar = math.abs ( _price / f_ma_val ( _price, _type_p, _pmarLen ))
_pmarpSum = 0
_len = bar_index < _pmarpLen ? bar_index : _pmarpLen
for i = 1 to _len by 1
_pmarpSum += ( _pmar > _pmar ? 0 : 1 )
_pmarpSum
_return = bar_index >= _pmarLen ? _pmarpSum / _len * 100 : na
ma = f_ma_val ( pmarpSource, pmarpMAType, pmarpLength )
pmar = pmarpSource / ma
pmarp = f_pmarp ( pmarpSource, pmarpLength, pmarpLookback, pmarpMAType )
pmarpMa = f_ma(pmarp, pmarpSigLength, pmarpSigMAType)
pmarpCrossUp = ta.crossover(pmarp, pmarpMa)
pmarpCrossDown = ta.crossunder(pmarp, pmarpMa)
// ADX/DMI
dUp = ta.change(high)
dDown = -ta.change(low)
plusDM = na(dUp) ? na : (dUp > dDown and dUp > 0 ? dUp : 0)
minusDM = na(dDown) ? na : (dDown > dUp and dDown > 0 ? dDown : 0)
trur = ta.rma(ta.tr, diLength)
plus = fixnan(100 * ta.rma(plusDM, diLength) / trur)
minus = fixnan(100 * ta.rma(minusDM, diLength) / trur)
sum = plus + minus
adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), adxLength)
diff = plus - minus
// VWAP
var cumVol = 0.
cumVol += nz(volume)
if barstate.islast and cumVol == 0
runtime.error("No volume is provided by the data vendor.")
computeVWAP(src, isNewPeriod, stDevMultiplier) =>
var float sumSrcVol = na
var float sumVol = na
var float sumSrcSrcVol = na
sumSrcVol := isNewPeriod ? src * volume : src * volume + sumSrcVol
sumVol := isNewPeriod ? volume : volume + sumVol
// sumSrcSrcVol calculates the dividend of the equation that is later used to calculate the standard deviation
sumSrcSrcVol := isNewPeriod ? volume * math.pow(src, 2) : volume * math.pow(src, 2) + sumSrcSrcVol
_vwap = sumSrcVol / sumVol
variance = sumSrcSrcVol / sumVol - math.pow(_vwap, 2)
variance := variance < 0 ? 0 : variance
stDev = math.sqrt(variance)
lowerBand = _vwap - stDev * stDevMultiplier
upperBand = _vwap + stDev * stDevMultiplier
timeChange(period) =>
ta.change(time(period))
isNewPeriod = switch anchor
"Session" => timeChange("D")
"Week" => timeChange("W")
"Month" => timeChange("M")
"Year" => timeChange("12M")
=> false
if na(vwapSrc )
isNewPeriod := true
float vwapValue = na
float std = na
float upperBandValue = na
float lowerBandValue = na
if not (hideonDWM and timeframe.isdwm)
= computeVWAP(vwapSrc, isNewPeriod, vwapStDev)
vwapValue := _vwap
upperBandValue := vwapPlot and vwapShowBands ? top : na
lowerBandValue := vwapPlot and vwapShowBands ? bottom : na
vwapLevelLongValue = vwapLevelLong == 'Top' ? upperBandValue : vwapLevelLong == 'Bottom' ? lowerBandValue : vwapValue
vwapLevelShortValue = vwapLevelShort == 'Top' ? upperBandValue : vwapLevelShort == 'Bottom' ? lowerBandValue : vwapValue
// Calculations and variables to determine if a signal has been plotted recently
var sigCheckArrayL = array.new_int (0)
var sigCheckArrayS = array.new_int (0)
sigCheckL = array.sum(sigCheckArrayL) > 0 ? true : false
sigCheckS = array.sum(sigCheckArrayS) > 0 ? true : false
// For testing signal checks
// plotchar(sigCheckL, title='sigCheckL', char='.', color=noColor)
// plotchar(sigCheckS, title='sigCheckS', char='.', color=noColor)
// Time Off
timeOffSession = time == time(timeframe=timeframe.period, session=timeOffRange, timezone='UTC')
// Signals
dayOff = useOffDays and ((offSun and dayofweek == dayofweek.sunday) or (offMon and dayofweek == dayofweek.monday) or (offTue and dayofweek == dayofweek.tuesday) or (offWed and dayofweek == dayofweek.wednesday) or (offThur and dayofweek == dayofweek.thursday) or (offFri and dayofweek == dayofweek.friday) or (offSat and dayofweek == dayofweek.saturday))
timeOff = useTimeOff and timeOffSession
priceSignalLong = (not usePriceAbMaLong or close > priceAbMaLong) and (not usePriceBlMaLong or close < priceBlMaLong)
priceSignalShort = (not usePriceAbMaShort or close > priceAbMaShort) and (not usePriceBlMaShort or close < priceBlMaShort)
volSignalLong = not useVolumeLong or vAboveLong
volSignalShort = not useVolumeShort or vAboveShort
maSignalLong = (not i_ma1Above2 or ma1Above2) and (not i_ma2Above3 or ma2Above3) and (not i_ma3Above4 or ma3Above4) and (not i_ma4Above5 or ma4Above5) and (not i_ma5Above6 or ma5Above6) and (not i_ma6Above7 or ma6Above7) and (not i_ma7Above8 or ma7Above8) and (not useMATestLong or maTestLong) and pCrossLong
maSignalShort = (not i_ma1Below2 or ma2Above1) and (not i_ma2Below3 or ma3Above2) and (not i_ma3Below4 or ma4Above3) and (not i_ma4Below5 or ma5Above4) and (not i_ma5Below6 or ma6Above5) and (not i_ma6Below7 or ma7Above6) and (not i_ma7Below8 or ma8Above7) and (not useMATestShort or maTestShort) and pCrossShort
rsiSignalLong = not includeRSILong or (rsiHighLong > rsi and rsi > rsiLowLong)
rsiSignalShort = not includeRSIShort or (rsiHighShort > rsi and rsi > rsiLowShort)
rsiCrossSignalLong = not useRsiCrossLong or rsiCrossLong
rsiCrossSignalShort = not useRsiCrossShort or rsiCrossShort
stochSignalLong = not includeStochLong or ((not useStochRangeLong or stochInRangeLong) and (not stochKAboveD or k > d))
stochSignalShort = not includeStochShort or ((not useStochRangeShort or stochInRangeShort) and (not stochKBelowD or k < d))
srsiSignalLong = not includeSRSILong or srsiInRangeLong
srsiSignalShort = not includeSRSIShort or srsiInRangeShort
bbSignalLong = not includeBBLong or ((not includBBBiasLong or longBias) and (not includeBBTestLong or bbLowTest))
bbSignalShort = not includeBBShort or ((not includBBBiasShort or shortBias) and (not includeBBTestShort or bbUpTest))
bbwpSignalLong = (not includeBBWPLong or (bbwp < bbwpMaxLong and bbwp > bbwpMinLong)) and (not includeBBRLong or bbrSignalLong)
bbwpSignalShort = (not includeBBWPShort or (bbwp < bbwpMaxShort and bbwp > bbwpMinShort)) and (not includeBBRShort or bbrSignalShort)
bbwpMaSignalLong = not includeBBWPMaDLong or (includeBBWPMaDLong and bbwpMaDirection == bbwpMaDLong)
bbwpMaSignalShort = not includeBBWPMaDShort or (includeBBWPMaDShort and bbwpMaDirection == bbwpMaDShort)
pmarpSignalLong = not includePMARPLong or (pmarpLongAB == 'Above' and pmarp >= pmarpThresholdLong) or (pmarpLongAB == 'Below' and pmarp <= pmarpThresholdLong)
pmarpSignalShort = not includePMARPShort or (pmarpShortAB == 'Above' and pmarp >= pmarpThresholdShort) or (pmarpShortAB == 'Below' and pmarp <= pmarpThresholdShort)
pmarpMaCrossLong = not usePmarpCrossMaLong or (pmarpCrossDirLong == 'Up' and pmarpCrossUp) or (pmarpCrossDirLong == 'Down' and pmarpCrossDown)
pmarpMaCrossShort = not usePmarpCrossMaShort or (pmarpCrossDirShort == 'Up' and pmarpCrossUp) or (pmarpCrossDirShort == 'Down' and pmarpCrossDown)
dmiSignalLong = not useDMILong or ((not dmiFlipLong or (diff > 0 and diff <= 0) or (diff < 0 and diff >= 0)) and ((dmiPNLong == 'Positive' and diff > 0) or (dmiPNLong == 'Negative' and diff < 0) or dmiPNLong == 'Custom' and (dmiABLong == 'Above' and diff >= dmiThresholdLong) or (dmiABLong == 'Below' and diff <= dmiThresholdLong)))
dmiSignalShort = not useDMIShort or ((not dmiFlipShort or (diff > 0 and diff <= 0) or (diff < 0 and diff >= 0)) and ((dmiPNShort == 'Positive' and diff > 0) or (dmiPNShort == 'Negative' and diff < 0) or dmiPNShort == 'Custom' and (dmiABShort == 'Above' and diff >= dmiThresholdShort) or (dmiABShort == 'Below' and diff <= dmiThresholdShort)))
adxSignalLong = not useADXLong or (adxABLong == 'Above' and adx >= adxThresholdLong) or (adxABLong == 'Below' and adx <= adxThresholdLong)
adxSignalShort = not useADXShort or (adxABShort == 'Above' and adx >= adxThresholdShort) or (adxABShort == 'Below' and adx <= adxThresholdShort)
adxDirSignalLong = not useADXDirLong or (adxDirLong == 'Rising' and adx >= adx ) or (adxDirLong == 'Falling' and adx <= adx )
adxDirSignalShort = not useADXDirShort or (adxDirShort == 'Rising' and adx >= adx ) or (adxDirShort == 'Falling' and adx <= adx )
vwapSignalLong = not useVwapLong or (vwapABLong == 'Above' and close > vwapLevelLongValue) or (vwapABLong == 'Below' and close < vwapLevelLongValue)
vwapSignalShort = not useVwapShort or (vwapABShort == 'Above' and close > vwapLevelShortValue) or (vwapABShort == 'Below' and close < vwapLevelShortValue)
longSignal = includeLong and not dayOff and not timeOff and (not useSigCheck or not sigCheckL) and (not onlyConfirmed or barstate.isconfirmed) and priceSignalLong and volSignalLong and maSignalLong and rsiSignalLong and rsiCrossSignalLong and stochSignalLong and srsiSignalLong and bbSignalLong and bbwpSignalLong and bbwpMaSignalLong and pmarpSignalLong and pmarpMaCrossLong and dmiSignalLong and adxSignalLong and adxDirSignalLong and vwapSignalLong
shortSignal = includeShort and not dayOff and not timeOff and (not useSigCheck or not sigCheckS) and (not onlyConfirmed or barstate.isconfirmed) and priceSignalShort and volSignalShort and maSignalShort and rsiSignalShort and rsiCrossSignalShort and stochSignalShort and srsiSignalShort and bbSignalShort and bbwpSignalShort and bbwpMaSignalShort and pmarpSignalShort and pmarpMaCrossShort and dmiSignalShort and adxSignalShort and adxDirSignalShort and vwapSignalShort
// Check if a new signal should not be plotted
array.push(sigCheckArrayL, longSignal ? 1 : 0)
array.push(sigCheckArrayS, shortSignal ? 1 : 0)
if array.size(sigCheckArrayL) > sigCheckBars
array.remove(sigCheckArrayL, 0)
if array.size(sigCheckArrayS) > sigCheckBars
array.remove(sigCheckArrayS, 0)
//////////////////////////////////////////////////////////////
// Plots
// Background
bgcolor(dayOff or timeOff ? color.new(color.purple, transp=80) : crossColor)
// Moving Averages
plot(includeMA1 ? ma1 : na, title='MA 1', color=ma1Color, linewidth=2, offset=0)
plot(includeMA2 ? ma2 : na, title='MA 2', color=ma2Color, linewidth=2, offset=0)
plot(includeMA3 ? ma3 : na, title='MA 3', color=ma3Color, linewidth=2, offset=0)
plot(includeMA4 ? ma4 : na, title='MA 4', color=ma4Color, linewidth=2, offset=0)
plot(includeMA5 ? ma5 : na, title='MA 5', color=ma5Color, linewidth=2, offset=0)
plot(includeMA6 ? ma6 : na, title='MA 6', color=ma6Color, linewidth=2, offset=0)
plot(includeMA7 ? ma7 : na, title='MA 7', color=ma7Color, linewidth=2, offset=0)
plot(includeMA8 ? ma8 : na, title='MA 8', color=ma8Color, linewidth=2, offset=0)
// Bollinger Bands
plot(plotBB ? basis : na, title='Basis', color=color.orange, linewidth=1)
p1 = plot(plotBB ? upper : na, title='Upper', color=color.blue, linewidth=2)
p2 = plot(plotBB ? lower : na, title='Lower', color=color.blue, linewidth=2)
fill(p1, p2, title='BB Background', color=fillColor)
// VWAP
plot(vwapPlot ? vwapValue : na, title="VWAP", color=vwapColor, linewidth=vwapWidth, offset=vwapOffset)
upperBand = plot(upperBandValue, title="Upper Band", color=color.green, offset=vwapOffset)
lowerBand = plot(lowerBandValue, title="Lower Band", color=color.green, offset=vwapOffset)
fill(upperBand, lowerBand, title="Bands Fill", color= vwapShowBands ? color.new(color.green, 95) : na)
// Signals
plotshape(plotType == 'Shape' ? longSignal : na, title='Long', location=location.belowbar, style=shape.triangleup, size=size.small, color=color.blue)
plotchar(plotType == 'Dot' ? longSignal : na, title='Long', location=location.belowbar, char='•', color=color.blue)
plotshape(plotType == 'Shape' ? shortSignal : na, title='Short', location=location.abovebar, style=shape.triangledown, size=size.small, color=color.red)
plotchar(plotType == 'Dot' ? shortSignal : na, title='Short', location=location.abovebar, char='•', color=color.red)
barcolor(plotType == 'Bar' and longSignal ? barColorLong : plotType == 'Bar' and shortSignal ? barColorShort : na)
//////////////////////////////////////////////////////////////
// Alerts
alertcondition(longSignal, title='Long Signal', message='DIY Long Signal')
alertcondition(shortSignal, title='Short Signal', message='DIY Short Signal')
alertcondition(longSignal or shortSignal, title='Any Signal', message='DIY Signal')
alertcondition(cross1Up or cross1Down, title='MA Pair 1 Cross', message='DIY MA Cross Signal')
alertcondition(cross2Up or cross2Down, title='MA Pair 2 Cross', message='DIY MA Cross Signal')
alertcondition(cross3Up or cross3Down, title='MA Pair 3 Cross', message='DIY MA Cross Signal')
//////////////////////////////////////////////////////////////
// Testing
// plotchar(srsiK, 'k', char='.', color=noColor)
// plotchar(srsiD, 'd', char='.', color=noColor)
Daily & Multi-Day High/LowDaily & Multi-Candle High/Low Indicator
This indicator clearly highlights essential price levels directly on your chart, significantly improving your trading decisions:
First Candle High/Low (Session Open):
Quickly identify the high and low of the first candle each trading day, ideal for session-open traders.
Previous Day's High/Low:
Automatically plots the highest and lowest prices from the previous trading day, crucial for daily breakout or reversal strategies.
Multi-Candle High/Low (Customizable Period):
Easily track the highest and lowest points of the last X candles (default: 108 candles). Perfect for spotting key support and resistance zones.
Customization Options:
Adjust colors, line styles (solid, dashed, dotted), and line thickness directly from the settings for personalized visibility.
Ideal for day traders, swing traders, and price-action traders looking for clear and actionable daily levels on their charts.
BankNIFTY Pro Trader + Gann//@version=6
indicator("BankNIFTY Pro Trader + Gann", overlay=true)
// --- Supertrend Parameters ---
atrLength = 14
multiplier = 1.5
atr = ta.rma(ta.tr, atrLength)
upTrend = close - (multiplier * atr)
downTrend = close + (multiplier * atr)
var float trend = na
trend := close > trend ? math.max(upTrend, trend) : math.min(downTrend, trend)
supertrend = close >= trend ? trend : na
// --- RSI Parameters ---
rsiPeriod = 14
rsi = ta.rsi(close, rsiPeriod)
// --- VWAP ---
vwap = ta.vwap(close)
// --- Gann Square of 9 ---
baseLevel = input.float(50000, title="Pivot Price", tooltip="Enter the pivot price for Gann calculations")
gannLevel(pivot, angle) =>
pivot * (1 + angle / 360)
angles = array.from(45, 90, 135, 180, 225, 270, 315, 360)
for i = 0 to array.size(angles) - 1
angle = array.get(angles, i)
level = gannLevel(baseLevel, angle)
line.new(x1=bar_index , y1=level, x2=bar_index, y2=level, width=1, color=color.new(color.purple, 50), style=line.style_dotted)
label.new(x=bar_index, y=level, text="Gann " + str.tostring(angle) + "°: " + str.tostring(level), style=label.style_label_up, color=color.new(color.purple, 0), textcolor=color.white, size=size.small)
// --- Signals ---
longSignal = ta.crossover(close, supertrend) and rsi > 50 and close > vwap
shortSignal = ta.crossunder(close, supertrend) and rsi < 50 and close < vwap
// --- Plot Supertrend ---
plot(trend, color=close > trend ? color.green : color.red, linewidth=2, title="Supertrend")
// --- Plot VWAP ---
plot(vwap, color=color.blue, title="VWAP")
// --- Buy/Sell Signals ---
plotshape(longSignal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(shortSignal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// --- Alerts ---
alertcondition(longSignal, title="BankNIFTY Buy Alert", message="Buy Signal on BankNIFTY!")
alertcondition(shortSignal, title="BankNIFTY Sell Alert", message="Sell Signal on BankNIFTY!")
// --- Strategy Guidelines ---
// 1. Go LONG when you see a BUY signal and price stays above VWAP.
// 2. Go SHORT when you see a SELL signal and price stays below VWAP.
// 3. Use RSI as confirmation (above 50 = bullish, below 50 = bearish).
// 4. Ideal for BankNIFTY futures on a 5-min or 15-min timeframe.
// 5. Use Gann levels for additional support and resistance zones.
Auto Demand and Supply Zones//@version=6
indicator("Auto Demand and Supply Zones", overlay=true)
// Parameters for zone sensitivity
zoneLength = input.int(20, title="Zone Length", minval=1)
zoneThreshold = input.float(0.5, title="Zone Threshold", minval=0.0, maxval=1.0)
// Function to find demand zones (buy zones)
isDemandZone() =>
low < ta.lowest(low, zoneLength) and close > open
// Function to find supply zones (sell zones)
isSupplyZone() =>
high > ta.highest(high, zoneLength) and close < open
// Demand and supply zone conditions
demandZone = isDemandZone()
supplyZone = isSupplyZone()
// Create and store coordinates for demand and supply zones (this part is fixed)
var label demandLabel = na
var label supplyLabel = na
if demandZone
demandLabel := label.new(bar_index, low, "Demand Zone", color=color.green, style=label.style_label_up, size=size.small, textcolor=color.white)
if supplyZone
supplyLabel := label.new(bar_index, high, "Supply Zone", color=color.red, style=label.style_label_down, size=size.small, textcolor=color.white)
// Set background color globally
bgcolor(demandZone ? color.new(color.green, 90) : na)
bgcolor(supplyZone ? color.new(color.red, 90) : na)
// Optional: Plot arrows to indicate the demand and supply zone locations
plotshape(demandZone, style=shape.triangledown, location=location.belowbar, color=color.green, size=size.small)
plotshape(supplyZone, style=shape.triangleup, location=location.abovebar, color=color.red, size=size.small)
Jg WMark - Sessions Volume ProfileVolume Profile And WaterMark
Watching Some Sesions Ranges, ASia, London, NY
Indikator Sinyal Custom//@version=5
indicator("Indikator C3 Binary", overlay=true)
// Definisi variabel
var float candle1_high = na
var float candle1_low = na
var float candle2_high = na
var float candle2_low = na
var float resistance = na
var float support = na
var bool buy_signal = false
var bool sell_signal = false
// Ambil menit saat ini dari candle
M = minute
// Hitung menit awal urutan (S) berdasarkan menit saat ini
k = math.floor((M - 5) / 5 + 1)
S = k >= 1 ? 5 * k : na
// Tentukan apakah candle saat ini termasuk dalam urutan dan posisinya
is_in_sequence = not na(S) and M >= S and M < S + 5
position = is_in_sequence ? M - S + 1 : na
// Logika berdasarkan posisi candle dalam urutan
if position == 1
// Simpan high dan low candle 1, reset sinyal
candle1_high := high
candle1_low := low
buy_signal := false
sell_signal := false
else if position == 2
// Simpan high dan low candle 2, hitung SnR
candle2_high := high
candle2_low := low
resistance := math.max(candle1_high, candle2_high)
support := math.min(candle1_low, candle2_low)
else if position == 3
// Cek kondisi break resistance
if high > resistance
if close > resistance
buy_signal := true
else
sell_signal := true
// Cek kondisi break support
if low < support
if close < support
sell_signal := true
else
buy_signal := true
// Definisikan kondisi untuk menampilkan sinyal di candle 4
show_buy = position == 4 and buy_signal
show_sell = position == 4 and sell_signal
// Tampilkan sinyal di scope global
plotshape(show_buy ? low : na, style=shape.arrowup, color=color.green, location=location.belowbar, title="BUY")
plotshape(show_sell ? high : na, style=shape.arrowdown, color=color.red, location=location.abovebar, title="SELL")
VijayWankhade IndicatorIndicator by Adv Vijay Wankhade. EMA (20,50,100,200). Bollinger Band. Supertrend.