Supertrend MTF LAG ISSUEThis script based on
we all use Super trend but it main issue is the lag as it buy too late or sell too late
using Deavaet study of Heat map MTF we can do a little trick
if you look on his study you can see that major signal for example will happen in the time frame before it happen at larger time frame
so in this example if signal at MTF 30 min and signal at MTF 60 min happen at the same time at 2 hours or 4 hours candles then this signal are more likely to be true then random signal at each time frame specific.
since we use shorter time frame on larger time frame we can remove the lag issue that make supertrend not so effective
In this example I set the signal to be MTF 30 +60 om 2 hour TF , can be good also for 4 hour candles..
So you get the signal to close inside the larger candle
now if you want to make on even shorter TF then change the code to 15 and 30 MTF on candles on 1 hour
or 1 and 5 min on 30 min or 15 min
חפש סקריפטים עבור "机械革命无界15+时不时闪屏"
RVOL - R4RocketRelative volume or RVOL for short is an indicator that is used to measure how 'In Play' the stock is. Simply put, it helps to quantify how interested everybody is in the given stock - higher the value, higher the interest and hence higher is the probability for movement in the stock.
I have tried to create RVOL (Relative Volume ) Indicator as per the description that I read on SMB Capital blog. The blog is a great resource.
...................................................................................................................................................................................
How to use the indicator - The indicator is meant for INTRADAY ONLY.
The indicator has following inputs -
1. RVOL Period - Value from 3 to 14 (Default Value = 4)
This is used to calculate the average volume over the given period of days. e.g. average volume for the last 5 days, last 3 days, last 10 days etc. NOTE - If you use higher RVOL Period on smaller timeframes, the code will give an error. So I recommend using 4 or lower for 5 min timeframe. (Nothing will work on 1 min chart and you can experiment for other timeframes.)
2. RVOL Sectional - True / False (Default Value = False)
If you check this box then you will be able to calculate the RVOL for a particular session (or between particular sessions) in that trading day.
What do I mean by session?
Well I have divided the trading day into 6 (almost) equally spaced sessions in time, i.e. 6 hours and 15 mins (for NSE - India) of trading day is divided into 1 hr - 1st session, 1 hr - 2nd session, 1 hr - 3rd session, 1 hr - 4th session, 1 hr - 5th session, 1 hr and 15 min - 6th session.
Before using 3rd and 4th inputs of indicator, RVOL Sectional box MUST BE CHECKED FIRST.
3. RVOL From Session - 1 to 6 (Default Value = 1)
4. RVOL To Session - 1 to 6 (Default Value = 2)
Now if you select 2 in "RVOL From Session" input and 3 in "RVOL To Session" input, the indicator will calculate RVOL for the 2nd and 3rd hour of the trading day. If you select 3 in both the inputs, then the indicator will give RVOL for the 3rd hour of the trading day.
5. RVOL Trigger - 0.2 to 10 (Default Value = 2)
Filter to find days having RVOL above that value. The indicator turns green (or colour of your choice) when RVOL is more than "RVOL Trigger".
...................................................................................................................................................................................
Hope this indicator will add some value in your trading endeavor.
“Only The Game, Can Teach You The Game” – Jesse Livermore
Yours sincerely,
R4Rocket
**If you have some awesome idea for improvement of the indicator - request you to update the code and share the same.
Sexy RSI for sexy tradersHello fellow sexy traders.
I was tired of constantly having to add my own horizontals/MAs to the default RSI so I decided to make this modification.
The default settings include channels from 40-80 (green horizontals) for a bullish range, and 20-60 (red horizontals) for the bearish range.
Also includes white line at 50 level, and blue horizontals at extremes (90 and 10).
If RSI stays in one of the red or green range that can signify the trend direction, as directed by Andrew Cardwell (inventor of the RSI).
If you wish for other levels to be included, just let me know! Comment on here or dm me on twitter @boss_charts and I can add the settings for you, so all you have to do is click a button and it will set it to your desired config. I want this to be a tool that is useful for heavy traders to save them time.
Additionally, in order to tell the level of the RSI and how overextended it might be, I added the setting for the RSI to change color depending on its level. Current settings are as follows:
Normal RSI (30-70) = PURPLE
Conventional Overbought/Oversold (30-20 + 70-80) = RED
1st extended (20-15 + 80-85) = PINK
2nd extended (15-10 + 85-90) = ORANGE
VERY EXTENDED (<10 + >90) = YELLOW
That way you can get an idea of how drastic a move is by the color alone. According to Dr. Cardwell, a drastic move to over/under extended can be a sign of strength.
Finally, there are the default MAs added that Mr. Cardwell defines as useful for defining the trend. These being the 9 MA and 45 EMA/WMA.
The strategy with these is to have the MAs on both price and RSI. If the 9MA is above the 45 MA on both price and RSI, then this is bullish and you can look for longs.
Conversely, if the 9 is below the 45 on both RSI and price that is bearish, and you can look for shorts.
I added the background color change for the points where the MAs cross each other, so you do not have to have the MAs fogging up your charts to know where they are relative to one another. This is similar to my MA cross indicator which contains the same functionality.
Never financial advice. Backtest it for yourself and find MA configurations that work for you.
Enjoy! Feel free to send feedback/requests whenever.
ADX +- DiThis Adx +-Di is just a complete version of what the ADX is supposed to signal.
So you have:
15 (contraction), 20 (threshold), 30 (expansion), 40 (resistance) levels.
Below 20 the price is not trending
Above 30 the price is trending
Below 15 price has been in contraction for too long
Between 20 and 30 price is in a "transition zone".
I finally added a "Resistance" level (40), which has to be adapted to best represent the historical levels where price usually encounters resistance, and where the price can be declared "overtrending", which means a return to lower levels is likely to happen.
I've chosen mild colors, and set the Adx Color to White, because I use black background, you can easily change that.
Enjoy
-Maurice
GoTiT|Simple Auto Fib v1.0Simple Auto Fib!
Notes:
1. Always set the trend manually! Don't rely on the auto trend detection.
2. The first parameter Length sets the number of candles back (left) to search for highs and lows from the current candle.
3. The High Offset parameter sets the number of candles back (left) to ignore/skip before searching for highs.
4. The Low Offset parameter sets the number of candles back (left) to ignore/skip before searching for lows.
5. The offset parameters change the behavior of the Length parameter.
Example 1:
Length = 100
High Offset = 0
Low Offset = 0
This is the default behavior, and the search for highs and lows occurs on the last 100 candles.
Example 2:
Length = 50
High Offset = 20 (Ignore the last 20 candles, and search for highs starting at candle 21 to 71 (or 50 candles back)
Low Offset = 15 (Ignore the last 15 candles, and search for lows starting at candle 16 to 66 (or 50 candles back)
In example 2, search starts on candle 21 for highs, and candle 16 for lows and extends 50 candles further back from there.
6. The Trend Detection parameter sets the number of candles back (left) to use in the trend calculations. Larger values give better "marco trend" detection. Smaller values give better "micro trend" detection. See note #1.
7. The white fib line is fib0. Assuming you correctly set the trend manually (or the trend is auto detected correctly), in a downtrend fib0 should be bellow the red fib line, and in an uptrend fib0 should be above the red fib line.
BITFLYER's SFD by CalendarHi guys, I am Calendar.
My first customized indicator is SFD difference in Bitflyer
Bitflyer exchange charges penalties to long postion if difference between FXBTC/JPY and BTC/JPY is more than 5, 10, 15, 20%
So, it is selling signal when the difference is higher than 5, 10, 15, 20%
Plz check “setting” -> “Scales” -> “Indicator Last Value”
3 Linear Regression CurveFast 3LRC - 15/30/60 standard settings - 15/30 give a lot of noise, but give you a some time to prepare for the 60 to flip
Noro's OverCloud v1.2 MTFAdded big timeframe
MN = 1 month
W = 1 week
D = 1 day
240 = 4 hours
180 = 3 hours
120 = 2 hours
60 = 1 hours
30 = 30 min
15 = 15 min
etc...
Fractal Resonance BarLazyBear's WaveTrend port has been praised for highlighting trend reversals with precision and punctuality (minimal lag). But strong "3rd Wave" trends can "embed" or saturate any oscillator flashing several premature crosses while stuck overbought/oversold. This happens when the trend stretches over a longer timescale than the oscillator's averaging window or filter time constant. Our solution: monitor many timescales. With Fractal Resonance Bar's rich color codings, strong wavefronts form across timescales and jump out like an approaching line of thunderclouds!
Fractal Resonance Bar color-codes the status of eight underlying stochastic oscillators, with each row averaging over twice the time of the row above.
Fractal Resonance Bar shifts its timescales along with your choice of main chart timescale:
1 minute chart: 1 minute through 128 minute (~2 hour) oscillators.
15 minute chart: 15 minute through 1920 minute (~32 hour) oscillators.
1 hour chart: 1 hour through 128 hour (~2 week) oscillators.
Daily chart: 1 day through 128 day (~4 month) oscillators.
The color map is configured as follows:
Hot Pink: Extreme Overbought (> 100%) rolled over to sell, but oscillators probably embedded with more upside (revert to Dark Green) possible after a pause.
Deep Red: Overbought (> 75%) crossover ripe for selling (validated when red spreads to timescales below).
Brown: Minor (< 75%) crossover sell from which could bounce back green or start a plunge toward gray/black.
Gray/Black: Mature (< -75%) sells turning full black in a plunge before the dawn.
Lime Green: Extreme Oversold (< -100%) and bouncing, though may yet bottom even lower.
Green: Oversold (< -75%) crossover ripe for buy. Green spreading to all timescales below will validate bottom is in.
Dark Green/Teal: Mature buy in overbought (> 75%) range, waiting for sell crossover to Hot Pink for a pause or correction.
White Stripes are Impulsive Trend Warning
Fractal Resonance Bar warns of oscillator embedding by showing white stripes when it detects strong, early surges in the timescale rows below.The white stripes usually accompany Hot Pink warning it's too early to go short, or Lime Green warning it's too early to go long.
Heeding these warnings will probably miss the exact top or bottom, but you're less likely to get overrun in a momentum move.
Usually the market gives us a second opportunity to short very close to the top or buy very close to the bottom after the warning white stripes have subsided.
NOTE: Recently rolled over Futures contracts may not have enough history for all oscillator calculations, in which case no bar colors will appear.
Tweakable Attributes
The default Channel Length, Stochastic Ratio Length and Lag Length work reasonably well on all timescales in our experience. Minor tweaks don't hurt but this may just overfit to a particular chart history.
We don't recommend changing the 75% Overbought and 100% Extreme Overbought default levels as these are ideal numbers relative to the underlying oscillator statistic calculations. But these settings can shift the color transition levels.
Embedded attribute controls the sensitivity/conservativeness of the white strip embedding detectors. Closer to 75 increases the warning sensitivity while closer to 100 decreases the aggressiveness of blocking white stripes.
Embed Separation also affects the white stripe sensitivity.
Row width increases each row's thickness to fill the available screen height you've afforded the bar.
Trend and Entry CCI ST15This is a T3 CCI with a fast and slow line as well as extreme lines, a -15,15 filter to make zero line rejections and crosses more mechanical and help weed out whipsaw. I will probably update description in the future and get into more detail about how the indicator is used but for now if you want more info look up woodie CCI patterns :) Good Luck!!
extended session - Regular Opening-Range- JayyOpening Range and some other scripts updated to plot correctly (see comments below.) There are three variations of the fibonacci expansion beyond the opening range and retracements within the opening range of the US Market session - I have not put in the script for the other markets yet.
The three scripts have different uses and strengths:
The extended session script (with the script here below) will plot the opening range whether you are using the extended session or the regular session. (that is to say whether "ext" in the lower right hand corner is highlighted or not.). While in the extended session the opening range has some plotting issues with periods like 13 minutes or any period that is not divisible into 330 mins with a round number outcome (eg 330/60 =5.5. Therefore an hour long opening range has problems in the extended session.
The pre session script is only for the premarket. You can select any opening range period you like. I have set the opening range to be the full premarket session. If you select a different session you will have to unselect "pre open to 9:30 EST for Opening Range?" in the format section. The script defaults to 15 minutes in the "period Of Pre Opening Range?". To go back to the 4 am to 9:30 pre opening range select "pre open to 9:30 EST for Opening Range?" there is no automatic 330 minute selection.
The past days offset script only works in 5 min or 15 minute period. It will show the opening range from up to 20 days past over the current days price action. Use this for the regular session only. 0 shows the current day's opening range. Use the positive integers for number of days back ie 1, 2, 3 etc not -1, -2, -3 etc. The script is preprogrammed to use the current day (0).
Scripts updated to plot correctly: One thing they all have in common is a way of they deal with a somewhat random problem that shifts the plots 4 hours in one direction or the other ie the plot started at 9:30 EST or 1:30PM EST. This issue started to occur approximately June 22, 2015 and impacts any script that tried to use "session" times to manage a plot in my scripts. The issue now seems to have been resolved during this past week.
Just in case the problem reoccurs I have added a "Switch session plot?" to each script. If the plot looks funny check or uncheck the "Switch session plot?" and see the difference. Of course if a new issue crops up it will likely require a different fix.
I have updated all of the scripts shown on this chart. If you are using a script of mine that suffers from the compiler issue then you will find an update on this chart. You can get any and all of the scripts by clicking on the small sideways wishbone on the left middle of the chart. You will see a dialogue box. Then click "make it mine". This will import all of the scripts to your computer and you can play around with them all to decide what you want and what you don't want. This is the easiest way to get all of the scripts in one fell swoop. It is also the easiest way for me to make all of the scripts available. I do not have all of the plots visible since it is too messy and one of the scripts (pre OR) is only for the regular session. To view the scripts click on the blue eye to the right of the script title to show it on this script. If you can only use the regular session. The scripts will all (with the exception of the pre OR) work fine.
If for any reason this script seems flakey refresh the page r try a slightly different period. I have noticed that sometimes randomly the script loves to return to the 5 min OR. This is a very new issue transient issue. As always if you see an issue please let me know.
Cheers Jayy
BB 100 with Barcolors6/19/15 I added confirmation highlight bars to the code. In other words, if a candle bounced off the lower Bollinger band, it needed one more close above the previous candle to confirm a higher probability that a change in investor sentiment has reversed. Same is true for upper Bollinger band bounces. I also added confirmation highlight bars to the 100 sma (the basis). The idea is that lower and upper bands are potential points of support and resistance. The same is true of the basis if a trend is to continue. 6/28/15 I added a plotshape to identify closes above/below TLine. One thing this system points out is it operates best in a trend reversal. Consolidations will whipsaw the indicator too much. I have found that when this happens, if using daily candles, switch to hourly, 30 min, etc., to catch a better signal. Nothing moves in a straight line. As with any indicator, it is a tool to be used in conjunction with the art AND science of trading. As always, try the indicator for a time so that you are comfortable enough to use real money. This is designed to be used with "BB 25 with Barcolors".
BB 25 with Barcolors6/19/15 I added confirmation highlight bars to the code. In other words, if a candle bounced off the lower Bollinger band, it needed one more close above the previous candle to confirm a higher probability that a change in investor sentiment has reversed. Same is true for upper Bollinger band bounces. I also added confirmation highlight bars to the 100 sma (the basis). The idea is that lower and upper bands are potential points of support and resistance. The same is true of the basis if a trend is to continue. 6/28/15 I added a plotshape to identify closes above/below TLine. One thing this system points out is it operates best in a trend reversal. Consolidations will whipsaw the indicator too much. I have found that when this happens, if using daily candles, switch to hourly, 30 min, etc., to catch a better signal. Nothing moves in a straight line. As with any indicator, it is a tool to be used in conjunction with the art AND science of trading. As always, try the indicator for a time so that you are comfortable enough to use real money. This is designed to be used with "BB 100 with Barcolors".
KK_Intraday MAsHey guys,
today I was browsing through intraday Charts looking at some moving averages. Basically what I wanted to see was whether the currency pair was trading below or above the moving average of the day/week/month. For a better understanding: The daily MA on a 15 minute Forex Chart would be the 96 MA.
I encountered the problem that i always had to change the settings for my MAs when changing the Time Interval, so I coded this here up. It is pretty simple but maybe somebody else has the same problem and can put it to use.
The script has some settings as listed below:
Choice which MAs to plot, (Daily, Weekly, Monthly)
Choice which type of MA to use (Simple, Exponential, Weighted)
Neccesary Settings for the correct calculation (e.g. Number of trading hours per day). These settings depend on the instrument you are using and should always be checked before using this script.
There are a few things to Note when using this script:
This script works for intraday charts only.
The monthly MA doesn't work on any Time Interval smaller than 15 minutes. Can't do anything about it unfortunately.
This is my first published Script, use it with caution and let me know what you think about it!
Opening Range Breakout with 2 Profit Targets.Opening Range Breakout with 2 Profit Targets.
Updated Indicator now works on all Symbols with Many Different Session Options.
***Known PineScript Issue…While the Opening Range is being Formed the lines only adjust for that individual bar. Just reset Indicator after Opening Range Completes.
***All Times are Based on New York Time
Session Options Forex U.S. Banks Open (8:00), Gold U.S. Open (8:20), Oil U.S. Open (9:00), U.S. Cash Session - Stocks (9:30), NY Forex Open (17:00) , Europe Open (02:00), or if you choose Setting 0 the Session Runs from 00:00 to 00:00 (Midnight to Midnight).
***Ability to use 60 minute Opening Range, 30 minute, 15 minute, and many other options.
***However you can manually change the times in the Inputs Tab to adjust for any session you prefer. This is useful for Day Light Savings Adjustments. Also the default times work if your charts are set to EST Time. If you use A different time zone in your settings you need to Adjust the times in the inputs tab.
Initially Opening Range High and Low plot as Yellow Lines. If Price Goes Above Opening Range then Line Turns Green. If Price Goes Below Opening Range Line Turns Red.
By default the First Profit Target is 1/2 the Width of the Opening Range and the 2nd Profit Target is 1 Times the Opening Range. However these are Adjustable in the Inputs Tab.
By Default the Opening Range Length is 1 Hour. However, you can Change the Opening Range Length to 15 min, 30 min, 2 hours etc. in the Inputs Tab.
Plots a 1 Above or Below Candle when 1st Profit Target is Achieved, and a 2 when 2nd Profit Target is Achieved.
Indicator: Trend Trigger FactorIntroduced by M.H.Pee, Trend Trigger Factor is designed to keep the trader trading with the trend.
System rules according to the developer:
* If the 15-day TTF is above 100 (indicating an uptrend), you will want to be in long positions.
* If the 15-day TTF is below -100, you will want to be short.
* If it is between -100 and 100, you should remain with the current position.
More info:
Original Article by Mr.Pee: drive.google.com
Artharjan ADXArtharjan ADX (AADX) by Rrahul Desai @Artharjan
📌 Overview
The Artharjan ADX (AADX) is an advanced implementation of the Average Directional Index (ADX) with customizable moving averages, momentum thresholds, and visually intuitive grading of bullish and bearish strength.
Unlike the standard ADX indicator that only shows trend strength, AADX adds graded bullish/bearish conditions, alerts, smoothed DI signals, histogram visualizations, and background color fills to help traders quickly interpret market conditions.
It is designed for traders who want early detection of trend strength, clean visual cues, and automated alert triggers for both bullish and bearish momentum setups.
⚙️ Key Features
🔹 Customizable Calculations
DI Length (default 13) – controls sensitivity of directional indicators.
+/- DI Smoothing – smooths DI signals with user-selected MA.
Multiple Moving Average Types – SMA, EMA, WMA, RMA, VWMA, ALMA, Hull, SWMA, SMMA, TMA.
ADX Smoothing – define how smooth/fast the ADX reacts.
🔹 Flexible Display
Toggle between line plots or histogram view.
Adjustable plot thickness.
Option to plot averages of ADX, +DI, -DI for confirmation.
Configurable background fills:
ADX above/below momentum threshold.
ADX rising/falling color shading.
Trend-grade based color intensity.
🔹 Momentum & Thresholds
Momentum Level (default 25) → defines “strong trend” zone.
Crossover Threshold (default 15) → helps detect early DI crossovers.
Color-coded histogram bars for +DI vs -DI difference:
Above/below zero.
Rising/falling momentum.
🔹 Bullish & Bearish Grading System
The indicator assigns grades from 1 to 5 for both bullish and bearish setups, based on DI and ADX conditions:
Bullish Grades
Grade 1 → Very Weak Bullish
Grade 2 → Weak Bullish
Grade 3 → Moderate Bullish
Grade 4 → Strong Bullish
Grade 5 → Very Strong Bullish
Bearish Grades
Grade 1 → Very Weak Bearish
Grade 2 → Weak Bearish
Grade 3 → Moderate Bearish
Grade 4 → Strong Bearish
Grade 5 → Very Strong Bearish
Labels are automatically plotted above bars to indicate the active grade.
🔹 Alerts
Bullish Alert → when +DI crosses above its average below the threshold OR bullish conditions are met.
Bearish Alert → when -DI crosses above its average below the threshold OR bearish conditions are met.
These alerts make it possible to automate trading signals for scalping, intraday, and swing trading.
📊 Use Cases
Trend Strength Measurement
Spot when markets shift from range-bound to trending.
Confirm the reliability of breakouts with strong ADX readings.
Bullish vs Bearish Control
Compare +DI vs -DI strength to gauge trend direction.
Identify trend reversals early with DI slope changes.
Momentum Confirmation
Use ADX rising + DI grades to validate trade entries.
Filter false breakouts with weak ADX.
Trade Grading System
Enter aggressively on Grade 4–5 signals.
Stay cautious on Grade 1–2 signals.
Automated Alerts & Screening
Combine AADX alerts with strategy rules.
Build scanners to highlight strong ADX setups across multiple stocks.
🎯 Trader’s Advantage
More powerful than standard ADX → Adds slope, grading, alerts, and visualization.
Adaptable to any style → Works for intraday scalping, swing trading, and positional analysis.
Visual clarity → Color fills, histograms, and labels simplify decision-making.
Customizable smoothing → Adjusts to fast or slow markets.
✅ Closing Note
The Artharjan ADX (AADX) transforms the traditional ADX into a complete trend and momentum analyzer. It helps traders detect, confirm, and act on directional strength with clarity and confidence.
With Thanks,
Rrahul Desai
@Artharjan
Sunset Zones by PDVDescription
Sunset Zones by PDV is an intraday reference indicator that plots key horizontal levels based on selected “root candles” throughout the trading day. At each programmed time, the indicator identifies the high and low of the corresponding candle and projects those levels forward with extended lines, providing traders with a clean visual framework of potential intraday reaction zones.
These zones serve as reference levels for support, resistance, liquidity grabs, and session context, allowing traders to analyze how price reacts around time-specific structures. Unlike lagging indicators, Sunset Zones gives traders real-time, rule-based levels tied directly to the price action of specific moments in the session.
Key Features
Predefined Time Codes
The script comes with a curated list of intraday timestamps (in HHMM format). Each represents a “root candle” from which levels are generated. Examples include 03:12, 06:47, 07:41, 08:51, etc. These time codes can reflect historically important market moments such as session opens, liquidity sweeps, or volatility inflection points.
Automatic Zone Plotting
At each root time, the script captures the candle’s high and low and instantly extends those levels forward across the chart. This provides consistent, objective reference points for intraday trading.
Extended Lines
Levels are projected far into the future (default: 500 bars) so traders can easily track how price interacts with those zones throughout the day.
Color-Coded Levels
Each root time is assigned a distinct color for fast identification. For example:
03:12 → Fuchsia
06:47 → Purple
07:41 → Teal
08:51 → White
09:53 → White
10:20 → Orange
11:10 → Green
11:49 → Red
12:05 → White
13:05 → Teal
14:09 → Aqua
This helps traders quickly recognize which time-of-day level price is interacting with.
Lightweight & Visual
The indicator focuses purely on price and time, avoiding complexity or lagging signals. It can be layered with other analysis tools, order flow charts, or session-based studies.
Practical Use Cases
Intraday Bias:
Observe whether price respects, rejects, or consolidates around these reference levels to form a bias.
Liquidity Zones:
High/low sweeps of the root candle can act as liquidity pools where institutions might trigger stops or reversals.
Support & Resistance:
Extended lines create intraday S/R zones without the need to manually draw levels.
Confluence Finder:
Combine Sunset Zones with VWAP, session ranges, Fibonacci levels, or higher-timeframe structure for layered confluence.
Important Notes
This is a visual reference tool only. It does not generate buy or sell signals.
Default times are provided, but the concept is flexible — traders can adapt it by modifying or expanding the list of time codes.
Works best on intraday timeframes where session structure is most relevant (e.g., 1-minute to 15-minute charts).
✅ In short: Sunset Zones by PDV gives intraday traders a systematic way to anchor their charts to important time-based highs and lows, creating a consistent framework for analyzing price reactions across the day.
Optimized ADX DI CCI Strategy### Key Features:
- Combines ADX, DI+/-, CCI, and RSI for signal generation.
- Supports customizable timeframes for indicators.
- Offers multiple exit conditions (Moving Average cross, ADX change, performance-based stop-loss).
- Tracks and displays trade statistics (e.g., win rate, capital growth, profit factor).
- Visualizes trades with labels and optional background coloring.
- Allows countertrading (opening an opposite trade after closing one).
1. **Indicator Calculation**:
- **ADX and DI+/-**: Calculated using the `ta.dmi` function with user-defined lengths for DI and ADX smoothing.
- **CCI**: Computed using the `ta.cci` function with a configurable source (default: `hlc3`) and length.
- **RSI (optional)**: Calculated using the `ta.rsi` function to filter overbought/oversold conditions.
- **Moving Averages**: Used for CCI signal smoothing and trade exits, with support for SMA, EMA, SMMA (RMA), WMA, and VWMA.
2. **Signal Generation**:
- **Buy Signal**: Triggered when DI+ > DI- (or DI+ crosses over DI-), CCI > MA (or CCI crosses over MA), and optional ADX/RSI filters are satisfied.
- **Sell Signal**: Triggered when DI+ < DI- (or DI- crosses over DI+), CCI < MA (or CCI crosses under MA), and optional ADX/RSI filters are satisfied.
3. **Trade Execution**:
- **Entry**: Long or short trades are opened using `strategy.entry` when signals are detected, provided trading is allowed (`allow_long`/`allow_short`) and equity is positive.
- **Exit**: Trades can be closed based on:
- Opposite signal (if no other exit conditions are used).
- MA cross (price crossing below/above the exit MA for long/short trades).
- ADX percentage change exceeding a threshold.
- Performance-based stop-loss (trade loss exceeding a percentage).
- **Countertrading**: If enabled, closing a trade triggers an opposite trade (e.g., closing a long opens a short).
4. **Visualization**:
- Labels are plotted at trade entries/exits (e.g., "BUY," "SELL," arrows).
- Optional background coloring highlights open trades (green for long, red for short).
- A statistics table displays real-time metrics (e.g., capital, win rates).
5. **Trade Tracking**:
- Tracks the number of long/short trades, wins, and overall performance.
- Monitors equity to prevent trading if it falls to zero.
### 2.3 Key Components
- **Indicator Calculations**: Uses `request.security` to fetch indicator data for the specified timeframe.
- **MA Function**: A custom `ma_func` handles different MA types for CCI and exit conditions.
- **Signal Logic**: Combines crossover/under checks with recent bar windows for flexibility.
- **Exit Conditions**: Multiple configurable exit strategies for risk management.
- **Statistics Table**: Updates dynamically with trade and capital metrics.
## 3. Configuration Options
The script provides extensive customization through input parameters, grouped for clarity in the TradingView settings panel. Below is a detailed breakdown of each setting and its impact.
### 3.1 Strategy Settings (Global)
- **Initial Capital**: Default `10000`. Sets the starting capital for backtesting.
- **Effect**: Determines the base equity for calculating position sizes and performance metrics.
- **Default Quantity Type**: `strategy.percent_of_equity` (50% of equity).
- **Effect**: Controls the size of each trade as a percentage of available equity.
- **Pyramiding**: Default `2`. Allows up to 2 simultaneous trades in the same direction.
- **Effect**: Enables multiple entries if conditions are met, increasing exposure.
- **Commission**: 0.2% per trade.
- **Effect**: Simulates trading fees, reducing net profit in backtesting.
- **Margin**: 100% for long and short trades.
- **Effect**: Assumes no leverage; adjust for margin trading simulations.
- **Calc on Every Tick**: `true`.
- **Effect**: Ensures real-time signal updates for precise execution.
### 3.2 Indicator Settings
- **Indicator Timeframe** (`indicator_timeframe`):
- **Options**: `""` (chart timeframe), `1`, `5`, `15`, `30`, `60`, `240`, `D`, `W`.
- **Default**: `""` (uses chart timeframe).
- **Effect**: Determines the timeframe for ADX, DI, CCI, and RSI calculations. A higher timeframe reduces noise but may delay signals.
### 3.3 ADX & DI Settings
- **DI Length** (`adx_di_len`):
- **Default**: `30`.
- **Range**: Minimum `1`.
- **Effect**: Sets the period for calculating DI+ and DI-. Longer periods smooth trends but reduce sensitivity.
- **ADX Smoothing Length** (`adx_smooth_len`):
- **Default**: `14`.
- **Range**: Minimum `1`.
- **Effect**: Smooths the ADX calculation. Longer periods produce smoother ADX values.
- **Use ADX Filter** (`use_adx_filter`):
- **Default**: `false`.
- **Effect**: If `true`, requires ADX to exceed the threshold for signals to be valid, filtering out weak trends.
- **ADX Threshold** (`adx_threshold`):
- **Default**: `25`.
- **Range**: Minimum `0`.
- **Effect**: Sets the minimum ADX value for valid signals when the filter is enabled. Higher values restrict trades to stronger trends.
### 3.4 CCI Settings
- **CCI Length** (`cci_length`):
- **Default**: `20`.
- **Range**: Minimum `1`.
- **Effect**: Sets the period for CCI calculation. Longer periods reduce noise but may lag.
- **CCI Source** (`cci_src`):
- **Default**: `hlc3` (average of high, low, close).
- **Effect**: Defines the price data for CCI. `hlc3` is standard, but users can choose other sources (e.g., `close`).
- **CCI MA Type** (`ma_type`):
- **Options**: `SMA`, `EMA`, `SMMA (RMA)`, `WMA`, `VWMA`.
- **Default**: `SMA`.
- **Effect**: Determines the moving average type for CCI signal smoothing. EMA is more responsive; VWMA weights by volume.
- **CCI MA Length** (`ma_length`):
- **Default**: `14`.
- **Range**: Minimum `1`.
- **Effect**: Sets the period for the CCI MA. Longer periods smooth the MA but may delay signals.
### 3.5 RSI Filter Settings
- **Use RSI Filter** (`use_rsi_filter`):
- **Default**: `false`.
- **Effect**: If `true`, applies RSI-based overbought/oversold filters to signals.
- **RSI Length** (`rsi_length`):
- **Default**: `14`.
- **Range**: Minimum `1`.
- **Effect**: Sets the period for RSI calculation. Longer periods reduce sensitivity.
- **RSI Lower Limit** (`rsi_lower_limit`):
- **Default**: `30`.
- **Range**: `0` to `100`.
- **Effect**: Defines the oversold threshold for buy signals. Lower values allow trades in more extreme conditions.
- **RSI Upper Limit** (`rsi_upper_limit`):
- **Default**: `70`.
- **Range**: `0` to `100`.
- **Effect**: Defines the overbought threshold for sell signals. Higher values allow trades in more extreme conditions.
### 3.6 Signal Settings
- **Cross Window** (`cross_window`):
- **Default**: `0`.
- **Range**: `0` to `5` bars.
- **Effect**: Specifies the lookback period for detecting DI+/- or CCI crosses. `0` requires crosses on the current bar; higher values allow recent crosses, increasing signal frequency.
- **Allow Long Trades** (`allow_long`):
- **Default**: `true`.
- **Effect**: Enables/disables new long trades. If `false`, only closing existing longs is allowed.
- **Allow Short Trades** (`allow_short`):
- **Default**: `true`.
- **Effect**: Enables/disables new short trades. If `false`, only closing existing shorts is allowed.
- **Require DI+/DI- Cross for Buy** (`buy_di_cross`):
- **Default**: `true`.
- **Effect**: If `true`, requires a DI+ crossover DI- for buy signals; if `false`, DI+ > DI- is sufficient.
- **Require CCI Cross for Buy** (`buy_cci_cross`):
- **Default**: `true`.
- **Effect**: If `true`, requires a CCI crossover MA for buy signals; if `false`, CCI > MA is sufficient.
- **Require DI+/DI- Cross for Sell** (`sell_di_cross`):
- **Default**: `true`.
- **Effect**: If `true`, requires a DI- crossover DI+ for sell signals; if `false`, DI+ < DI- is sufficient.
- **Require CCI Cross for Sell** (`sell_cci_cross`):
- **Default**: `true`.
- **Effect**: If `true`, requires a CCI crossunder MA for sell signals; if `false`, CCI < MA is sufficient.
- **Countertrade** (`countertrade`):
- **Default**: `true`.
- **Effect**: If `true`, closing a trade triggers an opposite trade (e.g., close long, open short) if allowed.
- **Color Background for Open Trades** (`color_background`):
- **Default**: `true`.
- **Effect**: If `true`, colors the chart background green for long trades and red for short trades.
### 3.7 Exit Settings
- **Use MA Cross for Exit** (`use_ma_exit`):
- **Default**: `true`.
- **Effect**: If `true`, closes trades when the price crosses the exit MA (below for long, above for short).
- **MA Length for Exit** (`ma_exit_length`):
- **Default**: `20`.
- **Range**: Minimum `1`.
- **Effect**: Sets the period for the exit MA. Longer periods delay exits.
- **MA Type for Exit** (`ma_exit_type`):
- **Options**: `SMA`, `EMA`, `SMMA (RMA)`, `WMA`, `VWMA`.
- **Default**: `SMA`.
- **Effect**: Determines the MA type for exit signals. EMA is more responsive; VWMA weights by volume.
- **Use ADX Change Stop-Loss** (`use_adx_stop`):
- **Default**: `false`.
- **Effect**: If `true`, closes trades when the ADX changes by a specified percentage.
- **ADX % Change for Stop-Loss** (`adx_change_percent`):
- **Default**: `5.0`.
- **Range**: Minimum `0.0`, step `0.1`.
- **Effect**: Specifies the percentage change in ADX (vs. previous bar) that triggers a stop-loss. Higher values reduce premature exits.
- **Use Performance Stop-Loss** (`use_perf_stop`):
- **Default**: `false`.
- **Effect**: If `true`, closes trades when the loss exceeds a percentage threshold.
- **Performance Stop-Loss (%)** (`perf_stop_percent`):
- **Default**: `-10.0`.
- **Range**: `-100.0` to `0.0`, step `0.1`.
- **Effect**: Specifies the loss percentage that triggers a stop-loss. More negative values allow larger losses before exiting.
## 4. Visual and Statistical Output
- **Labels**: Displayed at trade entries/exits with arrows (↑ for buy, ↓ for sell) and text ("BUY," "SELL"). A "No Equity" label appears if equity is zero.
- **Background Coloring**: Optionally colors the chart background (green for long, red for short) to indicate open trades.
- **Statistics Table**: Displayed at the top center of the chart, updated on timeframe changes or trade events. Includes:
- **Capital Metrics**: Initial capital, current capital, capital growth (%).
- **Trade Metrics**: Total trades, long/short trades, win rate, long/short win rates, profit factor.
- **Open Trade Status**: Indicates if a long, short, or no trade is open.
## 5. Alerts
- **Buy Signal Alert**: Triggered when `buy_signal` is true ("Cross Buy Signal").
- **Sell Signal Alert**: Triggered when `sell_signal` is true ("Cross Sell Signal").
- **Usage**: Users can set up TradingView alerts to receive notifications for trade signals.
Renko RSI (Brick-Triggered, Red/Green Only) MODIFIEDhe Renko RSI (Brick-Triggered, Red/Green Only) Modified indicator is a specialized trading tool designed for use with Renko charts, which focus solely on price movements rather than time. This modified version enhances the traditional Renko RSI by triggering signals based on brick formations (price blocks) and uses only red and green colors to indicate trend direction—green for bullish (upward) trends and red for bearish (downward) trends. It integrates the Relative Strength Index (RSI) to identify potential reversals or continuations when Renko bricks change direction, filtering out market noise for clearer trend analysis. The indicator is tailored to highlight high-probability entry and exit points, making it suitable for traders seeking a simplified, visual approach to spotting trends and reversals, especially on assets like crypto on short timeframes such as 15-minute or 1-hour charts.
Smart Structure Breaks & Order BlocksOverview (What it does)
The indicator “Smart Structure Breaks & Order Blocks” detects market structure using swing highs and lows, identifies Break of Structure (BOS) events, and automatically draws order blocks (OBs) from the origin candle. These zones extend to the right and change color/outline when mitigated or invalidated. By formalizing and automating part of discretionary analysis, it provides consistent zone recognition.
Main Components
Swing Detection: ta.pivothigh/ta.pivotlow identify confirmed swing points.
BOS Detection: Determines if the recent swing high/low is broken by close (strict mode) or crossover.
OB Creation: After a BOS, the opposite candle (bearish for bullish BOS, bullish for bearish BOS) is used to generate an order block zone.
Zone Management: Limits the number of zones, extends them to the right, and tracks tagged (mitigated) or invalidated states.
Input Parameters
Left/Right Pivot (default 6/6): Number of bars required on each side to confirm a swing. Higher values = smoother swings.
Max Zones (default 4): Maximum zones stored per direction (bull/bear). Oldest zones are overwritten.
Zone Confirmation Lookback (default 3): Ensures OB origin candle validity by checking recent highs/lows.
Show Swing Points (default ON): Displays triangles on swing highs/lows.
Require close for BOS? (default ON): Strict BOS (close required) vs loose BOS (line crossover).
Use candle body for zones (default OFF): Zones drawn from candle body (ON) or wick (OFF).
Signal Definition & Logic
Swing Updates: Latest confirmed pivots update lastHighLevel / lastLowLevel.
BOS (Break of Structure):
Bullish – close breaks last swing high.
Bearish – close breaks last swing low.
Only one valid BOS per swing (avoids duplicates).
OB Detection:
Bullish BOS → previous bearish candle with lowest low forms the OB.
Bearish BOS → previous bullish candle with highest high forms the OB.
Zones: Bull = green, Bear = red, semi-transparent, extended to the right.
Zone States:
Mitigated: Price touches the zone → border highlighted.
Invalidated:
Bull zone → close below → turns red.
Bear zone → close above → turns green.
Chart Appearance
Swing High: red triangle above bar
Swing Low: green triangle below bar
Bull OB: green zone (border highlighted on touch)
Bear OB: red zone (border highlighted on touch)
Invalid Zones: Bull zones turn reddish, Bear zones turn greenish
Practical Use (Trading Assistance)
Trend Following Entries: Buy pullbacks into green OBs in uptrends, sell rallies into red OBs in downtrends.
Focus on First Touch: First mitigation after BOS often has higher reaction probability.
Confluence: Combine with higher timeframe trend, volume, session levels, key price levels (previous highs/lows, VWAP, etc.).
Stops/Targets:
Bull – stop below zone, partial take profit at swing high or resistance.
Bear – stop above zone, partial take profit at swing low or support.
Parameter Tuning (per market/timeframe)
Pivot (6/6 → 4/4/8/8): Lower for scalping (3–5), medium for day trading (5–8), higher for swing trading (8–14). Increase to reduce noise.
Strict Break: ON to reduce false breaks in ranging markets; OFF for earlier signals.
Body Zones: ON for assets with long wicks, OFF for cleaner OBs in liquid instruments.
Zone Confirmation (default 3): Increase for stricter OB origin, fewer zones.
Max Zones (default 4 → 6–10): Increase for higher volatility, decrease to avoid clutter.
Strengths
Standardizes BOS and OB detection that is usually subjective.
Tracks mitigation and invalidation automatically.
Adaptable: allows body/wick zone switching for different instruments.
Limitations
Pivot-based: Signals appear only after pivots confirm (slight lag).
Zones reflect past balance: Can fail after new events (news, earnings, macro data).
Range-heavy markets: More false BOS; consider stricter settings.
Backtesting: This script is for drawing/visual aid; trading rules must be defined separately.
Workflow Example
Identify higher timeframe trend (4H/Daily).
On lower TF (15–60m), wait for BOS and new OB.
Enter on first mitigation with confirmation candle.
Stop beyond zone; targets based on R multiples and swing points.
FAQ
Q: Why are zones invalidated quickly?
A: Flow reversal after BOS. Adjust pivots higher, enable Strict mode, or switch to Body zones to reduce noise.
Q: What does “tagged” mean?
A: Price touched the zone once = mitigated. Implies some orders in that zone may have been filled.
Q: Body or Wick zones?
A: Wick zones are fine in clean markets. For volatile pairs with long wicks, body zones provide more realistic areas.
Customization Tips (Code perspective)
Zone storage: Currently ring buffer ((idx+1) % zoneLimit). Could prioritize keeping unmitigated zones.
Automated testing: Add strategy.entry/exit for rule-based backtests.
Multi-timeframe: Use request.security() for higher timeframe swings/BOS.
Visualization: Add labels for BOS bars, tag zones with IDs, count touches.
Summary
This indicator formalizes the cycle Swing → BOS → OB creation → Mitigation/Invalidation, providing consistent structure analysis and zone tracking. By tuning sensitivity and strictness, and combining with higher timeframe context, it enhances pullback/continuation trading setups. Always combine with proper risk management.