VWAP filtered MACD Bars with positive MACD histogram value and closing above VWAP are colored, long positions should be taken in areas made of those bars.
Similarly, bars with negative MACD histogram value and closing below VWAP are also colored, short positions should be taken there.
This indicator by default should be a part of your trend following trading system.
In the setting you can change colors
Above grow: positive and rising MACD histogram value
Above fall: positive and falling MACD histogram value
Below fall: negative and falling MACD histogram value
Below grow: negative and rising MACD histogram value
Trend
Price Swing Detection - Smart Money ConceptSince my own style is Smart Money Concept and these days I have seen a lot of my friends who are having trouble identifying structures for their indicators and strategies. I wrote this code so they could use it in their strategy . In fact, this type of structure, as one of the strongest technical structures, can increase the success of your strategy according to your personalization.
The script detects swings (i.e. significant highs and lows) in a financial instrument's price action over a specified period. The user can set the lookback period (number of candles to consider) and the colors of the lines representing bullish and bearish trends.
The script has two functions: detectSwing and pivot high. The detectSwing function calculates the swing highs and lows for the specified number of candles. The function uses the ta.highest and ta.lowest functions to find the highest and lowest prices, respectively, over the lookback period. The function also determines the swing state (high or low) of the current candle and returns the calculated swing values.
The pivot high function calculates the pivot high, which is an important step in detecting bullish structures in the market. If a new top (i.e. swing high) is found, the script updates the pivot high values and creates a line from the recent top to the last bar. The script also updates the trailing maximum values, which are used to extend the top extension line.
For Strategy :
The variable "trendDirection" in the code is used to keep track of the trend state, either bullish (up trend) or bearish (down trend), in the market. The variable is initialized to 0 which represents a downtrend. The value of this variable is updated later in the code based on the calculations of swing highs and lows, pivot crosses, and the trailing maximum. If a bullish structure is detected, the value of "trendDirection" is set to 1, indicating an uptrend.
PinBar Detector [Mr_Zed]Pinbar Detector is a technical analysis tool designed to detect Pinbar patterns in financial markets. Pinbars are reversal patterns that indicate a potential change in trend.
This indicator is based on an existing Pinbar detector in MQ4/5 format, originally developed by "earnforex".
The PineScript version is written to work in TradingView, and can be applied to any chart to identify Pinbar formations. The indicator uses specific criteria to identify Pinbars, such as the length of the wick and the relationship between the wick and the body of the candlestick. By displaying the Pinbars on the chart, traders can make informed decisions about entering or exiting trades based on their analysis of the market's potential trend reversal.
enjoy !
[@btc_charlie] Trader XO Macro Trend ScannerWhat is this script?
This script has two main functions focusing on EMAs (Exponential Moving Average) and Stochastic RSI.
EMAs
EMAs are typically used to give a view of bullish / bearish momentum. When the shorter EMA (calculated off more recent price action) crosses, or is above, the slower moving EMA (calculated off a longer period of price action), it suggests that the market is in an uptrend. This can be an indication to either go long on said asset, or that it is more preferable to take long setups over short setups. Invalidation on long setups is usually found via price action (e.g. previous lows) or simply waiting for an EMA cross in the opposite direction (i.e. shorter EMA crosses under longer term EMA).
This is not a perfect system for trade entry or exit, but it does give a good indication of market trends. The settings for the EMAs can be changed based on user inputs, and by default the candles are coloured based on the crosses to make it more visual. The default settings are based on “Trader XO’s” settings who is an exceptional swing trader.
RSI
Stochastic RSI is a separate indicator that has been added to this script. RSI measures Relative Strength (RSI = Relative Strength Index). When RSI is <20 it is considered oversold, and when >80 it is overbought. These conditions suggests that momentum is very strong in the direction of the trend.
If there is a divergence between the price (e.g. price is creating higher highs, and stoch RSI is creating lower highs) it suggests the strength of the trend is weakening. Whilst this script does not highlight divergences, what it does highlight is when the shorter term RSI (K) crosses over D (the average of last 3 periods). This can give an indication that the trend is losing strength.
Combination
The EMAs indicate when trend shifts (bullish or bearish).
The RSI indicates when the trend is losing momentum.
The combination of the two can be used to suggest when to prefer a directional bias, and subsequently shift in anticipation of a trend reversal.
Note that no signal is 100% accurate and an interpretation of market conditions and price action will need to be overlayed to
Why is it different to others?
I have not found other scripts that are available in this way visually including alerts when Stoch RSI crosses over/under the extremes; or the mid points.
Whilst these indicators are default, the combination of them and how they are presented is not and makes use of the TradingView colouring functionalities.
What are the features?
Customise the variables (averages) used in the script.
Display as one EMA or two EMAs (the crossing ones).
Alerts on EMA crosses.
Alerts on Stoch RSI crosses - slow/fast, upper, lower areas.
- Currently set on the chart to show alerts when Stoch RSI is above 80, then falls below 80 (and colours it red).
Customisable colours.
What are the best conditions for this?
It is designed for high timeframe charts and analysis in crypto, since crypto tends to trend.
It can however be used for lower timeframes.
Disclaimer/Notes:
I have noticed several videos appearing suggesting that this is a "100% win rate indicator" .
NO indicator has 100% win rate.
An indicator is an *indicator* that is all.
Please use responsibly and let me know if there are any mods or updates you would like to see.
Fibonacci Step IndicatorThe Fibonacci Step Indicator assumes irregularity in calculating a moving average. It is measured as the mean of the previous lows and highs situated at Fibonacci past periods. For example, the mean of the lows from 2, 3, 5, 8, etc. periods ago form the Fibonacci step indicator.
The indicator uses the formula for the first twelve Fibonacci numbers on highs and lows so that it creates a moving support/resistance zone. Afterwards, the zone is stabilized by taking the highest highs of the upper indicator and the lowest lows of the lower indicator part.
The indicator is used as a trend following way. It can be compared to the Ichimoku Kinko Hyo cloud (without the future projection). The zone form a support and resistance area. During ranging periods, the market will fluctuate within the area which is a bad time to follow the trend (if any).
Stan Weinstein Trend IndicatorThis indicator is a trend indicator for trading charts based on the method of Stan Weinstein. It uses various technical methods to identify four trend phases on an asset: consolidation, advancement, plateauing, and decline. Users can customize the indicator by modifying parameters such as the periods for various calculations, such as the exponential moving average (EMA), the relative strength index (RSI), and support and resistance levels. The results of these calculations are then used to determine if an asset is in a phase of consolidation, advancement, plateauing, or decline.
The results are displayed as markers on the chart, with the following colors:
White: Consolidation
Green: Advancement
Blue: Plateauing
Red: Decline
According to the method of Stan Weinstein, it is recommended to buy an asset during an advancement phase and sell it during a plateauing phase. Similarly, it is recommended to sell an asset during a decline phase and cut this sale when the consolidation phase starts. It is important to note that this indicator is for informational purposes only and should not be used as investment advice. It is important to conduct fundamental and technical analysis before making an investment decision. It is also recommended to combine this analysis with other methods for optimal results and to consider the risks associated with any investment.
All default parameters of this indicator have been carefully chosen to provide the best possible results, however, it is possible to modify them according to personal preferences. It is important to note that modifying certain parameters may make the indicator less relevant and it is therefore recommended not to deviate too much from default values, unless you have a good understanding of the Stan Weinstein method and the technical indicators used.
It is important to note that this indicator is optimized for 1-week charts. It can be used to look at charts at other timeframes but calculations will always be based on weekly data.
Also, it is noteworthy that this indicator is optimized for cryptocurrencies, except Bitcoin, as it is used to calculate the relative strength of a token. However, you can choose the asset or index you want in the menu to calculate the relative strength. Furthermore, all the default settings are carefully chosen, but users are free to modify them, but doing so may result in less relevant results.
Strategy Myth-Busting #5 - POKI+GTREND+ADX - [MYN]This is part of a new series we are calling "Strategy Myth-Busting" where we take open public manual trading strategies and automate them. The goal is to not only validate the authenticity of the claims but to provide an automated version for traders who wish to trade autonomously.
Our fifth one we are automating is one of the strategies from "The Best 3 Buy And Sell Indicators on Tradingview + Confirmation Indicators ( The Golden Ones ))" from "Online Trading Signals (Scalping Channel)". No formal backtesting was done by them and resuructo messaged me asking if we could validate their claims.
Originally, we mimic verbatim the settings Online Trading Signals was using however weren't getting promising results. So before we stopped there we thought we might want to see if this could be improved on. So we adjusted the Renko Assignment modifier from ATR to Traditional and adjusted the value to be higher from 30 to 47. We also decided to try adding another signal confirmation to eliminate some of the ranged market conditions so we choose our favorite, ADX . Also, given we are using this on a higher time-frame we adjusted the G-Channel Trend detection source from close to OHLC4 to get better average price action indication and more accurate trend direction.
This strategy uses a combination of 2 open-source public indicators:
poki buy and sell Take profit and stop loss by RafaelZioni
G-Channel Trend Detection by jaggedsoft
Trading Rules
15m - 4h timeframe. We saw best results at the recommended 1 hour timeframe.
Long Entry:
When POKI triggers a buy signal
When G-Channel Trend Detection is in an upward trend (Green)
ADX Is above 25
Short Entry:
When POKI triggers a sell signal
When G-Channel Trend Detection is in an downward trend (red)
ADX Is above 25
If you know of or have a strategy you want to see myth-busted or just have an idea for one, please feel free to message me.
MATHR3E RAMP-MA█ OVERVIEW
MATHR3E RAMP-MA (R-MA) is a trend following indicator.
█ CONCEPTS
Disclaimer:
MATHR3E RAMP-MA indicator is intended for advanced traders and may fit your profile, whether you are a day trader or a long-term investor.
It was originally developed by a renowned market analyst and documented in numerous books. Among them is the author Jason Perl.
It is recommended to have read the trading techniques mentioned in the books covering this indicator beforehand.
How to use:
MATHR3E RAMP-MA is useful for determining if a market is trending and when so, to procure entry points to initiate a trade in line with the expected directional move.
It can be applied to markets as a stop-loss, as well as a low-risk entry qualifier in conjunction with other indicators of the same author.
Moving Average (R-MA I):
Only displayed when market is trending
• Bull trend: Green (moving avg Lows/Period)
• Bear trend: Red (moving avg Highs/Period)
Moving Average (R-MA II):
Always displayed
• Bullish outlook on the market: the 3-day moving average must be positioned above the 34-day moving average
• Bearish outlook on the market: the 3-day moving average must be positioned below the 34-day moving average
█ FEATURES & BENEFITS
Versatile:
This indicator is based on relative price action, so you can apply it to any market or time frame without having to change the default settings.
Rate of Change:
The ROC is calculated for the fast and slow periods of the R-MA (II).
R-MA (II) is colored blue when its rate of change is advancing and maroon when it is declining.
Breakout Qualifier:
A close above/below the moving average R-MA (I) that is confirmed by the following price bar's opening price
Materialized on chart with Flags:
• Green when bear trend ends
• Red when bull trend ends
Alerts
Get notified on:
• UpTrend breakout
• DnTrend breakout
• Any breakout Signal
Flying Dragon Trend IndicatorFlying Dragon Trend Indicator can be used to indicate the trend on all timeframes by finetuning the input settings.
The Flying Dragon Trend family includes both the strategy and the indicator, where the strategy supports of selecting the optimal set of inputs for the indicator in each scenario. Highly recommended to get familiar with the strategy first to get the best out of the indicator.
Flying Dragon Trend plots the trend bands into the ribbon, where the colours indicate the trend of each band. The plotting of the bands can be turned off in the input settings. Based on the user selectable Risk Level the trend pivot indicator is shown for the possible trend pivot when the price crosses the certain moving average line, or at the Lowest risk level all the bands have the same colour. The trend pivot indicator is not shown on the Lowest risk level, but the colour of the trend bands is the indicator instead .
The main idea is to combine two different moving averages to cross each other at the possible trend pivot point, but trying to avoid any short term bounces to affect the trend indication. The ingenuity resides in the combination of selected moving average types, lengths and especially the offsets. The trend bands give visual hint for the user while observing the price interaction with the bands, one could say that when "the Dragon swallows the candles the jaws wide open", then there is high possibility for the pivot. The leading moving average should be fast while the lagging moving average should be, well, lagging behind the leading one. There is Offset selections for each moving average, three for leading one and one for the lagging one, those are where the magic happens. After user has selected preferred moving average types and lengths, by tuning each offset the optimal sweet spot for each timeframe and equity will be found. The default values are good enough starting points for longer (4h and up) timeframes, but shorter timeframes (minutes to hours) require different combination of settings, some hints are provided in tooltips. Basically the slower the "leading" moving average (like HMA75 or HMA115) and quicker the "lagging" moving average (like SMA12 or SMA5) become, the better performance at the Lowest risk level on minute scales. This "reversed" approach at the minute scales is shown also as reversed colour for the "lagging" moving average trend band, which seems to make it work surprisingly well.
The Flying Dragon Trend does not necessarily work well on zig zag and range bounce scenarios without additional finetuning of the input settings to fit the current condition.
Flying Dragon Trend StrategyFlying Dragon Trend Strategy can be used to indicate the trend on all timeframes by finetuning the input settings.
The Flying Dragon Trend family includes both the strategy and the indicator, where the strategy supports of selecting the optimal set of inputs for the indicator in each scenario. Highly recommended to get familiar with the strategy first to get the best out of the indicator.
Flying Dragon Trend plots the trend bands into the ribbon, where the colours indicate the trend of each band. The plotting of the bands can be turned off in the input settings. Based on the user selectable Risk Level the strategy is executed when the price crosses the certain moving average line, or at the Lowest risk level all the bands have the same colour.
The main idea is to combine two different moving averages to cross each other at the possible trend pivot point, but trying to avoid any short term bounces to affect the trend indication. The ingenuity resides in the combination of selected moving average types, lengths and especially the offsets. The trend bands give visual hint for the user while observing the price interaction with the bands, one could say that when "the Dragon swallows the candles the jaws wide open", then there is high possibility for the pivot. The leading moving average should be fast while the lagging moving average should be, well, lagging behind the leading one. There is Offset selections for each moving average, three for leading one and one for the lagging one, those are where the magic happens. After user has selected preferred moving average types and lengths, by tuning each offset the optimal sweet spot for each timeframe and equity will be found. The default values are good enough starting points for longer (4h and up) timeframes, but shorter timeframes (minutes to hours) require different combination of settings, some hints are provided in tooltips. Basically the slower the "leading" moving average (like HMA75 or HMA115) and quicker the "lagging" moving average (like SMA12 or SMA5) become, the better performance at the Lowest risk level on minute scales. This "reversed" approach at the minute scales is shown also as reversed colour for the "lagging" moving average trend band, which seems to make it work surprisingly well.
The Flying Dragon Trend does not necessarily work well on zig zag and range bounce scenarios without additional finetuning of the input settings to fit the current condition.
Strategy direction selector by DashTrader.
Multi SMI Ergodic OscillatorThe Multi SMI Ergodic Oscillator (Multi SMIEO) indicator can be used to identify potential buy and sell signals based on the relationship between the TSI and EMA lines.
The script is creating an indicator that plots multiple (3) sets of Time Series Indicator (TSI-Indicator) and Exponential Moving Average (EMA-Signal) lines as a single indicator.
The TSI is a momentum oscillator that helps identify overbought and oversold conditions. It is calculated using the close prices of an asset, a short-term moving average, and a long-term moving average. The script uses three different pairs of input values for the short-term and long-term periods, which can be adjusted by the user.
The EMA is a type of moving average that gives more weight to recent prices. It is calculated by applying a weighting factor to the most recent price, and then adding that weighted value to the previous EMA value. The script uses three different input values for the length of the EMA, which can also be adjusted by the user.
After calculating the TSI and EMA for each set, the script plots them on the same graph, with different colors and widths to differentiate them. The three sets of TSI and EMA lines are plotted to allow the user to compare the results of different periods. The script also plots a horizontal line at zero, which is used as a reference point for the oscillations of the indicator lines.
One way to use this indicator is to look for crossovers between the TSI and the EMA lines. A bullish crossover occurs when the TSI crosses above the EMA. This suggests that the buying pressure is increasing and a potential buy signal is generated. A bearish crossover occurs when the TSI crosses below the EMA. This suggests that the selling pressure is increasing and a potential sell signal is generated.
Some other ways that the indicator can be used include:
1. Identifying trends: The TSI and EMA lines can be used to identify the direction of the trend. An uptrend is present when the TSI and EMA lines are both trending upwards, while a downtrend is present when the TSI and EMA lines are both trending downwards.
2. Overbought and oversold conditions: The TSI can be used to identify overbought and oversold conditions. When the TSI is above the upper limit of the range, the asset is considered overbought and may be due for a price correction. Conversely, when the TSI is below the lower limit of the range, the asset is considered oversold and may be due for a price rebound.
3. Confirming price action: The Multi SMIEO indicator can be used to confirm price action. If a bullish divergence is present, it confirms a potential bullish reversal. If a bearish divergence is present, it confirms a potential bearish reversal.
4. Multiple time frame analysis: By using different periods for the TSI and EMA lines, the indicator can be used to analyze the asset on multiple time frames. It can be useful to compare the results of different periods to get a better understanding of the asset's price movements.
5. Risk management: This indicator can be used as an element of risk management strategy, it can help traders to identify overbought and oversold conditions to set stop loss or take profit levels.
The Multi SMI Ergodic Oscillator (Multi SMIEO) is a versatile indicator that can be used in a number of ways to analyze the price movements of an asset. It can be used to identify potential buy and sell signals, trends, overbought and oversold conditions, and to confirm price action. By using different periods for the TSI and EMA lines, the indicator can also be used to analyze the asset on multiple time frames. However, it is important to remember that indicators are based on historical data, and past performance does not guarantee future results.
It is important to use the indicator as part of a comprehensive trading strategy that includes risk management and other analysis techniques, such as fundamental and technical analysis. It is also important to keep in mind that indicators are not a standalone solution for trading, they should be used in conjunction with other market analysis and research techniques to generate better results.
Lastly, it is important to keep in mind that trading in financial markets comes with a certain level of risk and it is crucial to always have a proper risk management plan in place. Never invest more than you can afford to lose.
Market Structure MA Based BOS [liwei666]
🎲 Overview
🎯 This BOS(Break Of Structure) indicator build based on different MA such as EMA/RMA/HMA, it's usually earlier than pivothigh() method
when trend beginning, customer your BOS with 2 parameters now.
🎲 Indicator design logic
🎯 The logic is simple and code looks complex, I‘ll explain core logic but not code details.
1. use close-in EMA's highest/lowest value mark as SWING High/Low when EMA crossover/under,
not use func ta.pivothigh()/ta.pivotlow()
2. once price reaching EMA’s SWING High/Low, draw a line link High/Low to current bar, labled as BOS
3. find regular pattern benefit your trading.
🎲 Settings
🎯 there are 4 input properties in script, 2 properties are meaningful in 'GRP1' another 2 are display config in 'GRP2'.
GRP1
MA_Type: MA type you can choose(EMA/RMA/SMA/HMA), default is 'HMA'.
short_ma_len: MA length of your current timeframe on chart
GRP2
show_short_zz: Show short_ma Zigzag
show_ma_cross_signal: Show ma_cross_signal
🎲 Usage
🎯 BOS signal usually worked fine in high volatility market, low volatility is meaningless.
🎯 We can see that it performs well in trending market of different symbols, and BOS is an opportunity to add positions
BINANCE:BTCUSDTPERP
BINANCE:ETHUSDTPERP
🎯 MA Based signal is earlier than pivothigh()/pivotlow() method when trend beginning. it means higher profit-loss rate.
🎯 any questions or suggestion please comment below.
Additionally, I plan to publish 20 profitable strategies in 2023; indicatior not one of them,
let‘s witness it together!
Hope this indicator will be useful for you :)
enjoy! 🚀🚀🚀
HL-D Close Fraction Oscillator | AdulariDescription:
This indicator calculates the difference between price high's and low's, and fractions it by the close price. If it calculates the difference between a high and low or low and high is defined by whether the current close is higher than the previous close. It is then also rescaled to ensure the value is always appropriate compared to the last set amount of bars.
This indicator can be used to determine whether a market is trending or ranging, and if so in which direction it is trending.
How do I use it?
Never use this indicator as standalone trading signal, it should be used as confluence.
When the value is above the middle line this shows the bullish trend is strong.
When the value is below the middle line this shows the bearish trend is strong.
When the value crosses above the upper line this indicates the trend may reverse downwards.
When the value crosses below the lower line this indicates the trend may reverse upwards.
When the value crosses above the signal this indicates the current bearish trend is getting weak and may reverse upwards.
When the value crosses below the signal this indicates the current bullish trend is getting weak and may reverse downwards.
Features:
Oscillator value indicating the difference between highs and lows fractioned by the close price.
Signal indicating a clear trend and base line value.
Horizontal lines such as oversold, overbought and middle lines, indicating possible interest zones.
How does it work?
1 — Define trend by checking if current close is above or below previous close.
2 — If the current close is above the previous close, calculate the oscillator's value using this formula:
(high - low) / close
2 — If the current close is below the previous close, calculate the oscillator's value using this formula:
(low - high) / close
3 — Smooth the original value using a specified moving average.
4 — Rescale the value using this formula:
newMin + (newMax - newMin) * (value - oldMin) / math.max(oldMax - oldMin, 10e-10)
5 — Calculate signal value by applying smoothing to the oscillator's value.
BitCoin RSI TrendWhat is it?
This indicator will plot the RSI of BTC with a red or green background based on the top and bottom values which you can set.
How to use it?
For example, you want to trade only if the RSI of BTC is between 50 and 70, so the top value is 70 and bottom is 50. If the RSI value between those values the background will be green, else it will be red.
Why to use it?
The buy and sell strength of the BTC controls the other coins, and it is noticeable when the BTC is over sold and the RSI exceeding the 70, the price will reverse its movement to down, thus it is advisable to not open long position if the RSI of BTC is above the 70-75. Also, if the RSI is under 50 there is a big possibility to move down further to the over bought areas. The best is to buy a altcoins when the BTC RSI is between 50 and 70.
For example, I could avoid a bad long trade on MATICUSDT when the RSI of BTC is going under 50
Or, get a good long trade on MATICUSDT when the RSI of BTC is between 50 and 70
Generalized Smooth StepHello, folks. Sorry for not posting anything for a long time, just busy with my university studies for the moment.
Quick script for today — Smooth Step.
You can search for it in Wikipedia, but saying shortly and informatively, this is just an advanced type of oscillator, used as momentum indicator.
In the codes across the Internet everybody uses the 3rd order equation, BUT I found it kinda boring to use indicator this simple, so I made an option to choose the order of the equation in the settings — parameter "Order of the equation". This why it is called generalized smooth step, as it makes possible to use equation of virtually any order.
It is limited to 18 because very strange behaviour that you get after passing 18th order (it jsut becomes not tradeable any longer).
As I've mentioned above, it is an advanced version of classical oscillator, used as momentum indicator .
How to use it?
If smooth step is above 50, then the price momentum is bullish;
If smooth step is below 50, then the price momentum is bearish.
As simple as it is, it becomes useful enough on the higher timeframes (>=1H), so feel free to play with it and find optimal settings for yourself.
Hints
Try perform different smoothing and leading methods (developed by Ehler) to get better results;
You can use smooth step as confirmation/filter for trend-following trades.
Hope you will find it valueable.
Take your profits!
- Tarasenko Fyodor
RU:
Привет, ребята. Извините, что долго ничего не выкладывал, просто сейчас занят учебой в университете.
Быстрый скрипт на сегодня — Smooth Step.
Вы можете поискать его теоретическое обоснование в Википедии, но если говорить кратко и информативно, то это совершенствованный тип классического осциллятора, используемый в качестве моментум-индикатора .
В кодах в интернете все используют уравнение 3-го порядка, НО Мне было скучно пользоваться таким простым индикатором, поэтому я сделал возможность выбирать порядок уравнения в настройках — параметр " Порядок уравнения». Поэтому он называется обобщеннымsmooth step, так как позволяет использовать уравнение практически любого порядка.
Я ограничил порядок уравнения 18 , потому что индикатор показывает начинается очень странное поведение, когда вы делаете порядок больше 18 (индикатор просто начинается вести семя хаотично, что ли).
Как я уже упоминал выше, это усовершенствованная версия классического осциллятора, используемого в качестве моментум-индикатора .
Как им пользоваться?
Если smooth step выше 50, то импульс цены бычий;
Если smooth steз\p ниже 50, то импульс цены медвежий.
Хоть это и очень простой индикатор, он может оказаться достаточно полезным на старших таймфреймах (>=1H), так что не стесняйтесь играть с ним и находить оптимальные настройки для себя.
Советы
Попробуйте использовать различные методы сглаживания и лидирования (разработан Джоном Элером (John Ehler)), чтобы получить лучшие результаты;
Вы можете использовать smooth step в качестве подтверждения/фильтра для сделок, следующих за трендом.
Надеюсь, этот скрипт будет вам полезен.
Получите прибыль!
- Тарасенко Фёдор
Trend Line Adam Moradi v1 (Tutorial Content)
The Pine Script strategy that plots pivot points and trend lines on a chart. The strategy allows the user to specify the period for calculating pivot points and the number of pivot points to be used for generating trend lines. The user can also specify different colors for the up and down trend lines.
The script starts by defining the input parameters for the strategy and then calculates the pivot high and pivot low values using the pivothigh() and pivotlow() functions. It then stores the pivot points in two arrays called trend_top_values and trend_bottom_values. The script also has two arrays called trend_top_position and trend_bottom_position which store the positions of the pivot points.
The script then defines a function called add_to_array() which takes in three arguments: apointer1, apointer2, and val. This function adds val to the beginning of the array pointed to by apointer1, and adds bar_index to the beginning of the array pointed to by apointer2. It then removes the last element from both arrays.
The script then checks if a pivot high or pivot low value has been calculated, and if so, it adds the value and its position to the appropriate arrays using the add_to_array() function.
Next, the script defines two arrays called bottom_lines and top_lines which will be used to store trend lines. It also defines a variable called starttime which is set to the current time.
The script then enters a loop to calculate and plot the trend lines. It first deletes any existing trend lines from the chart. It then enters two nested loops which iterate over the pivot points stored in the trend_bottom_values and trend_top_values arrays. For each pair of pivot points, the script calculates the slope of the line connecting them and checks if the line is a valid trend line by iterating over the price bars between the two pivot points and checking if the line is above or below the close price of each bar. If the line is found to be a valid trend line, it is plotted on the chart using the line.new() function.
Finally, the script colors the trend lines using the colors specified by the user.
Tutorial Content
'PivotPointNumber' is an input parameter for the script that specifies the number of pivot points to consider when calculating the trend lines. The value of 'PivotPointNumber' is set by the user when they configure the script. It is used to determine the size of the arrays that store the values and positions of the pivot points, as well as the number of pivot points to loop through when calculating the trend lines.
'up_trend_color' is an input parameter for the script that specifies the color to use for drawing the trend lines that are determined to be upward trends. The value of 'up_trend_color' is set by the user when they configure the script and is passed to the color parameter of the line.new() function when drawing the upward trend lines. It determines the visual appearance of the upward trend lines on the chart.
'down_trend_color' is an input parameter for the script that specifies the color to use for drawing the trend lines that are determined to be downward trends. The value of 'down_trend_color' is set by the user when they configure the script and is passed to the color parameter of the line.new() function when drawing the downward trend lines. It determines the visual appearance of the downward trend lines on the chart.
'pivothigh' is a variable in the script that stores the value of the pivot high point. It is calculated using the pivothigh() function, which returns the highest high over a specified number of bars. The value of 'pivothigh' is used in the calculation of the trend lines.
'pivotlow' is a variable in the script that stores the value of the pivot low point. It is calculated using the pivotlow() function, which returns the lowest low over a specified number of bars. The value of 'pivotlow' is used in the calculation of the trend lines.
'trend_top_values' is an array in the script that stores the values of the pivot points that are determined to be at the top of the trend. These are the pivot points that are used to calculate the upward trend lines.
'trend_top_position' is an array in the script that stores the positions (i.e., bar indices) of the pivot points that are stored in the 'trend_top_values' array. These positions correspond to the locations of the pivot points on the chart.
'trend_bottom_values' is an array in the script that stores the values of the pivot points that are determined to be at the bottom of the trend. These are the pivot points that are used to calculate the downward trend lines.
'trend_bottom_position' is an array in the script that stores the positions (i.e., bar indices) of the pivot points that are stored in the 'trend_bottom_values' array. These positions correspond to the locations of the pivot points on the chart.
apointer1 and apointer2 are variables used in the add_to_array() function, which is defined in the script. They are both pointers to arrays, meaning that they hold the memory addresses of the arrays rather than the arrays themselves. They are used to manipulate the arrays by adding new elements to the beginning of the arrays and removing elements from the end of the arrays.
apointer1 is a pointer to an array of floating-point values, while apointer2 is a pointer to an array of integers. The specific arrays that they point to depend on the arguments passed to the add_to_array() function when it is called. For example, if add_to_array(trend_top_values, trend_top_posisiton, pivothigh) is called, then apointer1 would point to the tval array and apointer2 would point to the tpos array.
'bottom_lines' (short for "Bottom Lines") is an array in the script that stores the line objects for the downward trend lines that are drawn on the chart. Each element of the array corresponds to a different trend line.
'top_lines' (short for "Top Lines") is an array in the script that stores the line objects for the upward trend lines that are drawn on the chart. Each element of the array corresponds to a different trend line.
Both 'bottom_lines' and 'top_lines' are arrays of type "line", which is a data type in PineScript that represents a line drawn on a chart. The line objects are created using the line.new() function and are used to draw the trend lines on the chart. The variables are used to store the line objects so that they can be manipulated and deleted later in the script.
Loops
maxline is a variable in the script that specifies the maximum number of trend lines that can be drawn on the chart. It is used to determine the size of the bottom_lines and top_lines arrays, which store the line objects for the trend lines.
The value of maxline is set to 3 at the beginning of the script, meaning that at most 3 trend lines can be drawn on the chart at a time. This value can be changed by the user if desired by modifying the assignment statement "maxline = 3".
'count_line_low' (short for "Count Line Low") is a variable in the script that keeps track of the number of downward trend lines that have been drawn on the chart. It is used to ensure that the maximum number of trend lines (as specified by the maxline variable) is not exceeded.
'count_line_high' (short for "Count Line High") is a variable in the script that keeps track of the number of upward trend lines that have been drawn on the chart. It is used to ensure that the maximum number of trend lines (as specified by the maxline variable) is not exceeded.
Both 'count_line_low' and 'count_line_high' are initialized to 0 at the beginning of the script and are incremented each time a new trend line is drawn. If either variable exceeds the value of maxline, then no more trend lines are drawn.
'pivot1', 'up_val1', 'up_val2', up1, and up2 are variables used in the loop that calculates the downward trend lines in the script. They are used to store intermediate values during the calculation process.
'pivot1' is a loop variable that is used to iterate through the pivot points (stored in the trend_bottom_values and trend_bottom_position arrays) that are being considered for use in the trend line calculation.
'up_val1' and 'up_val2' are variables that store the values of the pivot points that are used to calculate the downward trend line.
up1 and up2 are variables that store the positions (i.e., bar indices) of the pivot points that are stored in 'up_val1' and 'up_val2', respectively. These positions correspond to the locations of the pivot points on the chart.
'value1' and 'value2' are variables that are used to store the values of the pivot points that are being compared in the loop that calculates the trend lines in the script. They are used to determine whether a trend line can be drawn between the two pivot points.
For example, if 'value1' is the value of a pivot point at the top of the trend and 'value2' is the value of a pivot point at the bottom of the trend, then a trend line can be drawn between the two points if 'value1' is greater than 'value2'. The values of 'value1' and 'value2' are used in the calculation of the slope and intercept of the trend line.
'position1' and 'position2' are variables that are used to store the positions (i.e., bar indices) of the pivot points that are being compared in the loop that calculates the trend lines in the script. They are used to determine the distance between the pivot points, which is necessary for calculating the slope of the trend line.
For example, if 'position1' is the position of a pivot point at the top of the trend and 'position2' is the position of a pivot point at the bottom of the trend, then the distance between the two points is given by 'position1' - 'position2'. This distance is used in the calculation of the slope of the trend line.
'different', 'high_line', 'low_location', 'low_value', and 'valid' are variables that are used in the loop that calculates the downward trend lines in the script. They are used to store intermediate values during the calculation process.
'different' is a variable that stores the slope of the downward trend line being calculated. It is calculated as the difference in value between the two pivot points (stored in up_val1 and up_val2) divided by the distance between the pivot points (calculated using their positions, stored in up1 and up2).
'high_line' is a variable that stores the current value of the trend line being calculated at a given point in the loop. It is initialized to the value of the second pivot point (stored in up_val2) and is updated on each iteration of the loop using the value of different.
'low_location' is a variable that stores the position (i.e., bar_index) on the chart of the point where the trend line being calculated first touches the low price. It is initialized to the position of the second pivot point (stored in up2) and is updated on each iteration of the loop if the trend line touches a lower low.
'low_value' is a variable that stores the value of the trend line at the point where it first touches the low price. It is initialized to the value of the second pivot point (stored in up_val2) and is updated on each iteration of the loop if the trend line touches a lower low.
'valid' is a Boolean variable that is used to indicate whether the trend line being calculated is valid. It is initialized to true and is set to false if the trend line does not pass through all the lows between the pivot points. If valid is still true after the loop has completed, then the trend line is considered valid and is drawn on the chart.
d_value1, d_value2, d_position1, and d_position2 are variables that are used in the loop that calculates the upward trend lines in the script. They are used to store intermediate values during the calculation process.
d_value1 and d_value2 are variables that store the values of the pivot points that are used to calculate the upward trend line.
d_position1 and d_position2 are variables that store the positions (i.e., bar indices) of the pivot points that are stored in d_value1 and d_value2, respectively. These positions correspond to the locations of the pivot points on the chart.
The variables d_value1, d_value2, d_position1, and d_position2 have the same function as the variables uv1, uv2, up1, and up2, respectively, but for the calculation of the upward trend lines rather than the downward trend lines. They are used in a similar way to store intermediate values during the calculation process.
thank you.
Trend and Momentum DashboardI created this indicator to tell me when it's time to trade (going long) and when it's time to wait (or going short).
You can enter up to 13 ticker (default is S&P500 and key market segments).
For each ticker, fibonacci levels are calculated and represented either in 5 color or 3 color mode as single lines.
(Thanks to eykpunter for the fibonacci level implementation. I'm using his code and modified it slightly).
Color coding (5 color mode) explanation:
blue = in uptrend area
light blue = in prudent buyers area
gray = in center area
light red = in prudent sellers area
red = in downtrend area
The topline is a combination of all ticker and shows if the market is either bullish or bearish (threshold adjustable in settings)
The bullish/bearish trend can also be used as background color. Alternatively the last bar in the selected time period is been highlighted.
How to use it:
The indicator works on all timeframes. Use the color coding explanation above to see the status of each asset.
a) You can evaluate "long" term trend using day or week timeframe. e.g. I'm usually trading only long and stay out of the market when it is not bullish (top line & background = blue). I'm also using it to know which segments/assets are currently "hot".
b) You can evaluate short term momentum (using 1h or lower timeframe) and see in which direction the market/assets are moving. e.g. I use this when the exchanges open to see how the day is going to move.
I've attached 3 examples in the screenshot - first is the default, in the second one I'm using different asset classes and the third one is for crypto.
Limitations:
There are security request limits as well as string limitations for the security calls in pine script, so I went to the maximum what is currently possible.
(No financial advise, for testing purposes only)
Open DriveOpen Drive is a market profile concept introduced by Jim Dalton. It occurs when the price moves directionally and persistently for the first 30 minutes from the cash market open.
It is necessary to use 30-minute bars as there needs to be enough time to measure an extreme move of the cash open. This means there will be fewer trades than other strategies using faster time periodicities.
The script finds open drives from these time points 0700/ 0800 and 1300/1430.
The entry signal also has a breakout threshold using the 5-bar high and 5-bar low to only take trades moving away from the prior 5-bar range. This weeds out most mid-range trades and small range expansion bars.
If the price has had a strong move from the open and has broken either below the prior 5-bar low or above the prior 5-bar high by an amount equal to the prior 5-bar range a trade is entered in the direction of the move.
The Exit criteria; exit after 3 bars which is 90mins when using a 30min periodicity.
Note, this script is shared to show that momentum generated on or around the cash open tends to persist. The entry and exits of this strategy are quite naive but there are plenty of ways to take more aggressive entries on faster time frames when an open drive occurs. The times chosen for this strategy will suit stock index futures mainly. The user can experiment with other futures products and their corresponding pit/ cash open hours.
Google "open drive market profile" for more information on open drives and market profile concepts.
Happy trading!
Price Filter [AstrideUnicorn]The indicator calculates a fast price filter based on the closing price of the underlying asset. Overall, it is intended to provide a fast, reliable way to detect trend direction and confirm trend strength, using statistical measures of price movements.
The algorithm was adapted from Marcus Schmidberger's (2018) article "High Frequency Trading with the MSCI World ETF". It demeans the price time series using the long-term average and then normalizes it with the long-term standard deviation. The resulting time series is then compared to specified thresholds to determine the trend direction.
HOW TO USE
The indicator surface is colored green if the price is trending upwards and red if the price is trending downwards. If the indicator outline is the opposite color of the indicator surface, it indicates that the price is moving against the trend and the current trend may be losing strength.
If the 'Use threshold' setting is enabled, the indicator will be colored blue if its value is within the range defined by the upper and lower thresholds. This indicates that the price is trending sideways, or that the current trend is losing strength.
SETTNGS
Length - the length of the long-term average used to calculate the price filter. Recommended range 20 - 200. The sensitivity of the indicator increases as the value becomes smaller, allowing it to detect smaller price moves and swings earlier.
Threshold - the threshold value used to detect trend direction.
Use threshold - a boolean (true/false) input that determines whether to use the threshold value for confirmation.
Slope NormalizerBrief:
This oscillator style indicator takes another indicator as its source and measures the change over time (the slope). It then isolates the positive slope values from the negative slope values to determine a 'normal' slope value for each.
** A 'normal' value of 1.0 is determined by the average slope plus the standard deviation of that slope.
The Scale
This indicator is not perfectly linear. The values are interpolated differently from 0.0 - 1.0 than values greater than 1.0.
From values 0.0 to 1.0 (positive or negative): it means that the value of the slope is less than 'normal' **.
Any value above 1.0 means the current slope is greater than 'normal' **.
A value of 2.0 means the value is the average plus 2x the standard deviation.
A value of 3.0 means the value is the average plus 3x the standard deviation.
A value greater than 4.0 means the value is greater than the average plus 4x the standard deviation.
Because the slope value is normalized, the meaning of these values can remain generally the same for different symbols.
Potential Usage Examples/b]
Using this in conjunction with an SMA or WMA may indicate a change in trend, or a change in trend-strength.
Any values greater than 4 indicate a very strong (and unusual) trend that may not likely be sustainable.
Any values cycling between +1.0 and -1.0 may mean indecision.
A value that is decreasing below 0.5 may predict a change in trend (slope may soon invert).
Musashi_Fractal_Dimension === Musashi-Fractal-Dimension ===
This tool is part of my research on the fractal nature of the markets and understanding the relation between fractal dimension and chaos theory.
To take full advantage of this indicator, you need to incorporate some principles and concepts:
- Traditional Technical Analysis is linear and Euclidean, which makes very difficult its modeling.
- Linear techniques cannot quantify non-linear behavior
- Is it possible to measure accurately a wave or the surface of a mountain with a simple ruler?
- Fractals quantify what Euclidean Geometry can’t, they measure chaos, as they identify order in apparent randomness.
- Remember: Chaos is order disguised as randomness.
- Chaos is the study of unstable aperiodic behavior in deterministic non-linear dynamic systems
- Order and randomness can coexist, allowing predictability.
- There is a reason why Fractal Dimension was invented, we had no way of measuring fractal-based structures.
- Benoit Mandelbrot used to explain it by asking: How do we measure the coast of Great Britain?
- An easy way of getting the need of a dimension in between is looking at the Koch snowflake.
- Market prices tend to seek natural levels of ranges of balance. These levels can be described as attractors and are determinant.
Fractal Dimension Index ('FDI')
Determines the persistence or anti-persistence of a market.
- A persistent market follows a market trend. An anti-persistent market results in substantial volatility around the trend (with a low r2), and is more vulnerable to price reversals
- An easy way to see this is to think that fractal dimension measures what is in between mainstream dimensions. These are:
- One dimension: a line
- Two dimensions: a square
- Three dimensions: a cube.
--> This will hint you that at certain moment, if the market has a Fractal Dimension of 1.25 (which is low), the market is behaving more “line-like”, while if the market has a high Fractal Dimension, it could be interpreted as “square-like”.
- 'FDI' is trend agnostic, which means that doesn't consider trend. This makes it super useful as gives you clean information about the market without trying to include trend stuff.
Question: If we have a game where you must choose between two options.
1. a horizontal line
2. a vertical line.
Each iteration a Horizontal Line or a Square will appear as continuation of a figure. If it that iteration shows a square and you bet vertical you win, same as if it is horizontal and it is a line.
- Wouldn’t be useful to know that Fractal dimension is 1.8? This will hint square. In the markets you can use 'FD' to filter mean-reversal signals like Bollinger bands, stochastics, Regular RSI divergences, etc.
- Wouldn’t be useful to know that Fractal dimension is 1.2? This will hint Line. In the markets you can use 'FD' to confirm trend following strategies like Moving averages, MACD, Hidden RSI divergences.
Calculation method:
Fractal dimension is obtained from the ‘hurst exponent’.
'FDI' = 2 - 'Hurst Exponent'
Musashi version of the Classic 'OG' Fractal Dimension Index ('FDI')
- By default, you get 3 fast 'FDI's (11,12,13) + 1 Slow 'FDI' (21), their interaction gives useful information.
- Fast 'FDI' cross will give you gray or red dots while Slow 'FDI' cross with the slowest of the fast 'FDI's will give white and orange dots. This are great to early spot trend beginnings or trend ends.
- A baseline (purple) is also provided, this is calculated using a 21 period Bollinger bands with 1.618 'SD', once calculated, you just take midpoint, this is the 'TDI's (Traders Dynamic Index) way. The indicator will print purple dots when Slow 'FDI' and baseline crosses, I see them as Short-Term cycle changes.
- Negative slope 'FDI' means trending asset.
- Positive most of the times hints correction, but if it got overextended it might hint a rocket-shot.
TDI Ranges:
- 'FDI' between 1.0≤ 'FDI' ≤1.4 will confirm trend following continuation signals.
- 'FDI' between 1.6≥ 'FDI' ≥2.0 will confirm reversal signals.
- 'FDI' == 1.5 hints a random unpredictable market.
Fractal Attractors
- As you must know, fractals tend orbit certain spots, this are named Attractors, this happens with any fractal behavior. The market of course also shows them, in form of Support & Resistance, Supply Demand, etc. It’s obvious they are there, but now we understand that they’re not linear, as the market is fractal, so simple trendline might not be the best tool to model this.
- I’ve noticed that when the Musashi version of the 'FDI' indicator start making a cluster of multicolor dots, this end up being an attractor, I tend to draw a rectangle as that area as price tend to come back (I still researching here).
Extra useful stuff
- Momentum / speed: Included by checking RSI Study in the indicator properties. This will add two RSI’s (9 and a 7 periods) plus a baseline calculated same way as explained for 'FDI'. This gives accurate short-term trends. It also includes RSI divergences (regular and hidden), deactivate with a simple check in the RSI section of the properties.
- BBWP (Bollinger Bands with Percentile): Efficient way of visualizing volatility as the percentile of Bollinger bands expansion. This line varies color from Iced blue when low volatility and magma red when high. By default, comes with the High vols deactivated for better view of 'FDI' and RSI while all studies are included. DDWP is trend agnostic, just like 'FDI', which make it very clean at providing information.
- Ultra Slow 'FDI': I noticed that while using BBWP and RSI, the indicator gets overcrowded, so there is the possibility of adding only one 'FDI' + its baseline.
Final Note: I’ve shown you few ways of using this indicator, please backtest before using in real trading. As you know trading is more about risk and trade management than the strategy used. This still a work in progress, I really hope you find value out of it. I use it combination with a tool named “Musashi_Katana” (also found in TradingView).
Best!
Musashi
Linear Regression AngleThere are several Linear Regression indicator in the Public Library, but I don't think there is one that converts the Linear Regression (LR) curve into angle in degrees, relative to a set reference frame. Due to the large price range between tickers, creating this indicator isn't as straight forward as I originally thought. For example, given the same time period, a stock that fluctuate in the 10's will have a true linear regression angle dramatically different from a penny stock. Even changing the scale on your chart will affect the "apparent" angle you see on the chart. Hence, this indicator DOES NOT provide the true linear regression angle, but only a relative one based on a defined number of historical bars.
Originality and usefulness
This indicator provides Linear Regression (LR) Angle in degree that may be more easily interpreted by some traders as we are more accustomed to line angles in degree and know how to visualize them.
This script also provides the option to overlay up to four LR curves of different periods, as well as an average curve of the enabled curves. This allows traders to analysis short to long term trends.
Furthermore, slope (rate of change) of each LR curves can be toggled. The slope plot can help traders visualize accelerations and decelerations of the LR curves which may help in spotting trend reversals.
Data table provides real time data for each curve.
Example of using slope plot with a 30 bars Linear Regression Angle:
MAGIC MACDMAGIC MACD ( MACD Indicator with Trend Filter and EMA Crossover confirmation and Momentum). This MACD uses Default Trading view MACD
from Technical indicators library and adding a second MACD along with 3 EMA's to detect Trend and confirm MACD Signal.
Eliminates usage of 3different indicators (Default MACD , MACD-2,EMA5, EMA20, EMA50)
Basic IDEA.
Idea is to filter Histogram when price is above or below 50EMA. Similar to QQE -mod oscillator but Has a EMA Filter
1.Take DEFAULT MACD crossover signals with lower period
2.check with a Higher MACD Histogram.
3.Enter upon EMA crossover signal and Histogram confirmation.
Histogram changes to GRAY when price is below EMA 50 or above EMA 50 (Follows Trend)
4.Exit on next Default MACD crossover signal.
Overview :
Moving Average Convergence Divergence Indicator Popularly Known as MACD is widely used. MACD Usually generates a lots of False signals
and noise in Lower Time Frames, making it difficult to enter a trade in sideways market. Divergence is a major issue along with sideways
movement and tangling of MACD and Signal Lines. There is no way to confirm a Default MACD signal, except to switch time frames and
verify.
Magic MACD Can be used to in combination with other signals.
This MACD uses two MACD Signals to verify the signal given by Default MACD . The Histogram Plot shown is of a higher period
MACD (close,5,50,30) values. When a signal is generated on a lower MACD it is verified by the histogram with higher time period.
Technicals Used:
1. Lower MACD-1 values 12,26 and signal-9 (crossover Signals)
2. Higher MACD-2 values 5,50 and signal-30 (Histogram)
3. EMA 50 (Histogram Filter to allow only if price above or below Ema 50)
4. EMA 5 and EMA 20 for crossover confirmation of trend
What's is in this Indicator?
1.Histogram-(higher period 5,50 and 30signal)
2. MACD crossover Signals-(lower period Default MACD setting)
3.Signal Lines-( EMA 5 & 20)
Implemented & Removed in this Indicator
1. Default MACD and Signal Lines are removed completely
2. MACD crossover are taken on lower periods and plotted as signals(Blue Triangle or Red Triangle)
3. Histogram is plotted from a higher Period providing a clear picture with Higher Time period
4. EMA 5 and EMA 20 are used for MACD signal confirmation
How to use?
Up Signal
1. MACD Default (12,26,30) up signals are shown in Blue
2. Wait till the Histogram changes Blue
3. Look for EMA signals crossover near by
Down Signal
1. MACD Default (12,26,30) up signals are shown in Red
2. Wait till the Histogram changes Red
3. Look for EMA signals crossover near by
Do's
Consider only opposite color as signals
1. Red Triangle on Blue Histogram(likely to move down direction)
2. Blue Triangle on Red Histogram (Likely to move up direction)
Don'ts
1.Ignore Blue Signal on Blue Histogram (pull back signals can be used to enter trade if you miss first crossover)
2.Ignore Red Signal on Red Histogram(pull back signals can be used to enter trade if you miss first crossover)
3.Ignore Up and Down signals till Gray or Blacked out area is finished in Histogram
Tips:
1. EMA plot also shows pull back areas along with signals
2.side by side opposite signals shows sides ways movement
3. EMA 5,20 is plotted on MACD Histogram for Additional Benefit
Thanks & Credits
To Tradingview Team for allowing me to use their default MACD version and coding it in to a MAGIC MACD by adding a few lines of code that
makes it more enhanced.
Warning...!
This is purely for Educational purpose only. Not to be used as a stand alone indicator. Usage is at your own Risk. Please get familiar with its working before implementing. Its not a Financial Advice or Suggestion . Any losses or gains is at your own risk.