Cerca negli script per "Cycle"
Schaff Trend Cycle Strategy for XBTUSD 15m BacktestSchaff Trend Cycle Strategy for XBTUSD 15m Backtest
Zero-Lag Smoothed CycleOld indicator ! But its a simple trick to have a zero-lag smoothing effect, i think i did it because the smoothing was kinda asymmetrical with the detrended line. So even if the result appear quite good take into account that the detrended line isn't always correlated with the price.
Robust Cycle Measurement [Ehlers]The last of Ehlers Instantaneous Frequency Measurement methods.
This is a more robust version of this script.
I wrote it as a function, so you can simply copy and paste it into any script to add an adaptive period setting capability.
Cheers,
DasanC
Cosine, In-Phase & Quadrature IFM [Ehlers]Yet another method for determining the cycle of a market: this time, you have access to the two fastest and most accurate methods
as well as the option to average these methods together.
The controls are pretty straight forward:
Source lets you select the price data to perform calculations on (close, open, etc..)
Max Period is simply the cap for the algorithm when it's checking the validity of Periods.
-> If you notice your plots have a flat top, then increase this value to accept a wider range of Periods.
-> This setting has a min. value of 8 to reduce noise and a max of 100 to ignore waves from higher time frames.
Average? simply averages the two methods of calculation.
-> You may want to do this if you notice the two plots diverging a lot.
-> Cosine IFM tends to favor shorter periods; I-Q IFM tends to favor longer.
Cheers,
- DasanC
Ehlers Cyber Cycle StrategyEhlers Cyber Cycle Strategy by John Ehlers from his book "Cybernetic Analysis for Stocks and Futures".
RSP / VOO 比值指標The RSP/VOO ratio compares the performance of the S&P 500 Equal Weight ETF (RSP) to the S&P 500 Market Cap Weighted ETF (VOO). When the ratio is falling, it indicates that large-cap stocks—especially mega-cap tech names—are outperforming the broader market. In contrast, a rising ratio suggests that smaller and mid-sized companies are catching up or leading, which may signal a healthy broadening of market participation. Investors often use this ratio to identify shifts in market leadership and assess the strength or fragility of a rally.
Ichimoku BoxIntroducing Ichimoku Box Indicator:
Key Features:
Customizable Box Periods: Adjustable box periods with default settings of 9, 26, and 52.
Shifted Span A and Span B Points: Easily adjustable shifts and colors.
Additional Box Option: Capability to add an extra box for more detailed analysis.
High and Low Markers: Identifies the highest and lowest candle within each box with distinct markers.
Candle Countdown Timer: Displays the remaining candles before a box loses its high or low.
Drag-and-Drop Functionality: Move boxes to any position on the chart with a vertical line.
Automatic Box Drawing: When the indicator is first applied, a vertical line appears on the mouse cursor, and clicking on any point automatically draws the boxes.
How It Works:
The indicator allows users to visualize Ichimoku periods as boxes, highlighting key price levels and shifts in market structure. It simplifies the analysis process by providing visual cues and customizable settings for enhanced flexibility.
SantiHOURchange
Indicator to mark changes in the next hours; once an hour passes, the following one will be marked automatically. It's ideal for those who do not want to wait for the indicator to mark it upon arrival, but rather see it beforehand.
Weekly PO3 Market Structure ToolThis script is designed to assist traders in identifying the "Power of Three" (PO3) model on a weekly basis — as taught by ICT (Inner Circle Trader).
It automatically plots:
- The **Weekly Open**, a crucial reference level for detecting manipulation zones.
- **Weekly High and Low**, to frame liquidity zones and potential sweep areas.
- A customizable **Manipulation Zone**, calculated as a percentage range above and below the weekly open.
The PO3 model breaks market structure into:
1. Accumulation (early-week range)
2. Manipulation (false breakouts and liquidity grabs)
3. Distribution (true directional move)
This tool helps visualize those stages and align trades with smart money behavior.
Best used on 1H, 4H, or 15M timeframes for clarity.
Tip: Combine with FVGs, Order Blocks, and time-of-day filters for enhanced setups.
Recuadro 06:00–07:30 NY extendido hasta 11:00 con DRThis indicator includes the daily range between 6 am to 7.30 am ny time acoordinly to quarterly theory
Weekly Open LineThis script is designed to assist traders in identifying the "Power of Three" (PO3) model on a weekly basis — as taught by ICT (Inner Circle Trader).
It automatically plots:
- The **Weekly Open**, a crucial reference level for detecting manipulation zones.
- **Weekly High and Low**, to frame liquidity zones and potential sweep areas.
- A customizable **Manipulation Zone**, calculated as a percentage range above and below the weekly open.
The PO3 model breaks market structure into:
1. Accumulation (early-week range)
2. Manipulation (false breakouts and liquidity grabs)
3. Distribution (true directional move)
This tool helps visualize those stages and align trades with smart money behavior.
Best used on 1H, 4H, or 15M timeframes for clarity.
Tip: Combine with FVGs, Order Blocks, and time-of-day filters for enhanced setups.
Trend-Following Colored Bars w/ SignalsTheTechnicalTraders trendfollowing
Easy way to follow the trend.
VARNI-LINE-CHART//@version=5
indicator("VARNI-LINE-CHART",shorttitle = "VARNI-LINE-CHART", overlay=false)
// Input for Index and Expiry Date
spot_ = input.string("BANKNIFTY", title = "Spot Symbol", options = , group = "Index")
tooltip_day = "Enter the day of the expiry. Add 0 in front if the day is a single digit. For example: 05 instead of 5"
tooltip_month = "Enter the month of the expiry. Add 0 in front if the month is a single digit. For example: 06 instead of 6"
tooltip_year = "Enter the year of the expiry. Use the last two digits of the year. For example: 24 instead of 2024"
_day = input.string("13", title = "Expiry Day", tooltip = tooltip_day, group="Expiry Date")
_month = input.string("02", title = "Expiry Month", tooltip = tooltip_month, group="Expiry Date")
_year = input.string("25", title = "Expiry Year", tooltip = tooltip_year, group="Expiry Date")
// Input for Strikes
tooltip_ = "You can select any Strike, and choose to include both strikes or just one"
strike_ce = input.int(23500, "Call Strike", tooltip = tooltip_,step = 50, group = "Select Strike")
strike_pe = input.int(23500, "Put Strike", tooltip = tooltip_,step = 50, group = "Select Strike")
var string spot = na
if spot_ == "SENSEX"
spot := "BSX"
else if spot_ == "BANKEX"
spot := "BKX"
else
spot := spot_
// Option to include both strikes
strike_choice = input.string("Combined", title = "Select Strike", options = , group = "Select Strike")
// Generate symbols for Call and Put options
var string symbol_CE = spot + _year + _month + _day + "C" + str.tostring(strike_ce)
var string symbol_PE = spot + _year + _month + _day + "P" + str.tostring(strike_pe)
// Request security data for both Call and Put options
= request.security(symbol_CE, timeframe.period, )
= request.security(symbol_PE, timeframe.period, )
call_volume = request.security( symbol_CE, timeframe.period , volume )
put_volume = request.security( symbol_PE, timeframe.period , volume )
var float combined_open = 0
var float combined_high = 0
var float combined_low = 0
var float combined_close = 0
var float combined_vol = 0
// Calculate combined premium based on strike choice
if strike_choice == "Combined"
combined_open := call_open + put_open
combined_close := call_close + put_close
combined_high := math.max(combined_open, combined_close)
combined_low := math.min(combined_open, combined_close)
combined_vol := call_volume + put_volume
else if strike_choice == "Only Call"
combined_open := call_open
combined_close := call_close
combined_high := call_high
combined_low := call_low
combined_vol := call_volume
else
combined_open := put_open
combined_close := put_close
combined_high := put_high
combined_low := put_low
combined_vol := put_volume
// Plot combined premium as a line chart
plot(combined_close, title = "Combined Premium", color = combined_close > combined_open ? color.green : color.red, linewidth = 2)
// Indicator selection
use_ema_crossover = input.bool(false, title = "Use EMA Crossover", group = "Indicators")
use_supertrend = input.bool(false, title = "Use Supertrend", group = "Indicators")
use_vwap = input.bool(true, title = "Use VWAP", group = "Indicators")
use_rsi = input.bool(false, title = "Use RSI", group = "Indicators")
use_sma = input.bool(false, title = "Use SMA", group = "Indicators")
pine_supertrend_value(factor, atrPeriod) =>
src = combined_close
atr = ta.atr(atrPeriod)
upperBand = src + factor * atr
lowerBand = src - factor * atr
prevLowerBand = nz(lowerBand )
prevUpperBand = nz(upperBand )
lowerBand := lowerBand > prevLowerBand or combined_close < prevLowerBand ? lowerBand : prevLowerBand
upperBand := upperBand < prevUpperBand or combined_close > prevUpperBand ? upperBand : prevUpperBand
int _direction = na
float superTrend = na
prevSuperTrend = superTrend
if na(atr )
_direction := 1
else if prevSuperTrend == prevUpperBand
_direction := combined_close > upperBand ? -1 : 1
else
_direction := combined_close < lowerBand ? 1 : -1
superTrend := _direction == -1 ? lowerBand : upperBand
superTrend
pine_supertrend_dir(factor, atrPeriod) =>
src = combined_close
atr = ta.atr(atrPeriod)
upperBand = src + factor * atr
lowerBand = src - factor * atr
prevLowerBand = nz(lowerBand )
prevUpperBand = nz(upperBand )
lowerBand := lowerBand > prevLowerBand or combined_close < prevLowerBand ? lowerBand : prevLowerBand
upperBand := upperBand < prevUpperBand or combined_close > prevUpperBand ? upperBand : prevUpperBand
int _direction = na
float superTrend = na
prevSuperTrend = superTrend
if na(atr )
_direction := 1
else if prevSuperTrend == prevUpperBand
_direction := combined_close > upperBand ? -1 : 1
else
_direction := combined_close < lowerBand ? 1 : -1
superTrend := _direction == -1 ? lowerBand : upperBand
_direction
// Input for EMA lengths
fastLength = input.int(7, 'Fast EMA Length', group = "EMA")
slowLength = input.int(12, 'Slow EMA Length', group = "EMA")
// Input for SuperTrend
atrLength = input.int(7, 'ATR Length', group = "SuperTrend")
fac = input.float(2, 'Factor', group = "SuperTrend")
// Input for RSI
rsi_length = input.int(7, 'Length', group="RSI")
rsi_ob_level = input.int(80, 'Overbought', group="RSI")
rsi_os_level = input.int(20, 'Oversold', group="RSI")
// Input for SMA
sma_length = input.int(7, 'SMA Length', group = "SMA")
var float fast_ema = na
var float slow_ema = na
var float supertrend = na
var int direction = na
var float rsi_val = na
var float sma_val = na
var float sumPriceVolume = na
var float sumVolume = na
var float vwap = na
// Fast EMA
if use_ema_crossover
fast_ema := ta.ema(combined_close, fastLength)
slow_ema := ta.ema(combined_close, slowLength)
// Supertrend
if use_supertrend
supertrend := pine_supertrend_value( fac, atrLength)
direction := pine_supertrend_dir( fac, atrLength)
// VWAP
if use_vwap
if (dayofweek != dayofweek )
sumPriceVolume := 0.0
sumVolume := 0.0
vwap := 0.0
sumPriceVolume += combined_close * combined_vol
sumVolume += combined_vol
vwap := sumPriceVolume / sumVolume
// RSI
if use_rsi
rsi_val := ta.rsi(combined_close, rsi_length)
// SMA
if use_sma
sma_val := ta.sma(combined_close, sma_length)
plot(fast_ema, title='Fast EMA', color=color.blue, linewidth=2)
plot(slow_ema, title='Slow EMA', color=color.yellow, linewidth=2)
plot(direction < 0 ? supertrend : na, "Up direction", color = color.green, style=plot.style_linebr)
plot(direction > 0 ? supertrend : na, "Down direction", color = color.red, style=plot.style_linebr)
plot(vwap, title='VWAP', color=color.purple, linewidth=2)
plot(sma_val, title='SMA', color=color.maroon, linewidth=2)
// Define buy and sell conditions based on selected indicators
var bool buy = false
var bool sell = false
var int buyC = 0
var int sellC = 0
if dayofweek != dayofweek
buyC := 0
sellC := 0
if use_ema_crossover
buy := ( ta.crossover(fast_ema, slow_ema) ) and buyC == 0
sell := ( ta.crossunder(fast_ema, slow_ema) ) and sellC == 0
if use_vwap
buy := ( buy ? buy and (combined_close > vwap and combined_close <= vwap ) : (combined_close > vwap and combined_close <= vwap )) and buyC == 0
sell := ( sell ? sell and (combined_close < vwap and combined_close >= vwap ) : (combined_close < vwap and combined_close >= vwap )) and sellC == 0
if use_rsi
buy := ( buy ? buy and ta.crossover(rsi_val, rsi_ob_level) : ta.crossover(rsi_val, rsi_ob_level) ) and buyC == 0
sell := ( sell ? sell and ta.crossunder(rsi_val, rsi_os_level) : ta.crossunder(rsi_val, rsi_os_level) ) and sellC == 0
if use_sma
buy := ( buy ? buy and ta.crossover(combined_close, sma_val) : ta.crossover(combined_close, sma_val) ) and buyC == 0
sell := ( sell ? sell and ta.crossunder(combined_close, sma_val) : ta.crossunder(combined_close, sma_val) ) and sellC == 0
if use_supertrend
buy := ( buy ? direction == -1 : direction == -1 and direction == 1 ) and buyC == 0
sell := ( sell ? direction == 1 : direction == 1 and direction == -1 ) and sellC == 0
if buy
buyC := 1
sellC := 0
if sell
sellC := 1
buyC := 0
// Plot buy and sell signals
plotshape(buy, title = "Buy", text = 'Buy', style = shape.labeldown, location = location.top, color= color.green, textcolor = color.white, size = size.small)
plotshape(sell, title = "Sell", text = 'Sell', style = shape.labelup, location = location.bottom, color= color.red, textcolor = color.white, size = size.small)
// Alert conditions
alertcondition(buy, "Buy Alert", "Buy Signal")
alertcondition(sell, "Sell Alert", "Sell Signal")
Session Makers v1
Session Makers v1 - Professional Trading Session Visualizer
This advanced indicator highlights key trading sessions and market structure levels, helping traders identify optimal trading times and important price levels.
Key Features:
Session Time Markers
- Vertical dotted lines at major market opens (London/New York)
- Appears 30 minutes before each session for early preparation
Interactive Session Boxes
- Asia Session (22:00-06:00 GMT) - Blue shaded area
- London AM (08:00-09:00 GMT) - Gray shaded area
- London/New York Overlap (14:00-15:00 GMT) - Gray shaded area
Key Reference Levels
- Yesterday's high/low (with touch alerts)
- Previous week's high/low (with touch alerts)
- Asia session high/low/mid lines
Smart Visual Design
- Clean, non-cluttered visuals that adapt to your chart
- Customizable colors and transparency for all elements
- Optimized for all timeframes (M1-H4)
only use in timeframes <= 15 min
BTC Buy Sunday Noon / Sell Friday Noon (Compounding from $1000)long enough description long enough description long enough description long enough description long enough description long enough description long enough description long enough description long enough description long enough description long enough description
HMA Crossover + ATR + Curvature (Long & Short)📏 Hull Moving Averages (Trend Filters)
- fastHMA = ta.hma(close, fastLength)
- slowHMA = ta.hma(close, slowLength)
These two HMAs act as dynamic trend indicators:
- A bullish crossover of fast over slow HMA signals a potential long setup.
- A bearish crossunder triggers short interest.
⚡️ Curvature (Acceleration Filter)
- curv = ta.change(ta.change(fastHMA))
This calculates the second-order change (akin to the second derivative) of the fast HMA — effectively the acceleration of the trend. It serves as a filter:
- For long entries: curv > curvThresh (positive acceleration)
- For short entries: curv < -curvThresh (negative acceleration)
It helps eliminate weak or stagnating moves by requiring momentum behind the crossover.
📈 Volatility-Based Risk Management (ATR)
- atr = ta.atr(atrLength)
- stopLoss = atr * atrMult
- trailStop = atr * trailMult
These define your:
- Initial stop loss: scaled to recent volatility using ATR and atrMult.
- Trailing stop: also ATR-scaled, to lock in gains dynamically as price moves favorably.
💰 Position Sizing via Risk Percent
- capital = strategy.equity
- riskCapital = capital * (riskPercent / 100)
- qty = riskCapital / stopLoss
This dynamically calculates the position size (qty) such that if the stop loss is hit, the loss does not exceed the predefined percentage of account equity. It’s a volatility-adjusted position sizing method, keeping your risk consistent regardless of market conditions.
📌 Execution Logic
- Long Entry: on bullish HMA crossover with rising curvature.
- Short Entry: on bearish crossover with falling curvature.
- Exits: use ATR-based trailing stops.
- Position is closed when trend conditions reverse (e.g., bearish crossover exits the long).
This framework gives you:
- Trend-following logic (via HMAs)
- Momentum confirmation (via curvature)
- Volatility-aware execution and exits (via ATR)
- Risk-controlled dynamic sizing
Want to get surgical and test what happens if we use curvature on the difference between HMAs instead? That might give some cool insights into trend strength transitions.
Vertical Lines at 8AM, 9AM, 8PM & 9PMVertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT. Vertical lines at 8am, 8pm, 9am and 9pm on SGT.
Session SeparatorAn indicator that adds a vertical line for each of the following sessions start times:
Tokyo Session: 7pm EST
London Session: 3am EST
US Session: 8am EST
The purpose of this indicator is to have a minimalistic separation of the different time zones without cluttering the chart!