Cometreon_Public📚 Cometreon Public Library – Advanced Functions for Pine Script
This library contains advanced functions used in my public indicators on TradingView. The goal is to make the code more modular and efficient, allowing users to call pre-built functions for complex calculations without rewriting them from scratch.
🔹 Currently Available Functions:
1️⃣ Moving Average Function – Provides multiple types of moving averages to choose from, including:
SMA (Simple Moving Average)
EMA (Exponential Moving Average)
WMA (Weighted Moving Average)
RMA (Smoothed Moving Average)
HMA (Hull Moving Average)
JMA (Jurik Moving Average)
DEMA (Double Exponential Moving Average)
TEMA (Triple Exponential Moving Average)
LSMA (Least Squares Moving Average)
VWMA (Volume-Weighted Moving Average)
SMMA (Smoothed Moving Average)
KAMA (Kaufman’s Adaptive Moving Average)
ALMA (Arnaud Legoux Moving Average)
FRAMA (Fractal Adaptive Moving Average)
VIDYA (Variable Index Dynamic Average)
2️⃣ Custom RSI – Uses the Moving Average function to modify the calculation method, with an additional option for a dynamic version.
3️⃣ Custom MACD – Uses the Moving Average function to modify the calculation method, with an additional option for a dynamic version.
4️⃣ Custom Alligator – Uses the Moving Average function to modify generic calculations, allowing users to change the calculation method.
Mtf
Flux Charts - SFX Screener💎 GENERAL OVERVIEW
The SFX Screener by Flux Charts is a multi-timeframe market scanner that extracts and visually organizes key conditions detected by the SFX Algo indicator across multiple assets in real-time. It does not perform independent analysis or generate new signals—instead, it pulls data directly from the SFX Algo’s calculations to ensure full alignment across different timeframes and tickers.
The SFX Algo is a multi-factor trading indicator that integrates trend analysis, signal generation, market overlays, and take-profit/stop-loss levels into a single system. It evaluates multiple trend components, including EMA direction, momentum shifts, and volatility cycles, to determine market conditions. Signal generation is based on an Adjusted Weighted Majority Algorithm, filtering out weaker signals by prioritizing the most reliable market indicators. Market overlays, such as Volatility Bands and the Retracement Wave, provide dynamic support, resistance, exit points, and entry points. Its adaptable structure allows traders to customize settings based on strategy preferences, making it effective for scalping, swing trading, and long-term trend analysis.
The SFX Screener’s purpose is to give traders a dashboard view of these SFX Algo signals across multiple tickers and timeframes in real-time.
📌 HOW DOES IT WORK ?
The SFX Algo indicator employs an Adjusted Weighted Majority algorithm to generate "buy" and "sell" signals. It evaluates multiple market indicators ("experts"), including momentum, ATR trends, and EMA trends, and assigns weights based on their recent performance. The "Time Weighting" setting allows users to balance between using more historical data or prioritizing recent trends. Unlike traditional weighted majority methods, SFX also dynamically penalizes larger losses. Signals are confirmed based on the consensus of the most successful indicators within the selected time period, filtering out weaker signals during underperforming phases.
The SFX Screener extracts these calculated outputs and visually organizes them into a real-time dashboard. Each signal, status, and volatility condition displayed in the screener is a direct output from the SFX Algo indicator.
🚩 UNIQUENESS
Unlike traditional screeners that rely on preset filters or static conditions, the SFX Screener dynamically updates its dashboard based on live outputs from the SFX Algo’s adaptive algorithm.
Traditional Screeners → Use predefined filters like “price above EMA” or “RSI overbought.” They do not adjust to market dynamics.
SFX Screener → Displays outputs directly from an adaptive algorithm that continuously evaluates trends, volatility, and momentum changes.
The SFX Screener can show SFX Algo's status on 8 different tickers on different timeframes. Key factors that make it unique include:
✅ Real-time sync with SFX Algo → Displays live conditions, not static filters.
✅ Comprehensive Dashboard – This screener provides a complete and customizable dashboard designed to enhance traders' decision-making by consolidating crucial SFX Algo insights into one user-friendly interface.
✅ Multi-Ticker & Multi-Timeframe Analysis – With support for up to 8 tickers and timeframes, traders can effortlessly analyze the bigger market picture, identifying trends and opportunities across different assets and timeframes.
By combining multiple analytical elements in a single view, this screener empowers traders with the insights needed to navigate the market more effectively.
🎯 SFX SCREENER FEATURES:
SFX Algo Signals : This tool can detect SFX Algo signals across different tickers & timeframes.
Volatility Bands : Detection of Volatility Bands Status & Retests.
Retracement Wave : Detection of Retracement Wave Status & Retests.
Highly Configurable : Offers multiple parameters for fine-tuning detection settings.
Up to 8 Tickers : Allows traders to analyze multiple tickers & timeframes simultaneously for enhanced accuracy.
📊 SFX SCREENER DATA BREAKDOWN
Signal ->
Buy -> The latest signal is a buy signal.
Sell -> The latest signal is a sell signal.
The rating of the signal is shown after the signal type.
Δ⭐ ->
Shows the rating change (delta) after the signal is triggered. Positive values mean that the rating is increased after the signal is given, negative values mean that it's decreased.
Status ->
Displays the amount of time passed after the signal is given.
TP Targets ->
Shows the Take-Profit targets of the signal, if a target was achieved, there is a ✅ symbol near it and the next target it displayed.
V. Bands ->
The Volatility Bands dynamically adjust to market conditions, expanding during high volatility and contracting during low volatility. When the volatility bands are tight, or the upper and lower bands are close to each other, the market is not volatile. During periods of low volatility, it’s common for price to consolidate or move sideways. An early indication of a large price move can occur when the bands widen or open up after being tight. When the volatility bands are wide, it reflects a period of increased volatility, typically during strong price trends or after a breakout. The volatility bands can also act as support and resistance areas. The upper band acts as resistance while the lower band acts as support. These mark out good areas for potential reversals. Breakouts can also occur when price moves beyond the bands, signaling a potential trend in the breakout direction.
Outside -> The price is currently outside of the Volatility Bands.
Inside | Upper -> The price is currently inside the Upper Volatility Band.
Inside | Lower -> The price is currently inside the Lower Volatility Band.
R. Wave ->
The Retracement Wave is used to identify entry points during pullbacks in trending markets. It can also be used to find exit points for open trades. The wave is bullish when price is above it and bearish when the price is below it. The retracement wave can be used as an area to enter during a pullback in a trending market. The wave can also be helpful for managing risk and closing out positions.
Outside | Bullish -> The Retracement Wave is currently Bullish, and the price is outside of it.
Outside | Bearish -> The Retracement Wave is currently Bearish, and the price is outside of it.
Inside | Bullish -> The Retracement Wave is currently Bullish, and the price is inside of it.
Inside | Bearish -> The Retracement Wave is currently Bearish, and the price is inside of it.
Profit & Loss (P&L) ->
Shows the amount of profit or loss the position is currently in. All values are shown in terms of percentage, and positive values mean the position is in profit while negative values mean that the position is in loss.
⚠ Timeframe Restriction : The selected timeframes for analysis cannot be lower than the chart’s current timeframe to ensure proper data alignment.
⏰ ALERTS
This screener supports alerts, so you never miss a key market move. You can choose to receive alerts when a buy or sell signal is given, helping you spot potential trading opportunities. Additionally, you can enable alerts for take-profit or stop-loss levels, which notify you when the price achieves those levels. The alerts will work for each enabled ticker in the settings. You can also toggle webhook format for alerts, and choose to include ticker metadata in it.
⚙️ SETTINGS
1. Algorithm Settings
Sensitivity: The sensitivity setting is a key parameter that influences the frequency of signals the SFX Algo generates. By adjusting this parameter, you can control the frequency of signals produced by the algorithm. Using a lower sensitivity setting generates more frequent signals that are highly responsive to minor price fluctuations. Using a higher sensitivity setting reduces the frequency of signals, focusing on more significant price movements and filtering out minor fluctuations.
Signal Strength: The Signal Strength setting filters signals based on their quality, allowing traders to focus on the most reliable opportunities. This feature helps traders balance the quantity and reliability of the algorithm’s signals to suit their trading strategy. Using a lower signal strength will display more signals, including those with lower signal ratings, for broader market coverage. Using a higher signal strength will display fewer signals by prioritizing those with higher signal ratings, reducing market noise.
Time Weighting: The Time Weighting setting in the SFX Algo determines how historical market data is analyzed to generate signals.
a) Recent Trends
Focuses on the most recent movements for short-term analysis. This setting is good for scalpers and intraday traders who need to react quickly to market changes.
b) Mixed Trends
Balances recent and historical price movements for a comprehensive market view. This setting is well-suited for swing traders and those who want to capture medium-term opportunities by combining the benefits of short-term responsiveness with the reliability of long-term trends.
c) Long-term Trends
Relies on extended historical market data to identify broader market trends, making it an excellent choice for traders focused on long-term strategies.
Minimum Star Rating : The Minimum Star Rating setting allows you to filter signals based on their strength, showing only those that meet or exceed your chosen threshold. For instance, setting the minimum star rating to 3 ensures you only receive signals with a rating of 3 stars or higher.
2. Take Profit / Stop Loss Methods
Key Levels
The Key Levels method uses pivot points to set take profit and stop-loss levels. The TP and SL levels are shown when a new signal is generated.
Volatility Bands
This TP/SL method uses the Volatility Bands overlay to set dynamic TP and SL levels. These levels are not predetermined so they will not be shown in advance when a signal is generated.
Signal Rating
Sets take profit and stop-loss levels based on changes in a signal's rating strength. These levels are not predetermined so they will not be shown in advance when a signal is generated.
Auto Stop-Loss
The auto method can only be applied to the SL. The auto method allows the algorithm to detect SL automatically when a momentum shift is detected. You can adjust the risk tolerance of the Auto SL by adjusting the ‘Auto Risk Tolerance’ setting. You can choose between Low, Medium, and High. A high-risk tolerance will result in stop losses being triggered less often.
3. Tickers
You can set, then enable or disable up to 8 tickers in this section to get informed about their latest SFX Algo signal.
‼️ Important Notes
TradingView has limitations when running advanced screeners, resulting in the following restrictions:
Computation Errors:
The computation of using MTF features and viewing several tickers is very intensive on TradingView. This can sometimes cause calculation timeouts. When this occurs simply force the recalculation by modifying one indicator’s settings or by removing the indicator and adding it to your chart again.
Inconsistencies:
You may notice inconsistencies when viewing the screener on a chart with a specific symbol because screener tickers originate from different markets. Since the cryptocurrency market operates 24/7, while stock markets have defined opening and closing hours, the screener may return varying information depending on whether you're currently viewing a cryptocurrency, stock, or currency pair.
Flux Charts - S&D Screener💎 GENERAL OVERVIEW
Introducing Supply & Demand Zones (S&D) Screener! This screener can spot trading opportunities for Supply & Demand traders across 8 different tickers and timeframes simultaneously! This screener offers a wide range of configurable settings, explained within this write-up.
S&D Screener Features:
Supply & Demand Zones : This tool can detect Supply & Demand zones using one of the two detection methods.
Highly Configurable : Offers multiple parameters for fine-tuning detection settings.
Up to 8 Tickers : Allows traders to analyze multiple tickers & timeframes simultaneously for enhanced accuracy.
🚩 UNIQUENESS
The S&D Screener is the first ever tool on TradingView that allows traders to screen 8 different tickers on different timeframes for Supply & Demand Zones. Key factors that make it unique include:
✅ Comprehensive Dashboard – This screener provides a complete and customizable dashboard designed to enhance traders' decision-making by consolidating crucial Supply & Demand insights into one user-friendly interface.
✅ Multi-Ticker & Multi-Timeframe Analysis – With support for up to 8 tickers and timeframes, traders can effortlessly analyze the bigger market picture, identifying trends and opportunities across different assets and timeframes.
By combining multiple analytical elements in a single view, this screener empowers traders with the insights needed to navigate the market more effectively.
📌 HOW DOES IT WORK ?
The S&D Screener helps traders identify Supply & Demand Zones on multiple tickers & timeframes. It offers customizable settings to adapt to different trading styles. The screener includes two zone detection methods. The Momentum Method identifies zones based on strong bullish or bearish price movements, making it ideal for traders who seek quick market reactions. The Regression Method uses statistical regression to detect zones by analyzing price deviations from the trend, which is more suitable for long-term traders. You can customize your zone preferences and enable up to 8 tickers and their respective timeframes. You'll be able to see the status of the latest detected zones on that ticker/timeframe. You can also see the distance from current price of the ticker to the zone and how many times price has retested that zone.
Supply Zone
In trading, a supply zone is a specific area on a price chart where selling interest surpasses buying interest, leading to a potential decline in asset prices. This zone typically forms after a price rally, indicating that sellers find the asset overvalued and are prepared to sell, creating downward pressure. Identifying supply zones can help traders anticipate potential price reversals or pullbacks.
Trading Possibilities with Supply Zones
Entering Short Positions -> When the price approaches a recognized supply zone, traders may consider initiating short positions, anticipating that increased selling pressure will drive prices down.
Setting Profit Targets -> For traders holding long positions, supply zones can serve as strategic points to set profit targets, as these areas may signal potential resistance and a subsequent price drop.
Demand Zone
In trading, a demand zone is a specific area on a price chart where buying interest is strong enough to halt a downtrend and potentially reverse it upward. This zone indicates a price level where demand exceeds supply, leading to a rise in price. Identifying these zones can provide traders with strategic entry points for potential long positions.
Trading Possibilities with Demand Zones
Entering Long Positions -> When the price approaches a recognized demand zone, traders may consider initiating long positions, anticipating that increased buying pressure will drive prices up.
Setting Profit Targets -> For traders holding short positions, demand zones can serve as strategic points to set profit targets, as these areas may signal potential resistance and a subsequent price increase.
Momentum Detection Method
The Momentum Detection Method identifies supply and demand zones by analyzing the strength and direction of price movements over a specified period. It looks for a sequence of strong bullish or bearish candles to determine potential zones. The method is sensitive to the ‘Sensitivity’ setting, which adjusts the threshold for what constitutes a "strong" candle.
Using the momentum method is ideal for traders looking to capitalize on immediate price reactions and momentum shifts.
Regression Detection Method
The Regression Method uses statistical regression to identify supply and demand zones by analyzing price consolidation patterns. It fits a regression line to price data and identifies zones where price deviates significantly from the trend. This method is more mathematical and less reliant on individual candle patterns. It focuses on the overall price structure and identifies zones based on statistical deviations from the trend.
This method is particularly useful for traders who focus on longer-term price trends and prefer a more statistical approach to pinpoint zones.
Using the momentum method is ideal for traders looking to capitalize on immediate price reactions and momentum shifts.
Status ->
Far -> This status indicates that the current price is significantly distant from any identified supply or demand zones. In this scenario, traders might exercise patience, waiting for the price to approach these zones before considering entry or exit points.
Approaching ⬆️ -> The price is rising towards a supply zone, suggesting potential selling opportunities as the price nears an area where selling pressure previously dominated.
Approaching ⬇️ -> The price is falling towards a demand zone, indicating potential buying opportunities as the price approaches an area known for strong buying interest.
Inside -> The current price is within the boundaries of a supply or demand zone. This status often signals a critical decision point:
Inside a Supply Zone: The area where selling pressure may increase, potentially leading to a price decline. Traders might look for confirmation before initiating short positions.
Inside a Demand Zone: The area where buying interest could surge, possibly resulting in a price increase. Traders might seek validation before entering long positions.
Being "inside" a zone suggests heightened market activity and potential volatility, warranting close monitoring for trading signals.
Retests -> A retest occurs when the price revisits a supply or demand zone but fails to break through it. Specifically, during a retest, the wick of a candlestick enters the zone, but the candle closes below the supply zone or above the demand zone. This price action suggests that the zone remains a strong area of resistance or support, as the market couldn't sustain movement beyond it. Traders often view such retests as confirmations to enter positions in the direction opposite to the zone's boundary. For instance, if the price retests a supply zone and fails to close above it, it may signal a selling opportunity. Conversely, a failed retest of a demand zone could indicate a buying opportunity. Monitoring the number of retests can provide insights into the strength of these zones; multiple retests without a breakout may reinforce the zone's significance. Here you can see how many times the price retested the supply or demand zone.
⚠ Timeframe Restriction : The selected timeframes for analysis cannot be lower than the chart’s current timeframe to ensure proper data alignment.
⏰ ALERTS
This screener supports alerts, so you never miss a key market move. You can choose to receive alerts when a new demand or supply zone is created, helping you spot potential trading opportunities. Additionally, you can enable alerts for retests, which notify you when the price returns to test a previously identified zone. The alerts will work for each enabled ticker in the settings.
⚙️ SETTINGS
1. General Configuration
Detection Method : There are two detection methods you can choose from for identifying Supply & Demand Zones. Both methods aim to identify key areas where price is likely to react, but they do so using different approaches. Traders can choose the method that aligns with their trading style and time horizon.
Sensitivity : The Sensitivity setting allows traders to adjust how aggressively the script identifies supply and demand zones when using the Momentum Detection Method. This setting directly impacts the threshold for detecting zones when using the momentum detection method.
High Sensitivity -> Detects smaller price movements, resulting in more zones being identified. This is ideal for traders who want to capture even minor supply and demand imbalances and prefer a higher frequency of potential trading opportunities.
Medium Sensitivity -> Balances between detecting significant price movements and avoiding excessive noise. This setting is suitable for most traders who want a moderate number of zones without being overwhelmed.
Low Sensitivity -> Focuses on larger, more significant price movements, resulting in fewer zones being identified. This is ideal for traders who prioritize quality over quantity and prefer to focus on the most impactful supply and demand areas.
Lowest Sensitivity -> Detects only the strongest and most pronounced price movements, identifying the most significant zones. This setting is best for traders who want to focus on high-probability, high-impact zones and avoid minor fluctuations.
Zone Invalidation : The Zone Invalidation setting determines how supply and demand zones are invalidated.
Wick -> A zone is invalidated if a candle’s wick goes below a demand zone or above a supply zone.
Close -> A zone is invalidated if a candle closes below a demand zone or above a supply zone.
Zone Visibility Range : The Zone Visibility Range setting controls how far from the current price supply and demand zones are displayed on the chart. It helps traders focus on relevant zones while avoiding clutter from distant or less impactful areas.
Minimum Zone Width : The Minimum Zone Width setting defines the smallest size a supply or demand zone must have to be displayed on the chart. It uses the Average True Range (ATR) as a reference to ensure zones are proportionate to current market volatility.
Minimum Zone Length : The Minimum Zone Length setting determines the minimum number of bars a supply or demand zone must span to be displayed on the chart. This setting helps filter out short-lived or insignificant zones, ensuring only meaningful areas of supply or demand are highlighted.
2. Tickers
You can set, then enable or disable up to 8 tickers in this section to get informed about their latest supply or demand zone.
libTFLibrary "libTF"
libTF: Find higher/lower TF automatically
This library to find higher/lower TF from current timeframe(timeframe.period) for Pine Script version6(or higher).
Basic Algorithm
Using a timeframe scale Array and timeframe.in_seconds() function to find higher/lower timeframe.
Return value is na if could not find TF in the timeframe scale.
The timeframe scale could be changed by the parameter 'scale'(CSV).
How to use
1. Set higher/lower TF
higher()/lower() function returns higher/lower TF.
Default timeframe scale is "1, 5, 15, 60, 240, 1D, 1M, 3M, 12M".
example:
htf1 = higher()
htf2 = higher(htf1)
ltf1 = lower()
ltf2 = lower(ltf1)
2. Set higher/lower TF using your timeframe scale
The timeframe scale could be changed by the parameter.
example:
myscale="1,60,1D,1M,12M"
htf1 = higher(timeframe.period,myscale)
htf2 = higher(htf1,myscale)
ltf1 = lower(timeframe.period,myscale)
ltf2 = lower(ltf1,myscale)
3. How to use with request.*() function
na value is set if no higher/lower TF in timeframe scale.
It returns current timeframe's value, when na value as timeframe parameter in request.*().
As bellow, if it should be na when timeframe is na.
example:
return_value_request_htf1 = na(htf1)?na:request.security(syminfo.tickerid,htf1,timeframe.period)
return_value_request_ltf1 = na(ltf1)?na:request.security(syminfo.tickerid,ltf1,timeframe.period)
higher(tf, scale)
higher: find higher TF from TF string.
Parameters:
tf (string) : default value is timeframe.period.
scale (string) : TF scale in CSV. default is "1,5,15,60,240,1D,1W,1M,3M,12M".
Returns: higher TF string.
lower(tf, scale)
lower: find lower TF from TF string.
Parameters:
tf (string) : default value is timeframe.period.
scale (string) : TF scale in CSV. defalut is "1,5,15,60,240,1D,1W,1M,3M,12M".
Returns: lower TF string.
Contraction & Expansion Multi-Screener █ Overview:
The Contraction & Expansion Multi-Screener analyzes market volatility across many symbols. It provides insights into whether a market is contracting or expanding in volatility. With using a range of statistical models for modeling realized volatility, the script calculates, ranks, and monitors the degree of contraction or expansions in market volatility. The objective is to provide actionable insights into the current market phases by using historical data to model current volatility conditions.
This indicator accomplishes this by aggregating a variety of volatility measures, computing ranks, and applying threshold-based methods to identify transitions in market behavior. Volatility itself helps you understand if the market is moving a lot. High volatility or volatility that is increasing over time, means that the price is moving a lot. Volatility also mean reverts so if its extremely low, you can eventually expect it to return to its expected value, meaning there will be bigger price moves, and vice versa.
█ Features of the Indicator
This indicator allows the user to select up to 14 different symbols and retrieve their price data. There is five different types of volatility models that you can choose from in the settings of this indicator for how to use the screener.
Volatility Settings:
Standard Deviation
Relative Standard Deviation
Mean Absolute Deviation
Exponentially Weighted Moving Average (EWMA)
Average True Range (ATR)
Standard Deviation, Mean Absolute Deviation, and EWMA use returns to model the volatility, meanwhile Relative Standard Deviation uses price instead due to its geometric properties, and Average True Range for capturing the absolute movement in price. In this indicator the volatility is ranked, so if the volatility is at 0 or near 0 then it is contracting and the volatility is low. If the volatility is near 100 or at 100 then the volatility is at its maximum.
For traders that use the Forex Master Pattern Indicator 2 and want to use this indicator for that indicator, it is recommended to set your volatility type to Relative Standard Deviation.
Users can also modify the location of the screener to be on the top left, top right, bottom left, or bottom right. You also can disable sections of the screener and show a smaller list if you want to.
The Contraction & Expansion Screener shows you the following information:
Confirmation of whether or not there is a contraction or expansion
Percentage Rank of the volatility
Volatility MA direction: This screener uses moving averages on the volatility to determine if its increasing over time or decreasing over time.
HTFCandlesLibLibrary "HTFCandlesLib"
Library to get detailed higher timeframe candle information
method tostring(this, delimeter)
Returns OHLC values, BarIndex of higher and lower timeframe candles in string format
Namespace types: Candle
Parameters:
this (Candle) : Current Candle object
delimeter (string) : delimeter to join the string components of the candle
Returns: String representation of the Candle
method draw(this, bullishColor, bearishColor, printDescription)
Draws the current candle using boxes and lines for body and wicks
Namespace types: Candle
Parameters:
this (Candle) : Current Candle object
bullishColor (color) : color for bullish representation
bearishColor (color) : color for bearish representation
printDescription (bool) : if set to true prints the description
Returns: Current candle object
getCurrentCandle(ltfCandles)
Gets the current candle along with reassigned ltf components. To be used with request.security to capture higher timeframe candle data
Parameters:
ltfCandles (array) : Lower timeframe Candles array
Returns: Candle object with embedded lower timeframe key candles in them
Candle
Candle represents the data related to a candle
Fields:
o (series float) : Open price of the candle
h (series float) : High price of the candle
l (series float) : Low price of the candle
c (series float) : Close price of the candle
lo (Candle) : Lower timeframe candle that records the open price of the current candle.
lh (Candle) : Lower timeframe candle that records the high price of the current candle.
ll (Candle) : Lower timeframe candle that records the low price of the current candle.
lc (Candle) : Lower timeframe candle that records the close price of the current candle.
barindex (series int) : Bar Index of the candle
bartime (series int) : Bar time of the candle
last (Candle) : Link to last candle of the series if any
TimeLibraryLibrary "TimeLibrary"
TODO: add library description here
Line_Type_Control(Type)
Line_Type_Control: This function changes between common line types options available are "Solid","Dashed","Dotted"
Parameters:
Type (string) : : The string to choose the line type from
Returns: Line_Type : returns the pine script equivalent of the string input
Text_Size_Switch(Text_Size)
Text_Size_Switch : This function changes between common text sizes options are "Normal", "Tiny", "Small", "Large", "Huge", "Auto"
Parameters:
Text_Size (string) : : The string to choose the text type from
Returns: Text_Type : returns the pine script equivalent of the string input
TF(TF_Period, TF_Multip)
TF generates a string representation of a time frame based on the provided time frame unit (`TF_Period`) and multiplier (`TF_Multip`).
Parameters:
TF_Period (simple string)
TF_Multip (simple int)
Returns: A string that represents the time frame in Pine Script format, depending on the `TF_Period`:
- For "Minute", it returns the multiplier as a string (e.g., "5" for 5 minutes).
- For "Hour", it returns the equivalent number of minutes (e.g., "120" for 2 hours).
- For "Day", it appends "D" to the multiplier (e.g., "2D" for 2 days).
- For "Week", it appends "W" to the multiplier (e.g., "1W" for 1 week).
- For "Month", it appends "M" to the multiplier (e.g., "3M" for 3 months).
If none of these cases match, it returns the current chart's time frame.
TF_Display(Chart_as_Timeframe, TF_Period, TF_Multip)
TF_Display generates a string representation of a time frame based on user-defined inputs or the current chart's time frame settings.
Parameters:
Chart_as_Timeframe (bool) : (bool): Determines whether to use the current chart's time frame or a custom time frame.
TF_Period` (string): The time frame unit (e.g., "Minute", "Hour", "Day", "Week", "Month").
TF_Multip` (int): The multiplier for the time frame (e.g., 15 for 15 minutes, 2 for 2 days).
TF_Period (string)
TF_Multip (int)
Returns: If `Chart_as_Timeframe` is `false`, the function returns a time frame string based on the provided `TF_Period` and `TF_Multip` values (e.g., "5Min", "2D").
If `Chart_as_Timeframe` is `true`, the function determines the current chart's time frame and returns it as a string:
For minute-based time frames, it returns the number of minutes with "Min" (e.g., "15Min") unless it's an exact hour, in which case it returns the hour (e.g., "1H").
For daily, weekly, and monthly time frames, it returns the multiplier with the appropriate unit (e.g., "1D" for daily, "1W" for weekly, "1M" for monthly).
MTF_MS_Display(Chart_as_Timeframe, TF_Period, TF_Multip, Swing_Length)
MTF_MS_Display This function calculates and returns a modified swing length value based on the selected time frame and current chart's time frame.
Parameters:
Chart_as_Timeframe (bool)
TF_Period (string)
TF_Multip (int)
Swing_Length (int)
HTF_Structure_Control(Chart_as_Timeframe, Show_Only_On_Lower_Timeframes, TF_Period, TF_Multip)
Parameters:
Chart_as_Timeframe (bool)
Show_Only_On_Lower_Timeframes (bool)
TF_Period (string)
TF_Multip (int)
TimeframeComparisonLibrary "TimeframeComparison"
Timeframe comparison for higher and lower timeframe
█ OVERVIEW
This library is used to compare higher / lower timeframe by using timeframe.multiplier.
minMult()
timeframe multiplier in minutes
Returns: float value
RSI MTF Panel [xdecow]This indicator shows the RSI of up to 10 different timeframes with various customization options:
Panel position
Panel orientation (vertical/horizontal)
Border width and color
Choose up to 10 time frames with RSI length and source
Background and text colors
Thresholds of overbought, oversold, uptrend, downtrend and no-trend zones to change the color of the RSI
Color debug mode
MTF_DrawingsLibrary 'MTF_Drawings'
This library helps with drawing indicators and candle charts on all timeframes.
FEATURES
CHART DRAWING : Library provides functions for drawing High Time Frame (HTF) and Low Time Frame (LTF) candles.
INDICATOR DRAWING : Library provides functions for drawing various types of HTF and LTF indicators.
CUSTOM COLOR DRAWING : Library allows to color candles and indicators based on specific conditions.
LINEFILLS : Library provides functions for drawing linefills.
CATEGORIES
The functions are named in a way that indicates they purpose:
{Ind} : Function is meant only for indicators.
{Hist} : Function is meant only for histograms.
{Candle} : Function is meant only for candles.
{Draw} : Function draws indicators, histograms and candle charts.
{Populate} : Function generates necessary arrays required by drawing functions.
{LTF} : Function is meant only for lower timeframes.
{HTF} : Function is meant only for higher timeframes.
{D} : Function draws indicators that are composed of two lines.
{CC} : Function draws custom colored indicators.
USAGE
Import the library into your script.
Before using any {Draw} function it is necessary to use a {Populate} function.
Choose the appropriate one based on the category, provide the necessary arguments, and then use the {Draw} function, forwarding the arrays generated by the {Populate} function.
This doesn't apply to {Draw_Lines}, {LineFill}, or {Barcolor} functions.
EXAMPLE
import Spacex_trader/MTF_Drawings/1 as tf
//Request lower timeframe data.
Security(simple string Ticker, simple string New_LTF, float Ind) =>
float Value = request.security_lower_tf(Ticker, New_LTF, Ind)
Value
Timeframe = input.timeframe('1', 'Timeframe: ')
tf.Draw_Ind(tf.Populate_LTF_Ind(Security(syminfo.tickerid, Timeframe, ta.rsi(close, 14)), 498, color.purple), 1, true)
FUNCTION LIST
HTF_Candle(BarsBack, BodyBear, BodyBull, BordersBear, BordersBull, WickBear, WickBull, LineStyle, BoxStyle, LineWidth, HTF_Open, HTF_High, HTF_Low, HTF_Close, HTF_Bar_Index)
Populates two arrays with drawing data of the HTF candles.
Parameters:
BarsBack (int) : Bars number to display.
BodyBear (color) : Candle body bear color.
BodyBull (color) : Candle body bull color.
BordersBear (color) : Candle border bear color.
BordersBull (color) : Candle border bull color.
WickBear (color) : Candle wick bear color.
WickBull (color) : Candle wick bull color.
LineStyle (string) : Wick style (Solid-Dotted-Dashed).
BoxStyle (string) : Border style (Solid-Dotted-Dashed).
LineWidth (int) : Wick width.
HTF_Open (float) : HTF open price.
HTF_High (float) : HTF high price.
HTF_Low (float) : HTF low price.
HTF_Close (float) : HTF close price.
HTF_Bar_Index (int) : HTF bar_index.
Returns: Two arrays with drawing data of the HTF candles.
LTF_Candle(BarsBack, BodyBear, BodyBull, BordersBear, BordersBull, WickBear, WickBull, LineStyle, BoxStyle, LineWidth, LTF_Open, LTF_High, LTF_Low, LTF_Close)
Populates two arrays with drawing data of the LTF candles.
Parameters:
BarsBack (int) : Bars number to display.
BodyBear (color) : Candle body bear color.
BodyBull (color) : Candle body bull color.
BordersBear (color) : Candle border bear color.
BordersBull (color) : Candle border bull color.
WickBear (color) : Candle wick bear color.
WickBull (color) : Candle wick bull color.
LineStyle (string) : Wick style (Solid-Dotted-Dashed).
BoxStyle (string) : Border style (Solid-Dotted-Dashed).
LineWidth (int) : Wick width.
LTF_Open (float ) : LTF open price.
LTF_High (float ) : LTF high price.
LTF_Low (float ) : LTF low price.
LTF_Close (float ) : LTF close price.
Returns: Two arrays with drawing data of the LTF candles.
Draw_Candle(Box, Line, Offset)
Draws HTF or LTF candles.
Parameters:
Box (box ) : Box array with drawing data.
Line (line ) : Line array with drawing data.
Offset (int) : Offset of the candles.
Returns: Drawing of the candles.
Populate_HTF_Ind(IndValue, BarsBack, IndColor, HTF_Bar_Index)
Populates one array with drawing data of the HTF indicator.
Parameters:
IndValue (float) : Indicator value.
BarsBack (int) : Indicator lines to display.
IndColor (color) : Indicator color.
HTF_Bar_Index (int) : HTF bar_index.
Returns: An array with drawing data of the HTF indicator.
Populate_LTF_Ind(IndValue, BarsBack, IndColor)
Populates one array with drawing data of the LTF indicator.
Parameters:
IndValue (float ) : Indicator value.
BarsBack (int) : Indicator lines to display.
IndColor (color) : Indicator color.
Returns: An array with drawing data of the LTF indicator.
Draw_Ind(Line, Mult, Exe)
Draws one HTF or LTF indicator.
Parameters:
Line (line ) : Line array with drawing data.
Mult (int) : Coordinates multiplier.
Exe (bool) : Display the indicator.
Returns: Drawing of the indicator.
Populate_HTF_Ind_D(IndValue_1, IndValue_2, BarsBack, IndColor_1, IndColor_2, HTF_Bar_Index)
Populates two arrays with drawing data of the HTF indicators.
Parameters:
IndValue_1 (float) : First indicator value.
IndValue_2 (float) : Second indicator value.
BarsBack (int) : Indicator lines to display.
IndColor_1 (color) : First indicator color.
IndColor_2 (color) : Second indicator color.
HTF_Bar_Index (int) : HTF bar_index.
Returns: Two arrays with drawing data of the HTF indicators.
Populate_LTF_Ind_D(IndValue_1, IndValue_2, BarsBack, IndColor_1, IndColor_2)
Populates two arrays with drawing data of the LTF indicators.
Parameters:
IndValue_1 (float ) : First indicator value.
IndValue_2 (float ) : Second indicator value.
BarsBack (int) : Indicator lines to display.
IndColor_1 (color) : First indicator color.
IndColor_2 (color) : Second indicator color.
Returns: Two arrays with drawing data of the LTF indicators.
Draw_Ind_D(Line_1, Line_2, Mult, Exe_1, Exe_2)
Draws two LTF or HTF indicators.
Parameters:
Line_1 (line ) : First line array with drawing data.
Line_2 (line ) : Second line array with drawing data.
Mult (int) : Coordinates multiplier.
Exe_1 (bool) : Display the first indicator.
Exe_2 (bool) : Display the second indicator.
Returns: Drawings of the indicators.
Barcolor(Box, Line, BarColor)
Colors the candles based on indicators output.
Parameters:
Box (box ) : Candle box array.
Line (line ) : Candle line array.
BarColor (color ) : Indicator color array.
Returns: Colored candles.
Populate_HTF_Ind_D_CC(IndValue_1, IndValue_2, BarsBack, BullColor, BearColor, IndColor_1, HTF_Bar_Index)
Populates two array with drawing data of the HTF indicators with color based on: IndValue_1 >= IndValue_2 ? BullColor : BearColor.
Parameters:
IndValue_1 (float) : First indicator value.
IndValue_2 (float) : Second indicator value.
BarsBack (int) : Indicator lines to display.
BullColor (color) : Bull color.
BearColor (color) : Bear color.
IndColor_1 (color) : First indicator color.
HTF_Bar_Index (int) : HTF bar_index.
Returns: Three arrays with drawing and color data of the HTF indicators.
Populate_LTF_Ind_D_CC(IndValue_1, IndValue_2, BarsBack, BullColor, BearColor, IndColor_1)
Populates two arrays with drawing data of the LTF indicators with color based on: IndValue_1 >= IndValue_2 ? BullColor : BearColor.
Parameters:
IndValue_1 (float ) : First indicator value.
IndValue_2 (float ) : Second indicator value.
BarsBack (int) : Indicator lines to display.
BullColor (color) : Bull color.
BearColor (color) : Bearcolor.
IndColor_1 (color) : First indicator color.
Returns: Three arrays with drawing and color data of the LTF indicators.
Populate_HTF_Hist_CC(HistValue, IndValue_1, IndValue_2, BarsBack, BullColor, BearColor, HTF_Bar_Index)
Populates one array with drawing data of the HTF histogram with color based on: IndValue_1 >= IndValue_2 ? BullColor : BearColor.
Parameters:
HistValue (float) : Indicator value.
IndValue_1 (float) : First indicator value.
IndValue_2 (float) : Second indicator value.
BarsBack (int) : Indicator lines to display.
BullColor (color) : Bull color.
BearColor (color) : Bearcolor.
HTF_Bar_Index (int) : HTF bar_index
Returns: Two arrays with drawing and color data of the HTF histogram.
Populate_LTF_Hist_CC(HistValue, IndValue_1, IndValue_2, BarsBack, BullColor, BearColor)
Populates one array with drawing data of the LTF histogram with color based on: IndValue_1 >= IndValue_2 ? BullColor : BearColor.
Parameters:
HistValue (float ) : Indicator value.
IndValue_1 (float ) : First indicator value.
IndValue_2 (float ) : Second indicator value.
BarsBack (int) : Indicator lines to display.
BullColor (color) : Bull color.
BearColor (color) : Bearcolor.
Returns: Two array with drawing and color data of the LTF histogram.
Populate_LTF_Hist_CC_VA(HistValue, Value, BarsBack, BullColor, BearColor)
Populates one array with drawing data of the LTF histogram with color based on: HistValue >= Value ? BullColor : BearColor.
Parameters:
HistValue (float ) : Indicator value.
Value (float) : First indicator value.
BarsBack (int) : Indicator lines to display.
BullColor (color) : Bull color.
BearColor (color) : Bearcolor.
Returns: Two array with drawing and color data of the LTF histogram.
Populate_HTF_Ind_CC(IndValue, IndValue_1, BarsBack, BullColor, BearColor, HTF_Bar_Index)
Populates one array with drawing data of the HTF indicator with color based on: IndValue >= IndValue_1 ? BullColor : BearColor.
Parameters:
IndValue (float) : Indicator value.
IndValue_1 (float) : Second indicator value.
BarsBack (int) : Indicator lines to display.
BullColor (color) : Bull color.
BearColor (color) : Bearcolor.
HTF_Bar_Index (int) : HTF bar_index
Returns: Two arrays with drawing and color data of the HTF indicator.
Populate_LTF_Ind_CC(IndValue, IndValue_1, BarsBack, BullColor, BearColor)
Populates one array with drawing data of the LTF indicator with color based on: IndValue >= IndValue_1 ? BullColor : BearColor.
Parameters:
IndValue (float ) : Indicator value.
IndValue_1 (float ) : Second indicator value.
BarsBack (int) : Indicator lines to display.
BullColor (color) : Bull color.
BearColor (color) : Bearcolor.
Returns: Two arrays with drawing and color data of the LTF indicator.
Draw_Lines(BarsBack, y1, y2, LineType, Fill)
Draws price lines on indicators.
Parameters:
BarsBack (int) : Indicator lines to display.
y1 (float) : Coordinates of the first line.
y2 (float) : Coordinates of the second line.
LineType (string) : Line type.
Fill (color) : Fill color.
Returns: Drawing of the lines.
LineFill(Upper, Lower, BarsBack, FillColor)
Fills two lines with linefill HTF or LTF.
Parameters:
Upper (line ) : Upper line.
Lower (line ) : Lower line.
BarsBack (int) : Indicator lines to display.
FillColor (color) : Fill color.
Returns: Linefill of the lines.
Populate_LTF_Hist(HistValue, BarsBack, HistColor)
Populates one array with drawing data of the LTF histogram.
Parameters:
HistValue (float ) : Indicator value.
BarsBack (int) : Indicator lines to display.
HistColor (color) : Indicator color.
Returns: One array with drawing data of the LTF histogram.
Populate_HTF_Hist(HistValue, BarsBack, HistColor, HTF_Bar_Index)
Populates one array with drawing data of the HTF histogram.
Parameters:
HistValue (float) : Indicator value.
BarsBack (int) : Indicator lines to display.
HistColor (color) : Indicator color.
HTF_Bar_Index (int) : HTF bar_index.
Returns: One array with drawing data of the HTF histogram.
Draw_Hist(Box, Mult, Exe)
Draws HTF or LTF histogram.
Parameters:
Box (box ) : Box Array.
Mult (int) : Coordinates multiplier.
Exe (bool) : Display the histogram.
Returns: Drawing of the histogram.
libHTF[without request.security()]Library "libHTF"
libHTF: use HTF values without request.security()
This library enables to use HTF candles without request.security().
Basic data structure
Using to access values in the same manner as series variable.
The last member of HTF array is always latest current TF's data.
If new bar in HTF(same as last bar closes), new member is pushed to HTF array.
2nd from the last member of HTF array is latest fixed(closed) bar.
HTF: How to use
1. set TF
tf_higher() function selects higher TF. TF steps are ("1","5","15","60","240","D","W","M","3M","6M","Y").
example:
tfChart = timeframe.period
htf1 = tf_higher(tfChart)
2. set HTF matrix
htf_candle() function returns 1 bool and 1 matrix.
bool is a flag for start of new candle in HTF context.
matrix is HTF candle data(0:open,1:time_open,2:close,3:time_close,4:high,5:time:high,6:low,7:time_low).
example:
=htf_candle(htf1)
3. how to access HTF candle data
you can get values using .lastx() method.
please be careful, return value is always float evenif it is "time". you need to cast to int time value when using for xloc.bartime.
example:
htf1open=m1.lastx("open")
htf1close=m1.lastx("close")
//if you need to use histrical value.
lastopen=open
lasthtf1open=m1.lastx("open",1)
4. how to store Data of HTF context
you have to use array to store data of HTF context.
array.htf_push() method handles the last member of array. if new_bar in HTF, it push new member. otherwise it set value to the last member.
example:
array a_close=array.new(1,na)
a_close.htf_push(b_new_bar1,m1.lastx("close"))
HTFsrc: How to use
1. how to setup src.
set_src() function is set current tf's src from string(open/high/low/close/hl2/hlc3/ohlc4/hlcc4).
set_htfsrc() function returns src array of HTF candle.
example:
_src="ohlc4"
src=set_src(_src)
htf1src=set_htfsrc(_src,b_new_bar1,m1)
(if you need to use HTF src in series float)
s_htf1src=htf1src.lastx()
HighLow: How to use
1. set HTF arrays
highlow() and htfhighlow() function calculates high/low and return high/low prices and time.
the functions return 1 int and 8arrays.
int is a flag for new high(1) or new low(-1).
arrays are high/low and return high/low data. float for price, int for time.
example
=
highlow()
=
htfhighlow(m1)
2. how to access HighLow data
you can get values using .lastx() method.
example:
if i_renew==1
myhigh=a_high.lastx()
//if you need to use histrical value.
myhigh=a_high.lastx(1)
other functions
functions for HTF candle matrix or HTF src array in this script are
htf_sma()/htf_ema()/htf_rma()
htf_rsi()/htf_rci()/htf_dmi()
method lastx(arrayid, lastindex)
method like array.last. it returns lastindex from the last member, if parameter is set.
Namespace types: float
Parameters:
arrayid (float )
lastindex (int) : (int) default value is "0"(the last member). if you need to access historical value, increment it(same manner as series vars).
Returns: float value of lastindex from the last member of the array. returns na, if fail.
method lastx(arrayid, lastindex)
method like array.last. it returns lastindex from the last member, if parameter is set.
Namespace types: int
Parameters:
arrayid (int )
lastindex (int) : (int) default value is "0"(the last member). if you need to access historical value, increment it(same manner as series vars).
Returns: int value of lastindex from the last member of the array. returns na, if fail.
method lastx(m, _type, lastindex)
method for handling htf matrix.
Namespace types: matrix
Parameters:
m (matrix) : (matrix) matrix for htf candle.
_type (string) : (string) value type of htf candle:
lastindex (int) : (int) default value is "0"(the last member).
Returns: (float) value of htf candle. (caution: need to cast float to int to use time values!)
method set_last(arrayid, val)
method to set a value of the last member of the array. it sets value to the last member.
Namespace types: float
Parameters:
arrayid (float )
val (float) : (float) value to set.
Returns: nothing
method htf_push(arrayid, b, val)
method to push new member to htf context. if new bar in htf, it works as push. else it works as set_last.
Namespace types: float
Parameters:
arrayid (float )
b (bool) : (bool) true:push,false:set_last
val (float) : (float) _f the value to set.
Returns: nothing
method tf_higher(tf)
method to set higher tf from tf string. TF steps are .
Namespace types: series string, simple string, input string, const string
Parameters:
tf (string) : (string) tf string
Returns: (string) string of higher tf.
htf_candle(_tf, _TZ)
build htf candles
Parameters:
_tf (string) : (string) tf string.
_TZ (string) : of timezone. default value is "GMT+3".
Returns: bool for new bar@htf and matrix for snapshot of htf candle
set_src(_src_type)
set src.
Parameters:
_src_type (string) : (string) type of source:
Returns: (series float) src value
set_htfsrc(_src_type, _nb, _m)
set htf src.
Parameters:
_src_type (string) : (string) type of source:
_nb (bool) : (bool) flag of new bar
_m (matrix) : (matrix) matrix for htf candle.
Returns: (array) array of src value
is_up()
last_is_up()
peak_bottom(_latest, _last)
Parameters:
_latest (bool)
_last (bool)
htf_is_up(_m)
Parameters:
_m (matrix)
htf_last_is_up(_m)
Parameters:
_m (matrix)
highlow(_b_bartime_price)
Parameters:
_b_bartime_price (bool)
htfhighlow(_m, _b_bartime_price)
Parameters:
_m (matrix)
_b_bartime_price (bool)
htf_sma(_a_src, _len)
Parameters:
_a_src (float )
_len (int)
htf_rma(_a_src, _new_bar, _len)
Parameters:
_a_src (float )
_new_bar (bool)
_len (int)
htf_ema(_a_src, _new_bar, _len)
Parameters:
_a_src (float )
_new_bar (bool)
_len (int)
htf_rsi(_a_src, _new_bar, _len)
Parameters:
_a_src (float )
_new_bar (bool)
_len (int)
rci(_src, _len)
Parameters:
_src (float)
_len (int)
htf_rci(_a_src, _len)
Parameters:
_a_src (float )
_len (int)
htf_dmi(_m, _new_bar, _len, _ma_type)
Parameters:
_m (matrix)
_new_bar (bool)
_len (int)
_ma_type (string)
lower_tf█ OVERVIEW
This library is a Pine programmer’s tool containing functions to help those who use the request.security_lower_tf() function. Its `ltf()` function helps translate user inputs into a lower timeframe string usable with request.security_lower_tf() . Another function, `ltfStats()`, accumulates statistics on processed chart bars and intrabars.
█ CONCEPTS
Chart bars
Chart bars , as referred to in our publications, are bars that occur at the current chart timeframe, as opposed to those that occur at a timeframe that is higher or lower than that of the chart view.
Intrabars
Intrabars are chart bars at a lower timeframe than the chart's. Each 1H chart bar of a 24x7 market will, for example, usually contain 60 intrabars at the LTF of 1min, provided there was market activity during each minute of the hour. Mining information from intrabars can be useful in that it offers traders visibility on the activity inside a chart bar.
Lower timeframes (LTFs)
A lower timeframe is a timeframe that is smaller than the chart's timeframe. This framework exemplifies how authors can determine which LTF to use by examining the chart's timeframe. The LTF determines how many intrabars are examined for each chart bar; the lower the timeframe, the more intrabars are analyzed.
Intrabar precision
The precision of calculations increases with the number of intrabars analyzed for each chart bar. As there is a 100K limit to the number of intrabars that can be analyzed by a script, a trade-off occurs between the number of intrabars analyzed per chart bar and the chart bars for which calculations are possible.
█ `ltf()`
This function returns a timeframe string usable with request.security_lower_tf() . It calculates the returned timeframe by taking into account a user selection between eight different calculation modes and the chart's timeframe. You send it the user's selection, along with the text corresponding to the eight choices from which the user has chosen, and the function returns a corresponding LTF string.
Because the function processes strings and doesn't require recalculation on each bar, using var to declare the variable to which its result is assigned will execute the function only once on bar zero and speed up your script:
var string ltfString = ltf(ltfModeInput, LTF1, LTF2, LTF3, LTF4, LTF5, LTF6, LTF7, LTF8)
The eight choices users can select from are of two types: the first four allow a selection from the desired amount of chart bars to be covered, the last four are choices of a fixed number of intrabars to be analyzed per chart bar. Our example code shows how to structure your input call and then make the call to `ltf()`. By changing the text associated with the `LTF1` to `LTF8` constants, you can tailor it to your preferences while preserving the functionality of `ltf()` because you will be sending those string constants as the function's arguments so it can determine the user's selection. The association between each `LTFx` constant and its calculation mode is fixed, so the order of the arguments is important when you call `ltf()`.
These are the first four modes and the `LTFx` constants corresponding to each:
Covering most chart bars (least precise) — LTF1
Covers all chart bars. This is accomplished by dividing the current timeframe in seconds by 4 and converting that number back to a string in timeframe.period format using secondsToTfString() . Due to the fact that, on premium subscriptions, the typical historical bar count is between 20-25k bars, dividing the timeframe by 4 ensures the highest level of intrabar precision possible while achieving complete coverage for the entire dataset with the maximum allowed 100K intrabars.
Covering some chart bars (less precise) — LTF2
Covering less chart bars (more precise) — LTF3
These levels offer a stepped LTF in relation to the chart timeframe with slightly more, or slightly less precision. The stepped lower timeframe tiers are calculated from the chart timeframe as follows:
Chart Timeframe Lower Timeframe
Less Precise More Precise
< 1hr 1min 1min
< 1D 15min 1min
< 1W 2hr 30min
> 1W 1D 60min
Covering the least chart bars (most precise) — LTF4
Analyzes the maximum quantity of intrabars possible by using the 1min LTF, which also allows the least amount of chart bars to be covered.
The last four modes allow the user to specify a fixed number of intrabars to analyze per chart bar. Users can choose from 12, 24, 50 or 100 intrabars, respectively corresponding to the `LTF5`, `LTF6`, `LTF7` and `LTF8` constants. The value is a target; the function will do its best to come up with a LTF producing the required number of intrabars. Because of considerations such as the length of a ticker's session, rounding of the LTF to the closest allowable timeframe, or the lowest allowable timeframe of 1min intrabars, it is often impossible for the function to find a LTF producing the exact number of intrabars. Requesting 100 intrabars on a 60min chart, for example, can only produce 60 1min intrabars. Higher chart timeframes, tickers with high liquidity or 24x7 markets will produce optimal results.
█ `ltfStats()`
`ltfStats()` returns statistics that will be useful to programmers using intrabar inspection. By analyzing the arrays returned by request.security_lower_tf() in can determine:
• intrabarsInChartBar : The number of intrabars analyzed for each chart bar.
• chartBarsCovered : The number of chart bars where intrabar information is available.
• avgIntrabars : The average number of intrabars analyzed per chart bar. Events like holidays, market activity, or reduced hours sessions can cause the number of intrabars to vary, bar to bar.
The function must be called on each bar to produce reliable results.
█ DEMONSTRATION CODE
Our example code shows how to provide users with an input from which they can select a LTF calculation mode. If you use this library's functions, feel free to reuse our input setup code, including the tooltip providing users with explanations on how it works for them.
We make a simple call to request.security_lower_tf() to fetch the close values of intrabars, but we do not use those values. We simply send the returned array to `ltfStats()` and then plot in the indicator's pane the number of intrabars examined on each bar and its average. We also display an information box showing the user's selection of the LTF calculation mode, the resulting LTF calculated by `ltf()` and some statistics.
█ NOTES
• As in several of our recent publications, this script uses secondsToTfString() to produce a timeframe string in timeframe.period format from a timeframe expressed in seconds.
• The script utilizes display.data_window and display.status_line to restrict the display of certain plots.
These new built-ins allow coders to fine-tune where a script’s plot values are displayed.
• We implement a new recommended best practice for tables which works faster and reduces memory consumption.
Using this new method, tables are declared only once with var , as usual. Then, on bar zero only, we use table.cell() calls to populate the table.
Finally, table.set_*() functions are used to update attributes of table cells on the last bar of the dataset.
This greatly reduces the resources required to render tables. We encourage all Pine Script™ programmers to do the same.
Look first. Then leap.
█ FUNCTIONS
The library contains the following functions:
ltf(userSelection, choice1, choice2, choice3, choice4, choice5, choice6, choice7, choice8)
Selects a LTF from the chart's TF, depending on the `userSelection` input string.
Parameters:
userSelection : (simple string) User-selected input string which must be one of the `choicex` arguments.
choice1 : (simple string) Input selection corresponding to "Least precise, covering most chart bars".
choice2 : (simple string) Input selection corresponding to "Less precise, covering some chart bars".
choice3 : (simple string) Input selection corresponding to "More precise, covering less chart bars".
choice4 : (simple string) Input selection corresponding to "Most precise, 1min intrabars".
choice5 : (simple string) Input selection corresponding to "~12 intrabars per chart bar".
choice6 : (simple string) Input selection corresponding to "~24 intrabars per chart bar".
choice7 : (simple string) Input selection corresponding to "~50 intrabars per chart bar".
choice8 : (simple string) Input selection corresponding to "~100 intrabars per chart bar".
Returns: (simple string) A timeframe string to be used with `request.security_lower_tf()`.
ltfStats()
Returns statistics about analyzed intrabars and chart bars covered by calls to `request.security_lower_tf()`.
Parameters:
intrabarValues : (float [ ]) The ID of a float array containing values fetched by a call to `request.security_lower_tf()`.
Returns: A 3-element tuple: [ (series int) intrabarsInChartBar, (series int) chartBarsCovered, (series float) avgIntrabars ].
Ultimate Custom MTF ScreenerThis indicator will allow you to make your custom TradingView MTF screener without coding. Add it to the chart, select up to 10 instruments, 4 timeframes, and 4 indicators, and the screener will do the rest for you. The indicator will form a lovely table with all values and highlighted signals.
The screener is highly customizable, and you can choose its position on the chart, sorting, order of the columns, and colors for the tables. You can easily change parameters for all supported indicators and their signals.
Currently, there are 21 different custom indicators available. Current list of indicators:
Average Directional Index (ADX) - displaying the value of ADX and checking if it's higher than the threshold
Average True Range (ATR) - showing the value of ATR
Awesome Oscillator (AO) - displaying the value of AO and highlighting positive/negative values.
Bollinger Bands (BB) - showing if the price is above/below/in the channel.
Breakout Pivots - Displaying when the price is below/above the most recent pivot low/high.
Commodity Channel Index (CCI) - shows the last CCI value and highlights overbought/oversold values.
Directional Movement Index (DMI) - Up/Down signal (+DI above or below -DI)
Donchian Channel (DC) - showing if the price is above/below/in the channel.
Heikin Ashi Count (HAC) - What is the current Heikin Ashi candle color and for how long was this color?
Historical Volatility (HV) - Current value of Historical Volatility
Keltner Channel (KC) -showing if the price is above/below/in the channel.
Moving Average Convergence Divergence (MACD) - Up/Down signal (MACD above / below signal)
Moving Average Crossover (MA Cross) - Displaying MA crosses signals (SMA, EMA, WMA, HMA, VWMA, SMMA, DEMA, VWAP supported)
Moving Average Distance (MA DIST) - Displaying distance to the MA (SMA, EMA, WMA, HMA, VWMA, SMMA, DEMA, VWAP supported)
Parabolic Stop and Reverse (PSAR) - Up or Down
Relative Strength Index (RSI) - Displaying the last RSI value and highlighting overbought/oversold values.
Stochastic (STOCH) - Displaying the last Stochastic value and highlighting overbought/oversold values.
Stochastic RSI (STOCH RSI) - Displaying the last Stochastic RSI value and highlighting overbought/oversold values.
SuperTrend - Current state of the SuperTrend.
Trailing Stop-Loss (TSL) - Up or Down
True Strength Index (TSI) - Displaying the last TSI value and highlighting overbought/oversold values.
We're already working on adding a few more supported indicators. If you have any ideas about the indicators you want to see in our screener, contact us, and we'll consider them.
Disclaimer
Please remember that past performance may not be indicative of future results.
Due to various factors, including changing market conditions, the strategy may no longer perform as well as in historical backtesting.
This post and the script don’t provide any financial advice.
drawcandlesLibrary "drawcandles"
simple utility to draw different candles using box and lines. Quite useful for drawing candles such as zigzag candles or MTF candles
draw(o, h, l, c, oBar, cBar)
draws candles based on ohlc values
Parameters:
o : Open Price
h : High Price
l : Low Price
c : Close Price
oBar : Open Time
cBar : Close Time
Returns: void
Custom Multi-Timeframe IndicatorIt's a pretty simple example of a nice custom screener you can run for multiple timeframes. This is an RSI screener, but you can easily change the function for your own Indicator.
Screener displays:
Last value of the instrument
RSI value for up to 10 instruments / 4 timeframes.
In Parameters you can change:
4 timeframes
10 instruments
Parameters for RSI
Styling parameters for table
If the selected timeframe will be lower than the current one you will receive a warning message in a table.
Thanks to @MUQWISHI to help me code it.
Disclaimer
Please remember that past performance may not be indicative of future results.
Due to various factors, including changing market conditions, the strategy may no longer perform as well as in historical backtesting.
This post and the script don’t provide any financial advice.
HighTimeframeSamplingLibrary "HighTimeframeSampling"
Library for sampling high timeframe (HTF) data. Returns an array of historical values, an arbitrary historical value, or the highest/lowest value in a range, spending a single security() call.
An optional pass-through for the chart timeframe is included. Other than that case, the data is fixed and does not alter over the course of the HTF bar. It behaves consistently on historical and elapsed realtime bars.
The first version returns floating-point numbers only. I might extend it if there's interest.
🙏 Credits: This library is (yet another) attempt at a solution of the problems in using HTF data that were laid out by Pinecoders - to whom, especially to Luc F, many thanks are due - in "security() revisited" - which I recommend you consult first. Go ahead, I'll wait.
All code is my own.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WHAT'S THE PROBLEM? OR, WHY NOT JUST USE SECURITY()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are many difficulties with using HTF data, and many potential solutions. It's not really possible to convey it only in words: you need to see it on a chart.
Before using this library, please refer to my other HTF library, HighTimeframeTiming: which explains it extensively, compares many different solutions, and demonstrates (what I think are) the advantages of using this very library, namely, that it's stable, accurate, versatile and inexpensive. Then if you agree, come back here and choose your function.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MOAR EXPLANATION
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
🧹 Housekeeping: To see which plot is which, turn line labels on: Settings > Scales > Indicator Name Label. Vertical lines at the top of the chart show the open of a HTF bar: grey for historical and white for real-time bars.
‼ LIMITATIONS: To avoid strange behaviour, use this library on liquid assets and at chart timeframes high enough to reliably produce updates at least once per bar period.
A more conventional and universal limitation is that the library does not offer an unlimited view of historical bars. You need to define upfront how many HTF bars you want to store. Very large numbers might conceivably run into data or performance issues.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BRING ON THE FUNCTIONS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@function f_HTF_Value(string _HTF, float _source, int _arrayLength, int _HTF_Offset, bool _useLiveDataOnChartTF=false)
Returns a floating-point number from a higher timeframe, with a historical operator within an abitrary (but limited) number of bars.
@param string _HTF is the string that represents the higher timeframe. It must be in a format that the request.security() function recognises. The input timeframe cannot be lower than the chart timeframe or an error is thrown.
@param float _source is the source value that you want to sample, e.g. close, open, etc., or you can use any floating-point number.
@param int _arrayLength is the number of HTF bars you want to store and must be greater than zero. You can't go back further in history than this number of bars (minus one, because the current/most recent available bar is also stored).
@param int _HTF_Offset is the historical operator for the value you want to return. E.g., if you want the most recent fixed close, _source=close and _HTF_Offset = 0. If you want the one before that, _HTF_Offset=1, etc.
The number of HTF bars to look back must be zero or more, and must be one less than the number of bars stored.
@param bool _useLiveDataOnChartTF uses live data on the chart timeframe.
If the higher timeframe is the same as the chart timeframe, store the live value (i.e., from this very bar). For all truly higher timeframes, store the fixed value (i.e., from the previous bar).
The default is to use live data for the chart timeframe, so that this function works intuitively, that is, it does not fix data unless it has to (i.e., because the data is from a higher timeframe).
This means that on default settings, on the chart timeframe, it matches the raw source values from security(){0}.
You can override this behaviour by passing _useLiveDataOnChartTF as false. Then it will fix all data for all timeframes.
@returns a floating-point value that you requested from the higher timeframe.
@function f_HTF_Array(string _HTF, float _source, int _arrayLength, bool _useLiveDataOnChartTF=false, int _startIn, int _endIn)
Returns an array of historical values from a higher timeframe, starting with the current bar. Optionally, returns a slice of the array. The array is in reverse chronological order, i.e., index 0 contains the most recent value.
@param string _HTF is the string that represents the higher timeframe. It must be in a format that the request.security() function recognises. The input timeframe cannot be lower than the chart timeframe or an error is thrown.
@param float _source is the source value that you want to sample, e.g. close, open, etc., or you can use any floating-point number.
@param int _arrayLength is the number of HTF bars you want to keep in the array.
@param bool _useLiveDataOnChartTF uses live data on the chart timeframe.
If the higher timeframe is the same as the chart timeframe, store the live value (i.e., from this very bar). For all truly higher timeframes, store the fixed value (i.e., from the previous bar).
The default is to use live data for the chart timeframe, so that this function works intuitively, that is, it does not fix data unless it has to (i.e., because the data is from a higher timeframe).
This means that on default settings, on the chart timeframe, it matches raw source values from security().
You can override this behaviour by passing _useLiveDataOnChartTF as false. Then it will fix all data for all timeframes.
@param int _startIn is the array index to begin taking a slice. Must be at least one less than the length of the array; if out of bounds it is corrected to 0.
@param int _endIn is the array index BEFORE WHICH to end the slice. If the ending index of the array slice would take the slice past the end of the array, it is corrected to the end of the array. The ending index of the array slice must be greater than or equal to the starting index. If the end is less than the start, the whole array is returned. If the starting index is the same as the ending index, an empty array is returned. If either the starting or ending index is negative, the entire array is returned (which is the default behaviour; this is effectively a switch to bypass the slicing without taking up an extra parameter).
@returns an array of HTF values.
@function f_HTF_Highest(string _HTF="", float _source, int _arrayLength, bool _useLiveDataOnChartTF=true, int _rangeIn)
Returns the highest value within a range consisting of a given number of bars back from the most recent bar.
@param string _HTF is the string that represents the higher timeframe. It must be in a format that the request.security() function recognises. The input timeframe cannot be lower than the chart timeframe or an error is thrown.
@param float _source is the source value that you want to sample, e.g. close, open, etc., or you can use any floating-point number.
@param int _arrayLength is the number of HTF bars you want to store and must be greater than zero. You can't have a range greater than this number.
@param bool _useLiveDataOnChartTF uses live data on the chart timeframe.
If the higher timeframe is the same as the chart timeframe, store the live value (i.e., from this very bar). For all truly higher timeframes, store the fixed value (i.e., from the previous bar).
The default is to use live data for the chart timeframe, so that this function works intuitively, that is, it does not fix data unless it has to (i.e., because the data is from a higher timeframe).
This means that on default settings, on the chart timeframe, it matches raw source values from security().
You can override this behaviour by passing _useLiveDataOnChartTF as false. Then it will fix all data for all timeframes.
@param _rangeIn is the number of bars to include in the range of bars from which we want to find the highest value. It is NOT the historical operator of the last bar in the range. The range always starts at the current bar. A value of 1 doesn't make much sense but the function will generously return the only value it can anyway. A value less than 1 doesn't make sense and will return an error. A value that is higher than the number of stored values will be corrected to equal the number of stored values.
@returns a floating-point number representing the highest value in the range.
@function f_HTF_Lowest(string _HTF="", float _source, int _arrayLength, bool _useLiveDataOnChartTF=true, int _rangeIn)
Returns the lowest value within a range consisting of a given number of bars back from the most recent bar.
@param string _HTF is the string that represents the higher timeframe. It must be in a format that the request.security() function recognises. The input timeframe cannot be lower than the chart timeframe or an error is thrown.
@param float _source is the source value that you want to sample, e.g. close, open, etc., or you can use any floating-point number.
@param int _arrayLength is the number of HTF bars you want to store and must be greater than zero. You can't go back further in history than this number of bars (minus one, because the current/most recent available bar is also stored).
@param bool _useLiveDataOnChartTF uses live data on the chart timeframe.
If the higher timeframe is the same as the chart timeframe, store the live value (i.e., from this very bar). For all truly higher timeframes, store the fixed value (i.e., from the previous bar).
The default is to use live data for the chart timeframe, so that this function works intuitively, that is, it does not fix data unless it has to (i.e., because the data is from a higher timeframe).
This means that on default settings, on the chart timeframe, it matches raw source values from security().
You can override this behaviour by passing _useLiveDataOnChartTF as false. Then it will fix all data for all timeframes.
@param _rangeIn is the number of bars to include in the range of bars from which we want to find the highest value. It is NOT the historical operator of the last bar in the range. The range always starts at the current bar. A value of 1 doesn't make much sense but the function will generously return the only value it can anyway. A value less than 1 doesn't make sense and will return an error. A value that is higher than the number of stored values will be corrected to equal the number of stored values.
@returns a floating-point number representing the lowest value in the range.
MTF Ichimoku Analysis[tanayroy]Ichimoku can state market conditions better than any indicator or group of indicators(My own perspective). Ichimoku works seamlessly in different timeframes. Analysis of Ichimoku in different timeframes can give you the bigger picture of the market.
This indicator analyzes six different timeframes with Ichimoku in depth. Default timeframes are 5M, 30M, 60M, D, W, and M. You can change the default timeframes from the setting.
As we are dealing with many relations, we can define the relationship with a simple score to get the trend strength.
Ichimoku Analysis:
Relationship of Price(P) with Ichimoku indicators: Here we are analyzing the current price and Ichimoku indicators. The position of price with respect to Ichimoku indicators states the market condition clearly.
Price(P) and Kumo(C): P > C = Bullish (↑). P < C = Bearish (↓). P <> C = consolidation or no trend(↔). Score: ±2
Price(P) and Tenkan Sen(T): P >= T = Bullish (↑). P < T = Bearish (↓). Score: ±0.5
Price(P) and Kijun Sen(K): P >= K = Bullish (↑). P < T = Bearish (↓). Score: ±0.5
Price(26 bars ago) and Chiku(L): L >= P(26) = Bullish (↑). L < P(26) = Bearish (↓). Score: ±0.5
Tenkan Sen and Kijun Sen Relation. Tenkan Sen depicts short-term trends and Kijun depicts mid-term trends. So this relationship is important for analyzing the current trend of the market.
Tenkan Sen(T) and Kijun Sen(K): T >= K = Bullish (↑). T < K = Bearish (↓). Score: ±2
Direction of Ichimoku indicators.
The direction of Ichimoku indicators helps us to understand the trend strength.
Tenkan Sen's(T) direction: Upward slope = Bullish (↑). Downward slope = Bearish (↓). Flat=consolidation or no trend(↔). Score: ±0.5
Kijun Sen's(K) direction: Upward slope = Bullish (↑). Downward slope = Bearish (↓). Flat=consolidation or no trend(↔). Score: ±0.5
Senkou A(A) direction: Upward slope = Bullish (↑). Downward slope = Bearish (↓). Flat=consolidation or no trend(↔). Score: ±0.5
Senkou B(A) direction: Upward slope = Bullish (↑). Downward slope = Bearish (↓). Flat=consolidation or no trend(↔). Score: ±0.5
Cloud and other Ichimoku indicators:
Kumo or Cloud is very important in the Ichimoku system. Analyzing its relation with other indicators is important to detect the overall market condition.
Kumo(C) and Tenkan Sen(T): T >= C = Bullish (↑). T < C = Bearish (↓). T <> C = consolidation or no trend(↔). Score: ±0.5
Kumo(C) and Kijun Sen(K): K >= C = Bullish (↑). K < C = Bearish (↓). K <> C = consolidation or no trend(↔). Score: ±0.5
Kumo(C) and Chiku(L): L >= C = Bullish (↑). L < C = Bearish (↓). L <> C = consolidation or no trend(↔). Score: ±0.5
Kumo(C) Shadow: By analyzing the last 252 bars(you can change this option) we are analyzing the Kumo shadow behind the current price. If Kumo shadow is present behind the price, trend strength will be weakened. Score: ±0.5
Kumo(C) Future (Senkou A(A) and Senkou B(B)): A >= B = Bullish (↑). A < B = Bearish (↓). Score: ±0.5
Chiku(L) Analysis:
Vertical and Horizontal Chiku analysis will tell us about the possible consolidation of the price.
Chiku Vertical: if the price consolidates for the next 5 bars(You can change this option) will it run into the price. Please remember we are placing the current price 26 bars ago and we are interested to see the current price in open space for a clear trend. Score: ±0.5
Chikou Horizontal: If Chiku is in open space (Not running into the price), we want to review Chiku vertically i.e how much percentage of fall or rise of the current price can cause Chiku to run into the price.
So, the maximum trend score is ±10.5.
Ichimoku signals:
We know, that the crossover of Ichimoku indicators provides important signals. In this section, you can see all the crossover i.e when they happened (Bars ago)
Distance between price and Tenkan Sen and Kijun Sen: We know, the price come back to Tenkan/Kijun if it goes far away from Tenkan/Kijun. So it is important to note the distance between Tenkan and Price.
Please note that this indicator is not a strategy or buy/sell signal. It just shows you the picture of Ichimoku in multiple timeframes. I am working on some strategies of Ichimoku and will publish the same when my research is complete.
If you want to analyze Ichimoku in a single timeframe, please review the following indicator.
To maintain the table size you can use the shorthand notation from the setting.
Table with detailed analysis:
Table with shorthand notation:
Please comment if you want any clarification or found any bugs to report.
SuperJump QQE MOD MTFThis is a QQE MOD MTF version.
Mihkel00 modified Glaz's script, I modified Mihkel00 's script again.
This is a QQE Mod original version by Mihkel00 :
I simply changed the above script to update pine script 5.0 and extracted two functions.
Thank you to the two authors for sharing such a great script.
ORB Parabolic SAR Multi Time Frame (PSAR MTF)
This is an adaptation of the inbuilt PSAR function in a Multi Time Frame .
When MTF enabled It will plot two timeframe simultaneously as follows:-
1 Min with 5 Min (HTF)
5 Min with 15 Min(HTF)
15 Min with 1H(HTF)
1H with 4H(HTF)
4H with Daily(HTF)
Daily with Weekly(HTF)
Weekly with Monthly(HTF)
The higher timeframe(HTF) will get plotted in bigger circled lines.
By enabling plotting of all levels, you can see all current levels of all TF( M1 ,M5,M15,H,4H,D,W,M) on the same screen as "X" on the right side.
Alerts allow you to get alerts when these crossover happens.
MTF Bull Power Bear Power(Elder Ray Indicator)■Overview
This indicator enables to select an upper timeframe’s Bull Power Bear Power(aka Elder Ray Indicator) (MTF) and the one of chart’s timeframe simultaneously by which users can always analyze looking at upper timeframe situation.
Also, it displays signals when bull power bear power cross zero line with an ability to set alerts.
■Formula
The indicator calculates bull power and bear power following the original Elder Ray indicator as follows.
1.Bull Power : High - EMA(13)
2.Bear Power : Low - EMA(13)
3.Bull Power Bear Power : 1 + 2
※MTF is same as above
※MA period can be changed
※High/Low is highs/lows of a chart timeframe that users are opening unless you show MTF.
See the link below for the details.
www.investopedia.com
To enable MTF, users can select “Auto” mode and “Manual” mode. When “Auto” selected, upper timeframes are determined based on the chart’s timeframes that users are currently opening as follows.
Chart timeframes -> upper timeframes
Weekly -> Monthly
Daily -> Weekly
4hour -> Daily
1hour -> 4hour
30min -> 4hour
15min -> 1hour
5min -> 1hour
1min -> 15min
■Signals
When bull power bear power cross zero line, signals can be displayed. These can be used to analyze reversal of buying/selling power.
Alerts can be set with the same condition.
——————————————
エルダー·レイ·インジケーターとしても知られるブルパワー·ベアパワーのMTFバージョンインジケーターです。
一つの上位足のブルパワー·ベアパワーとチャートのタイムフレームのブルパワー·ベアパワーの両方を同時に表示することができるため、常に上位足の状況を鑑みながら分析することができます。
また、それぞれのブルパワー·ベアパワーとゼロラインとの交差でシグナル表示、アラート設定が可能です。
■計算式
ブルパワー·ベアパワーの計算式は以下の通りです。
オリジナルのエルダー·レイ·インジケーターと同じくEMAと高値·安値を用いて計算しています。
1.ブルパワー: 高値 - EMA(13)
2.ベアパワー: 安値 - EMA(13)
3.ブルパワー·ベアパワー = 1 + 2
※MTFも上記に同じ
※MAの期間は変更可能
※高値·安値は現在開いているチャートの高値·安値です。(MTFは指定したタイムフレームの高値・安値)
ブルパワー·ベアパワーの詳細は以下のリンクを参照してください。
www.investopedia.com
MTFのブルパワー·ベアパワーを表示するにあたっては、”Auto”モードと”Manual”モードの二つから選択することができます。
“Auto”モード選択時は、現在開いているチャートのタイムフレームに基づき、上位足のタイムフレームが下記の通りに自動的に決定されます。
チャートタイムフレーム -> 上位足タイムフレーム
週足 -> 月足
日足 -> 週足
4時間足 -> 日足
1時間足 -> 4時間足
30分足 -> 4時間足
15分足 -> 1時間足
5分足 -> 1時間足
1分足 -> 15分足
■シグナル
ブルパワー·ベアパワーとゼロラインとの交差でシグナルを表示します。
売り買いの強弱反転ポイントの目安として使ってください。
同じ条件でアラート設定も可能です。
bytimeLibrary "bytime"
TODO: to do something at the specified time.
////Return =>> ht = hour , mt = minute , st = second ,Dt = Day, Mt = month, Yt = year , dateTime = full time format./////////////
Note : Remember to always add import when you call our library and change Gtime() to Timeset.Gtime() is used to access internal data.
import hapharmonic/bytime/1 as Timeset
=Timeset.Gtime()
/////////////Set a time to trigger an alert./////////////
ck = false
///hour : minute : second
if ht == TH and mt == TM and st == TS
//some action
//...
//.
ck := true
Gtime()
Strat Radar_vtStrat Radar is a visual tool to trade "TheStrat" methodology.
TheStrat is a simple yet powerful model to view the market. From one bar to the next, there are only three possible scenarios or three types of candles:
type 1 - an inside bar. Market is in consolidation.
type 2 - a directional bar (2 up or 2 down). Market is trending.
type 3 - an outside bar. This is a broadening formation and market is taking liquidity from both upside and downside.
So by looking at candle type and combination, one can visualize what price is doing in the market.
Strat Radar makes it possible for user to see candle type and sequence for all major time frames – from a 5m bar to a yearly bar - all in one chart! And even better, it allows user to see not just one bar but last three bars!
Certain candle combination creates high probability trade setups, for example 2-1-2 or 2-2 reversals, so by looking at Strat Radar, user can quickly determine whether there are any good trading opportunities. The simple and visual layout makes it easy to go through a watch list and use Strat Radar as a scanner. There is no need to flip through multiple time frame charts.
Features:
Show candle type and color for twelve time frames from 5m to yearly bar
Show candle type and color for last three bars of each time frame
Location of candle number and candle color have specific meaning:
For non-directional bars ( 1 and 3):
Below candle means close > open
Above candle means close < open
For directional bar 2:
Below candle means: 2 up
Above candle means: 2 down
Candle color: green - close>open, red – close < open
A built-in trend strength system that can be turned on or off
A reversal marker that can be turned on or off. It is based on a combination of Strat candle sequence and trend strength
Since candle type and combination are clearly shown for each time frame, it is easy to determine whether is Full Time Frame Continuity (FTFC).
Strat Radar_vt is a light version of the full indicator and covers:
- most futures market
- 30 stocks in Dow Index
- Index and sector ETFs : SPY , QQQ , DIA, IWM , XLE , XLF , XLU , GDX , XLK , XLV , XLY , XLB , ITB , XRT , SMH , IBB , KRE , XLC , GDXJ , KBE
- Some key stocks: AAPL , AMZN , FB , GOOGL , TSLA , NVDA , NFLX
- Forex pairs: DXY , AUDCAD , AUDJPY , AUDNZD , AUDUSD , EURCAD , EURGBP , EURJPY , EURUSD , GBPJPY , GBPUSD , NZDUSD , USDCAD , USDJPY
Full version works on all stocks and assets. If you like this indicator and require the full version, please contact the author.
Pivots libraryLibrary "Pivots"
TODO: add library description here
pivots(_type, _open, _high, _low, _clsoe) Calculates the pivot point and returns its value.
Parameters:
_type : Specifies the type of pivot point.
_open : The open price
_high : The high price
_low : The low price
_clsoe : The close price
Returns: Returns the value of the calculated pivot point as a tuple.
cpr(_high, _low, _clsoe) Calculate the Central Pivot Range
Parameters:
_high : The high price
_low : The low price
_clsoe : The close price
Returns: Returns the values as a tuple.
htf_ohlc(_htf) Calculate the HTF values
Parameters:
_htf : Resolution
Returns: Returns the values as a tuple.