Buy on 5 day low Strategy█ STRATEGY DESCRIPTION
The "Buy on 5 Day Low Strategy" is a mean-reversion strategy designed to identify potential buying opportunities when the price drops below the lowest low of the previous five days. It enters a long position when specific conditions are met and exits when the price exceeds the high of the previous day. This strategy is optimized for use on daily or higher timeframes.
█ WHAT IS THE 5-DAY LOW?
The 5-Day Low is the lowest price observed over the last five days. This level is used as a reference to identify potential oversold conditions and reversal points.
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
The close price is below the lowest low of the previous five days (`close < _lowest `).
The signal occurs within the specified time window (between `Start Time` and `End Time`).
2. EXIT CONDITION
A Sell Signal is generated when the current closing price exceeds the high of the previous day (`close > high `). This indicates that the price has shown strength, potentially confirming the reversal and prompting the strategy to exit the position.
█ ADDITIONAL SETTINGS
Start Time and End Time: The time window during which the strategy is allowed to execute trades.
█ PERFORMANCE OVERVIEW
This strategy is designed for mean-reverting markets and performs best when the price frequently oscillates around key support levels.
It is sensitive to oversold conditions, as indicated by the 5-Day Low, and overbought conditions, as indicated by the previous day's high.
Backtesting results should be analyzed to optimize the strategy for specific instruments and market conditions.
Endeks
3-Bar Low Strategy█ STRATEGY DESCRIPTION
The "3-Bar Low Strategy" is a mean-reversion strategy designed to identify potential buying opportunities when the price drops below the lowest low of the previous three bars. It enters a long position when specific conditions are met and exits when the price exceeds the highest high of the previous seven bars. This strategy is suitable for use on various timeframes.
█ WHAT IS THE 3-BAR LOW?
The 3-Bar Low is the lowest price observed over the last three bars. This level is used as a reference to identify potential oversold conditions and reversal points.
█ WHAT IS THE 7-BAR HIGH?
The 7-Bar High is the highest price observed over the last seven bars. This level is used as a reference to identify potential overbought conditions and exit points.
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
The close price is below the lowest low of the previous three bars (`close < _lowest `).
The signal occurs within the specified time window (between `Start Time` and `End Time`).
If the EMA Filter is enabled, the close price must also be above the 200-period Exponential Moving Average (EMA).
2. EXIT CONDITION
A Sell Signal is generated when the current closing price exceeds the highest high of the previous seven bars (`close > _highest `). This indicates that the price has shown strength, potentially confirming the reversal and prompting the strategy to exit the position.
█ ADDITIONAL SETTINGS
MA Period: The lookback period for the 200-period EMA used in the EMA Filter. Default is 200.
Use EMA Filter: Enables or disables the EMA Filter for long entries. Default is disabled.
Start Time and End Time: The time window during which the strategy is allowed to execute trades.
█ PERFORMANCE OVERVIEW
This strategy is designed for mean-reverting markets and performs best when the price frequently oscillates around key support and resistance levels.
It is sensitive to oversold conditions, as indicated by the 3-Bar Low, and overbought conditions, as indicated by the 7-Bar High.
Backtesting results should be analyzed to optimize the MA Period and EMA Filter settings for specific instruments.
Bollinger Bands Reversal + IBS Strategy█ STRATEGY DESCRIPTION
The "Bollinger Bands Reversal Strategy" is a mean-reversion strategy designed to identify potential buying opportunities when the price deviates below the lower Bollinger Band and the Internal Bar Strength (IBS) indicates oversold conditions. It enters a long position when specific conditions are met and exits when the IBS indicates overbought conditions. This strategy is suitable for use on various timeframes.
█ WHAT ARE BOLLINGER BANDS?
Bollinger Bands consist of three lines:
- **Basis**: A Simple Moving Average (SMA) of the price over a specified period.
- **Upper Band**: The basis plus a multiple of the standard deviation of the price.
- **Lower Band**: The basis minus a multiple of the standard deviation of the price.
Bollinger Bands help identify periods of high volatility and potential reversal points.
█ WHAT IS INTERNAL BAR STRENGTH (IBS)?
Internal Bar Strength (IBS) is a measure of where the closing price is relative to the high and low of the bar. It is calculated as:
IBS = (Close - Low) / (High - Low)
A low IBS value (e.g., below 0.2) indicates that the close is near the low of the bar, suggesting oversold conditions. A high IBS value (e.g., above 0.8) indicates that the close is near the high of the bar, suggesting overbought conditions.
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
The IBS value is below 0.2, indicating oversold conditions.
The close price is below the lower Bollinger Band.
The signal occurs within the specified time window (between `Start Time` and `End Time`).
2. EXIT CONDITION
A Sell Signal is generated when the IBS value exceeds 0.8, indicating overbought conditions. This prompts the strategy to exit the position.
█ ADDITIONAL SETTINGS
Length: The lookback period for calculating the Bollinger Bands. Default is 20.
Multiplier: The number of standard deviations used to calculate the upper and lower Bollinger Bands. Default is 2.0.
Start Time and End Time: The time window during which the strategy is allowed to execute trades.
█ PERFORMANCE OVERVIEW
This strategy is designed for mean-reverting markets and performs best when the price frequently deviates from the Bollinger Bands.
It is sensitive to oversold and overbought conditions, as indicated by the IBS, which helps to identify potential reversals.
Backtesting results should be analyzed to optimize the Length and Multiplier parameters for specific instruments.
Average High-Low Range + IBS Reversal Strategy█ STRATEGY DESCRIPTION
The "Average High-Low Range + IBS Reversal Strategy" is a mean-reversion strategy designed to identify potential buying opportunities when the price deviates significantly from its average high-low range and the Internal Bar Strength (IBS) indicates oversold conditions. It enters a long position when specific conditions are met and exits when the price shows strength by exceeding the previous bar's high. This strategy is suitable for use on various timeframes.
█ WHAT IS THE AVERAGE HIGH-LOW RANGE?
The Average High-Low Range is calculated as the Simple Moving Average (SMA) of the difference between the high and low prices over a specified period. It helps identify periods of increased volatility and potential reversal points.
█ WHAT IS INTERNAL BAR STRENGTH (IBS)?
Internal Bar Strength (IBS) is a measure of where the closing price is relative to the high and low of the bar. It is calculated as:
IBS = (Close - Low) / (High - Low)
A low IBS value (e.g., below 0.2) indicates that the close is near the low of the bar, suggesting oversold conditions.
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
The close price has been below the buy threshold (calculated as `upper - (2.5 * hl_avg)`) for a specified number of consecutive bars (`bars_below_threshold`).
The IBS value is below the specified buy threshold (`ibs_buy_treshold`).
The signal occurs within the specified time window (between `Start Time` and `End Time`).
2. EXIT CONDITION
A Sell Signal is generated when the current closing price exceeds the high of the previous bar (`close > high `). This indicates that the price has shown strength, potentially confirming the reversal and prompting the strategy to exit the position.
█ ADDITIONAL SETTINGS
Length: The lookback period for calculating the average high-low range. Default is 20.
Bars Below Threshold: The number of consecutive bars the price must remain below the buy threshold to trigger a Buy Signal. Default is 2.
IBS Buy Threshold: The IBS value below which a Buy Signal is triggered. Default is 0.2.
Start Time and End Time: The time window during which the strategy is allowed to execute trades.
█ PERFORMANCE OVERVIEW
This strategy is designed for mean-reverting markets and performs best when the price frequently deviates from its average high-low range.
It is sensitive to oversold conditions, as indicated by the IBS, which helps to identify potential reversals.
Backtesting results should be analyzed to optimize the Length, Bars Below Threshold, and IBS Buy Threshold parameters for specific instruments.
Turn of the Month Strategy on Steroids█ STRATEGY DESCRIPTION
The "Turn of the Month Strategy on Steroids" is a seasonal mean-reversion strategy designed to capitalize on price movements around the end of the month. It enters a long position when specific conditions are met and exits when the Relative Strength Index (RSI) indicates overbought conditions. This strategy is optimized for use on daily or higher timeframes.
█ WHAT IS THE TURN OF THE MONTH EFFECT?
The Turn of the Month effect refers to the observed tendency of stock prices to rise around the end of the month. This strategy leverages this phenomenon by entering long positions when the price shows signs of a reversal during this period.
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
The current day of the month is greater than or equal to the specified `dayOfMonth` threshold (default is 25).
The close price is lower than the previous day's close (`close < close `).
The previous day's close is also lower than the close two days ago (`close < close `).
The signal occurs within the specified time window (between `Start Time` and `End Time`).
There is no existing open position (`strategy.position_size == 0`).
2. EXIT CONDITION
A Sell Signal is generated when the 2-period RSI exceeds 65, indicating overbought conditions. This prompts the strategy to exit the position.
█ ADDITIONAL SETTINGS
Day of Month: The day of the month threshold for triggering a Buy Signal. Default is 25.
Start Time and End Time: The time window during which the strategy is allowed to execute trades.
█ PERFORMANCE OVERVIEW
This strategy is designed to exploit seasonal price patterns around the end of the month.
It performs best in markets where the Turn of the Month effect is pronounced.
Backtesting results should be analyzed to optimize the `dayOfMonth` threshold and RSI parameters for specific instruments.
Consecutive Bars Above/Below EMA Buy the Dip Strategy█ STRATEGY DESCRIPTION
The "Consecutive Bars Above/Below EMA Buy the Dip Strategy" is a mean-reversion strategy designed to identify potential buying opportunities when the price dips below a moving average for a specified number of consecutive bars. It enters a long position when the dip condition is met and exits when the price shows strength by exceeding the previous bar's high. This strategy is suitable for use on various timeframes.
█ WHAT IS THE MOVING AVERAGE?
The strategy uses either a Simple Moving Average (SMA) or an Exponential Moving Average (EMA) as a reference for identifying dips. The type and length of the moving average can be customized in the settings.
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
The close price is below the selected moving average for a specified number of consecutive bars (`consecutiveBarsTreshold`).
The signal occurs within the specified time window (between `Start Time` and `End Time`).
2. EXIT CONDITION
A Sell Signal is generated when the current closing price exceeds the high of the previous bar (`close > high `). This indicates that the price has shown strength, potentially confirming the reversal and prompting the strategy to exit the position.
█ ADDITIONAL SETTINGS
Consecutive Bars Threshold: The number of consecutive bars the price must remain below the moving average to trigger a Buy Signal. Default is 3.
MA Type: The type of moving average used (SMA or EMA). Default is SMA.
MA Length: The length of the moving average. Default is 5.
Start Time and End Time: The time window during which the strategy is allowed to execute trades.
█ PERFORMANCE OVERVIEW
This strategy is designed for mean-reverting markets and performs best when the price frequently oscillates around the moving average.
It is sensitive to the number of consecutive bars below the moving average, which helps to identify potential dips.
Backtesting results should be analysed to optimize the Consecutive Bars Threshold, MA Type, and MA Length for specific instruments.
DMI Strategy█ STRATEGY DESCRIPTION
The "DMI Strategy" is a trend-following strategy that uses the Directional Movement Index (DMI) and a 200-period Exponential Moving Average (EMA) to identify potential long entries. It enters a long position when specific conditions are met and exits when the Relative Strength Index (RSI) indicates overbought conditions. This strategy is designed for use on daily or higher timeframes.
█ WHAT IS THE DMI?
The Directional Movement Index (DMI) consists of three components:
- **DI+ (Plus Directional Indicator)**: Measures upward trend strength.
- **DI- (Minus Directional Indicator)**: Measures downward trend strength.
- **ADX (Average Directional Index)**: Measures overall trend strength, regardless of direction.
In this strategy, only the DI+ and DI- components are used to identify potential entry signals.
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
The DI+ value is less than 5, indicating weak upward momentum.
The close price is above the 200-period EMA, confirming a bullish trend.
The signal occurs within the specified time window (between `Start Time` and `End Time`).
2. EXIT CONDITION
A Sell Signal is generated when the 2-period RSI exceeds 65, indicating overbought conditions. This prompts the strategy to exit the position.
█ ADDITIONAL SETTINGS
DI Length: The lookback period for calculating the DMI components. Default is 3.
Start Time and End Time: The time window during which the strategy is allowed to execute trades.
█ PERFORMANCE OVERVIEW
This strategy is designed for trending markets and performs best when the price is above the 200-period EMA.
It is sensitive to overbought conditions, as indicated by the RSI, which helps to lock in profits.
Backtesting results should be analysed to optimize the DI Length and RSI parameters for specific instruments.
Turn around Tuesday on Steroids Strategy█ STRATEGY DESCRIPTION
The "Turn around Tuesday on Steroids Strategy" is a mean-reversion strategy designed to identify potential price reversals at the start of the trading week. It enters a long position when specific conditions are met and exits when the price shows strength by exceeding the previous bar's high. This strategy is optimized for ETFs, stocks, and other instruments on the daily timeframe.
█ WHAT IS THE STARTING DAY?
The Starting Day determines the first day of the trading week for the strategy. It can be set to either Sunday or Monday, depending on the instrument being traded. For ETFs and stocks, Monday is recommended. For other instruments, Sunday is recommended.
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
The current day is the first day of the trading week (either Sunday or Monday, depending on the Starting Day setting).
The close price is lower than the previous day's close (`close < close `).
The previous day's close is also lower than the close two days ago (`close < close `).
The signal occurs within the specified time window (between `Start Time` and `End Time`).
If the MA Filter is enabled, the close price must also be above the 200-period Simple Moving Average (SMA).
2. EXIT CONDITION
A Sell Signal is generated when the current closing price exceeds the high of the previous bar (`close > high `). This indicates that the price has shown strength, potentially confirming the reversal and prompting the strategy to exit the position.
█ ADDITIONAL SETTINGS
Starting Day: Determines the first day of the trading week. Options are Sunday or Monday. Default is Sunday.
Use MA Filter: Enables or disables the 200-period SMA filter for long entries. Default is disabled.
Start Time and End Time: The time window during which the strategy is allowed to execute trades.
█ PERFORMANCE OVERVIEW
This strategy is designed for markets with frequent weekly reversals.
It performs best in volatile conditions where price movements are significant at the start of the trading week.
Backtesting results should be analysed to optimize the Starting Day and MA Filter settings for specific instruments.
Consecutive Bearish Candle Strategy█ STRATEGY DESCRIPTION
The "Consecutive Bearish Candle Strategy" is a momentum-based strategy designed to identify potential reversals after a sustained bearish move. It enters a long position when a specific number of consecutive bearish candles occur and exits when the price shows strength by exceeding the previous bar's high. This strategy is optimized for use on various timeframes and instruments.
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
The close price has been lower than the previous close for at least `Lookback` consecutive bars. This indicates a sustained bearish move, suggesting a potential reversal.
The signal occurs within the specified time window (between `Start Time` and `End Time`).
2. EXIT CONDITION
A Sell Signal is generated when the current closing price exceeds the high of the previous bar (`close > high `). This indicates that the price has shown strength, potentially confirming the reversal and prompting the strategy to exit the position.
█ ADDITIONAL SETTINGS
Lookback: The number of consecutive bearish bars required to trigger a Buy Signal. Default is 3.
Start Time and End Time: The time window during which the strategy is allowed to execute trades.
█ PERFORMANCE OVERVIEW
This strategy is designed for markets with frequent momentum shifts.
It performs best in volatile conditions where price movements are significant.
Backtesting results should be analysed to optimize the `Lookback` parameter for specific instruments.
4 Bar Momentum Reversal strategy█ STRATEGY DESCRIPTION
The "4 Bar Momentum Reversal Strategy" is a mean-reversion strategy designed to identify price reversals following a sustained downward move. It enters a long position when a reversal condition is met and exits when the price shows strength by exceeding the previous bar's high. This strategy is optimized for indices and stocks on the daily timeframe.
█ WHAT IS THE REFERENCE CLOSE?
The Reference Close is the closing price from X bars ago, where X is determined by the Lookback period. Think of it as a moving benchmark that helps the strategy assess whether prices are trending upwards or downwards relative to past performance. For example, if the Lookback is set to 4, the Reference Close is the closing price 4 bars ago (`close `).
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
The close price has been lower than the Reference Close for at least `Buy Threshold` consecutive bars. This indicates a sustained downward move, suggesting a potential reversal.
The signal occurs within the specified time window (between `Start Time` and `End Time`).
2. EXIT CONDITION
A Sell Signal is generated when the current closing price exceeds the high of the previous bar (`close > high `). This indicates that the price has shown strength, potentially confirming the reversal and prompting the strategy to exit the position.
█ ADDITIONAL SETTINGS
Buy Threshold: The number of consecutive bearish bars needed to trigger a Buy Signal. Default is 4.
Lookback: The number of bars ago used to calculate the Reference Close. Default is 4.
Start Time and End Time: The time window during which the strategy is allowed to execute trades.
█ PERFORMANCE OVERVIEW
This strategy is designed for trending markets with frequent reversals.
It performs best in volatile conditions where price movements are significant.
Backtesting results should be analysed to optimize the Buy Threshold and Lookback parameters for specific instruments.
Market MonitorOverview
The Market Monitor Indicator provides a customisable view of dynamic percentage changes across selected indices or sectors, calculated by comparing current and previous closing prices over the chosen timeframe.
Key Features
Choose up to 20 predefined indices or your own selected indices/stocks.
Use checkboxes to show or hide individual entries.
Monitor returns over daily, weekly, monthly, quarterly, half-yearly, or yearly timeframes
Sort by returns (descending) to quickly identify top-performing indices or alphabetically for an organised and systematic review.
Customisation
Switch between Light Mode (Blue or Green themes) and Dark Mode for visual clarity.
Adjust the table’s size, position, and location.
Customise the table title to your own choice e.g. Sectoral, Broad, Portfolio etc.
Use Cases
Use multiple instances of the script with varying timeframes to study sectoral rotation and trends.
Customise the stocks to see your portfolio returns for the day or over the past week, or longer.
Sessioned EMA - Frozen EMA in post market hoursWhy I develop this indicator?
In future indices, post market data with little volume distort the moving average seriously. This indicator is to eliminate the distortion of data during low volume post market hours.
How to use?
There is a time session setting in the indicator, you can set the cash hour time, moving average outside the session will be frozen.
What this indicator gives you
This indicator give you a more make sense ema pattern, the ema lines are more respected by the prices when you set the session properly.
Setup
1. Session setting
In US indices, such as NQ, ES etc, when there was data release at 0830 hr, huge volume transaction order appears, that makes the 0830 price data important that should be included in your ema trend line calculating. If that is the case, I will set the session begin from 0830, otherwise, I start the session at 0930. Golden rule : Price with huge volume counts.
2. Time zone
The coding is decided for GMT+8 time zone, you may amend the code to fit your timezone.
Percent of U.S. Stocks Above VWAPThis indicator plots a line reflecting the percentage of all U.S. stocks above or below their VWAP for the given candle. Horizontal lines have been placed at 40% (oversold), 50% (mid-line), and 60% (overbought). I recommend using this indicator as a market breadth indicator when trading individual stocks. In my experience, this indicator is best utilized while trading the major indices (SPX, SPY, QQQ, IWM) or their futures (ES, NQ, RTY) in the following manner:
- When the line crosses 50%, a green or red triangle is plotted indicating the majority of market momentum has turned bullish or bearish based on price positioning vs. VWAP. Look for longs when the line is rising (green) or above 50%, or shorts when the line is falling (red) or below 50%.
- When the line is below 40%, indicator shows red shading; I would not be long anything during this period. When the line exits this level, I begin looking for long entries. This line is adjustable in the indicator settings if you prefer to use a tighter or looser oversold level.
- When the line is above 60%, indicator shows green shading; I would not be short anything during this period. When the line exits this level, I begin looking for short entries. This line is adjustable in the indicator settings if you prefer to use a tighter or looser overbought level.
This indicator uses the TradingView ticker “PCTABOVEVWAP.US”, thus it only updates during NY market hours. If trading futures, I recommend applying VWAP to your chart and using that as the level to trade against in a similar manner, along with your personal price action analysis and other indicators you find useful.
5 Minute TF 200 EMA Retest by Grantwww.tradingview.com
This indicator is a simple script meant to find retests on the 200 period moving average. It's current state is optimized for the 5 minute timeframe.
This works in all markets and all timeframes as long as you adjust certain rules for higher timeframes.
It's strengths and weaknesses
- Good at trend continuation in strong markets
- Bad in ranging markets (not surprising)
How does it work?
- It first identifies an overall trend by using the 200 ema.
- For long positions, it waits for price to close below the 200 ema, and then shortly closing back above the ema. For short positions its the opposite.
- For lower timeframes there are some other factors that help filter out bad signals that include:
- Makes sure that volume is increasing.
- Makes sure that volume is higher than average volume.
- For higher timeframes, the more specific factors aren't required.
How to use this indicator:
- Green triangles mean long positions
- Red triangles mean short positions
- Always trade with stoplosses and never risk too much of your account, please practice proper risk managment.
DISCLAIMER: Trading is inherently dangerous and carries lot's of risk. What you decide to do with my script has nothing to do with me. I am not responsible for any financial gains or losses made using this script. It is important to recognize other factors in the market to make better decisions.
Sort array alphabetically - educational🔶 OVERVIEW
• This educational script will sort an array of tickers alphabetically and place these values in an table , together with the according current price value next to each ticker .
🔶 SORT ALPHABETICALLY
🔹 I. We make a User Defined Type (UDT) obj , with:
· ticker - the string name of the ticker
· price - the current price (close)
• From this UDT we make an object obj.new() for each ticker
🔹 II. 2 array's are made:
• array of objects aObj , containing obj type obj.new() for every ticker
• array of strings sort , the ticker part of each object obj.new()
🔹 III. Now we make an object of each ticker with the createObject(sym ) function
object_1 = createObject("TICKER")
• the object object_1 consists off:
· ticker -> "TICKER"
· price -> current Daily close through request.security("TICKER") (non-repainting)
• object_1 will be added to the aObj array
• "TICKER" ( string ticker part of object ) will be added to the sort array
🔹 IV. The latter array is sorted alphabetically by using array.sort_indices()
EXAMPLE
originalArray = array.from("B", "A", "C")
indicesArray = // sorted indices
array.get(originalArray, 1) -> "A"
array.get(originalArray, 0) -> "B"
array.get(originalArray, 2) -> "C"
IMPORTANT
Alphabetically sorting is case sensitive , just like Java compareTo(String anotherString) !
• The comparison is based on the Unicode value of each character in the string, the lowest "Dec" values are sorted first in line.
• Comparing the "Dec" values at unicodelookup explains why default CAPITAL lettres will be sorted first,
• Default you would get this (A= 65, B= 66, a= 97, b= 98)
Aa
Ba
ab
bb
• Adding str.lower(string) in the toLowerCase() function will result to the following:
Aa
ab
Ba
bb
• (A= 65 is transformed to a= 97, ...)
• As a side note, should you write "AMZN" as "ÀMZN" this would be placed at the end, even after transforming to lower case the "Dec" values are higher (À= 192, à= 224).
• You can toggle "To Lower Case" to verify.
🔹 V. Values are placed in a table , using these sorted indices.
• With the usage of UDTs and objects , the current price has the same index in the aObj as their ticker ,
giving the advantage it is fairly easy to place every value correctly next to each other.
• The same can be done by make 2 separate arrays , 1 for the current price , the other for "TICKER" .
🔶 OTHER TECHNIQUES USED
• Alternative technique for adding comment
Instead of
// this is a comment
You can also do this:
_=" this is a comment "
• Alternate colour
· During a loop , alternate colour when i is even or odd , using the modulo operation (%) .
· This is the remainder when dividing.
EXAMPLE
· 3 % 2 = 1 -> 3 / 2 -> 1 * 2, 1 left (remainder)
· 4 % 2 = 0 -> 4 / 2 -> 2 * 2, 0 left (remainder)
· 5 % 2 = 1 -> 5 / 2 -> 2 * 2, 1 left (remainder)
for i = 0 to 10
even = i % 2 == 0
col = even ? thisColor : otherColor
• Adjust colour in script by using colour picker
Cheers!
Fiat Currency and Gold Indices (FGXY) CandlesA modification of my previous indicator "Crypto Index (DXY) Candles". The idea was to create a similar currency basket to the standard DXY, but from the perspective of other currencies. Still using the standard DXY weights, this indicator allows you to create a tailored index for other currencies, provided that a currency pair exists for each of the 6 components. This means that even currencies that aren't included should work in theory; just find the 3 character currency prefix used by tradingview and give it a shot! This indicator is useful for gauging how well countries/currencies are holding up and when paired with the standard DXY may help see potential inflection points. For use on longer time frames (~1h-~3d) as some of the data being pulled seems to have issues on lower timeframes.
Background ZonesThis script provides up to 5 zones to apply background colors. This is especially useful for applying to indices such as USI:TICK , USI:ADD , and USI:VOLD , where certain levels provides significant meaning to market sentiment and directions. This script will give you the visual cue to help with your trading.
All levels and colors are fully customizable.
Enjoy~!!
Example:
ICT KillZone [Index futures edition] Guided by new ICT Mentorship I create this versatile timezone or strikezone indicator to identify this without changing timezone (is based on America/New_York timezone, not your current timezone or GMT)
Sessions & Days Of The WeekTraders tend to focus their energy on specific sessions or time periods. This indicator will plot the days of the week, and also highlight the following sessions: Frankfurt (2:00am - 11:00am EST), London (3:00am - 12:00pm EST), New York (8:00am - 5:00pm EST), Sydney (5:00pm - 2:00am EST), Tokyo (7:00pm - 4:00am EST).
It’s important to be aware that Session Open and Close times will vary based on the time of year, as countries shift over to daylight savings time.
BANK NIFTY Constituents Technical Rating [tanayroy]Banknifty comprises 12 companies listed on the National Stock Exchange of India (NSE). Movement of Banknifty depends on these stocks. The script depicts Technical rating and price change stats of Banknifty constituents.
I have calculated the weight factor using annual floating stock stats available in Tradingview. So, it may differ considerably from the actual weight. It is just for reference.
I have found this useful in my trading.
Please like, share, and comment.
Correlation IndexShows how often and how much the underlying security deviates from the base stock.
Indices that help in the selection of securities:
Lst10 - last 10(long factor parameter) periods average
Aver - fulltime averaged
pwr - total deviation area from base
ust - unstability (drawdown index)
cor - percent of positive bars
cross - fulltime averaged deviation
Alert(), alertcondition() or strategy alerts?Variety of possibilities offered by PineScript, especially thanks to recent additions, created some confusion. Especially one question repeats quite often - which method to use to trigger alerts?
I'm posting this to clarify and give some syntax examples. I'll discuss these 3 methods in chronological order, meaning - in the order they were introduced to PineScript.
ALERTCONDITION() - it is a function call, which can be used only in study-type script. Since years ago, you could create 2 types of a script: strategy and study. First one enables creating a backtest of a strategy. Second was to develop scripts which didn't require backtesting and could trigger alerts. alertcondition() calls in strategy-type scripts were rejected by Pine compiler. On the other hand compiling study-type scripts rejected all strategy...() calls. That created difficulties, because once you had a nice and backtested strategy, you had to rip it off from all strategy...() function calls to convert your script to study-type so you could produce alerts. Maintenance of two versions of each script was necessary and it was painful.
"STRATEGY ALERTS" were introduced because of alertcondition() pains. To create strategy alert, you need to click "Add alert" button inside Strategy Tester (backtester) and only there. Alerts set-up this way are bound with the backtester - whenever backtester triggers an order, which is visible on the chart, alert is also fired. And you can customize alert message using some placeholders like {{strategy.order.contracts}} or {{ticker}}.
ALERT() was added last. This is an alerts-triggering function call, which can be run from strategy-type script. Finally it is doable! You can connect it to any event coded in PineScript and generate any alert message you want, thanks to concatenation of strings and wrapping variables into tostring() function.
Out of these three alertcondition() is obviously archaic and probably will be discontinued. There is a chance this makes strategy/study distinction not making sense anymore, so I wouldn't be surprised if "studies" are deprecated at some point.
But what are the differences between "Strategy alerts" and alert()? "Strategy alerts" seem easier to set-up with just a few clicks and probably easier to understand and verify, because they go in sync with the backtester and on-chart trade markers. It is especially important to understand how they work if you're building strategy based on pending orders (stop and limit) - events in your code might trigger placing pending order, but alert will be triggered only (and when) such order is executed.
But "Strategy Alerts" have some limitations - not every variable you'd like to include in alert message is available from PineScript. And maybe you don't need the alert fired when the trade hit a stop-loss or take-profit, because you have already forwarded info about closing conditions in entry alert to your broker/exchange.
Alert() was added to PineScript to fill all these gaps. Is allows concatenating any alert message you want, with any variable you want inside it and you can attach alert() function at any event in your PineScript code. For example - when placing orders, crossing variables, exiting trades, but not explicitly at pending orders execution.
The Verdict
"Strategy Alerts" might seem a better fit - easier to set-up and verify, flexible and they fire only when a trade really happens, not producing unnecessary mess when each pending order is placed. But these advantages are illusionary, because they don't give you the full-control which is needed when trading with real money. Especially when using pending orders. If an alert is fired when price actually hit a stop-order or limit-order level, and even if you are executing such alert within 1 second thanks to a tool like TradingConnector, you might already be late and you are making entry at a market price. Slippage will play a great role here. You need to send ordering alert when logical conditions are met - then it will be executed at the price you want. Even if you need to cancel all the pending orders which were not executed. Because of that I strongly recommend sticking to ALERT() when building your alerts system.
Below is an example strategy, showing syntax to manage placing the orders and cancelling them. Yes, this is another spin-off from my TradingView Alerts to MT4 MT5 . As usual, please don't pay attention to backtest results, as this is educational script only.
P.S. For the last time - farewell alertcondition(). You served us well.
INDICES against BTC & ETHThe idea is the following; you can easily chart the FTX perp indices against (currently) two baselines, ETH & BTC.
I always choose ETH since it is way harder to outperform ETH at the moment. Doing this helps me see certain trends and/or fractal that might happen again in the future.
Since I already made D.A.M (Defi against Majors / Pricing Defi categories against BTC & ETH: ) I came across the idea of doing the same thing but with the perp indices that FTX offer. At first, I wanted to add this to D.A.M but it has no place in this indicator since this will not only look at Defi but the macro market as a whole.
The indicator currently only looks at the following indexes (weighting can be found here: https:// help. ftx. com/hc/en-us/articles/360027668812-Index-Calculation) :
DRGN: THE DRAGON INDEX
ARPA, BTM, IOST, NEO, NULS, ONT, QTUM, TRX, VET
ALT: ALTCOIN INDEX
BCH, BNB, EOS, ETH, LTC, XRP, TRX, DOT, LINK, ADA
MID: THE MID CAP INDEX
ALGO, ATOM, BAT, CRO, DASH, DCR, DOGE, HT, IOTA, LEO, NEO, OKB, ONT, QTUM, VET, XEM, XLM, XMR, XTZ, ZEC, ZRX, OMG, COMP, BSV, FTT, YFI, UNI, SNX, MKR, AAVE
SHIT: THE SHITCOIN INDEX
AE, AION, ARDR, ARPA, BCD, BEAM, BTG, BTM, BTS, BTT, CHZ, CKB, DGB, ELF, ENJ, GNT, GRIN, GT, HBAR, HC, ICX, IOST, KMD, KNC, LAMB, LRC, LSK, MANA, MATIC, MCO, NANO, NULS, OMG, POWR, PUNDIX, REN, REP, RVN, SC, SNT, STEEM, THETA, TOMO, VSYS, WAVES, XVG, XZC, ZEN, ZIL, ZRX
PRIV: THE PRIVACY INDEX
BEAM, DCR, GRIN, KMD, XMR, XVG, XZC, ZEC, ZEN
DEFI: THE DECENTRALIZED FINANCE INDEX
KNC, MKR, ZRX, REN, REP, SNX, COMP, TOMO, RUNE, CRV, DOT, LINK, MTA, SOL, CREAM, BAND, SRM, SUSHI, SWRV, AVAX, YFI, UNI, WNXM, AAVE, BAL