Trading Session TemplateDescription:
The Trading Session Template Indicator is a powerful script that allows traders to customize their own trading session time range on a chart. With this indicator, you have the flexibility to define specific hours during which you prefer to focus your trading activities. The example chart showcases the New York session hours, but you can easily adapt it to any desired time range based on your trading strategy and preferences.
Key Features:
Customizable Trading Session: The indicator empowers you to define your own trading session time range, tailored to your preferred market sessions or specific trading hours. This flexibility ensures that the indicator aligns with your unique trading strategy.
Highlighted Trading Session: When a new trading day begins, the script automatically scans for the specified time range. Once the first candle within the range begins printing, the background color of the chart is highlighted, indicating the beginning of the trading session. When the last candle within the range is closed, the background color returns to normal.
Focus on Specific Market Sessions: This indicator is particularly useful for traders who prefer to trade certain market sessions or specific hours during the day. By customizing the trading session, you can better align your trading activities with specific market conditions and trading opportunities.
Candle Pattern Detection: The indicator includes the ability to detect candle patterns such as Doji, Engulfing, Hammer, and Shooting Star. You can activate the desired candle patterns and set up alerts for them. When an alert is triggered, indicating the formation of a specific candle pattern, you can further analyze the market and make informed trading decisions.
ATR Filter: The indicator offers an ATR (Average True Range) filter to limit noise and focus on candle patterns with a size comparable to the ATR. You can set a minimum and maximum size for a candle compared to the ATR. This helps you filter out smaller or larger candles that may not align with your trading preferences.
Stop Loss (SL) and Take Profit (TP) Levels: When a candle pattern is detected, based on the ATR, the indicator can display suggested Stop Loss and Take Profit levels. This feature provides additional guidance for risk management and potential profit targets.
User-Friendly Interface: The indicator provides a user-friendly interface with adjustable settings and switches for customization. Tooltips are available to guide you through the various options and configurations, making it easy to adapt the indicator to your trading style and preferences.
Note:
The Trading Session Template Indicator is designed for timeframes lower than 1D. It does not plot any information on timeframes of 1D and higher.
Disclaimer:
The Trading Session Template Indicator is provided for informational and educational purposes only. Trading in the financial markets involves risk, and you should only trade with funds that you can afford to lose. The indicator's past performance is not indicative of future results. Always conduct your own research and due diligence before making any investment decisions. The creator of this indicator shall not be held responsible for any losses or damages incurred from the use of this indicator.
Educational
D-BoT Alpha 'Short' SMA and RSI StrategyDostlar selamlar,
İşte son derece basit ama etkili ve hızlı, HTF de çok iyi sonuçlar veren bir strateji daha, hepinize bol kazançlar dilerim ...
Nedir, Nasıl Çalışır:
Strateji, iki ana girdiye dayanır: SMA ve RSI. SMA hesaplama aralığı 200 olarak, RSI ise 14 olarak ayarlanmıştır. Bu değerler, kullanıcı tercihlerine veya geriye dönük test sonuçlarına göre ayarlanabilir.
Strateji, iki koşul karşılandığında bir short sinyali oluşturur: RSI değeri, belirlenen bir giriş seviyesini (burada 51 olarak belirlenmiş) aşar ve kapanış fiyatı SMA değerinin altındadır.
Strateji, kısa pozisyonu üç durumda kapatır: Kapanış fiyatı, takip eden durdurma seviyesinden (pozisyon açıldığından beri en düşük kapanış olarak belirlenmiştir) büyükse, RSI değeri belirlenen bir durdurma seviyesini (bu durumda 54) aşarsa veya RSI değeri belirli bir kar al seviyesinin (bu durumda 32) altına düşerse.
Güçlü Yönleri:
İki farklı gösterge (SMA ve RSI) kullanımı, yalnızca birini kullanmaktan daha sağlam bir sinyal sağlayabilir.
Strateji, karları korumaya ve fiyat dalgalanmalarında kayıpları sınırlamaya yardımcı olabilecek bir iz süren durdurma seviyesi içerir.
Script oldukça anlaşılır ve değiştirmesi nispeten kolaydır.
Zayıf Yönleri:
Strateji, hacim, oynaklık veya daha geniş piyasa eğilimleri gibi diğer potansiyel önemli faktörleri göz önünde bulundurmaz.
RSI seviyeleri ve SMA süresi için belirli parametreler sabittir ve tüm piyasa koşulları veya zaman aralıkları için optimal olmayabilir.
Strateji oldukça basittir. Trade maliyetini (kayma veya komisyonlar gibi) hesaba katmaz, bu da trade performansını önemli ölçüde etkileyebilir.
Bu Stratejiyle Nasıl İşlem Yapılır:
Strateji, short işlemler için tasarlanmıştır. RSI, 51'in üzerine çıktığında ve kapanış fiyatı 200 periyotluk SMA'nın altında olduğunda işleme girer. RSI, 54'ün üzerine çıktığında veya 32'nin altına düştüğünde veya fiyat, pozisyon açıldığından beri en düşük kapanış fiyatının üzerine çıktığında işlemi kapatır.
Lütfen Dikkat, bu strateji veya herhangi bir strateji izole bir şekilde kullanılmamalıdır. Tüm bu çalışmalar eğitsel amaçlıdır. Yatırım tavsiyesi içermez.
This script defines a trading strategy based on Simple Moving Average (SMA) and the Relative Strength Index (RSI) indicators. Here's an overview of how it works, along with its strengths and weaknesses, and how to trade using this strategy:
How it works:
The strategy involves two key inputs: SMA and RSI. The SMA length is set to 200, and the RSI length is set to 14. These values can be adjusted based on user preferences or back-testing results.
The strategy generates a short signal when two conditions are met: The RSI value crosses over a defined entry level (set at 51 here), and the closing price is below the SMA value.
When a short signal is generated, the strategy opens a short position.
The strategy closes the short position under three conditions: If the close price is greater than the trailing stop (which is set as the lowest close since the position opened), if the RSI value exceeds a defined stop level (54 in this case), or if the RSI value drops below a certain take-profit level (32 in this case).
Strengths:
The use of two different indicators (SMA and RSI) can provide a more robust signal than using just one.
The strategy includes a trailing stop, which can help to protect profits and limit losses as the price fluctuates.
The script is straightforward and relatively easy to understand and modify.
Weaknesses:
The strategy doesn't consider other potentially important factors, such as volume, volatility, or broader market trends.
The specific parameters for the RSI levels and SMA length are hard-coded, and may not be optimal for all market conditions or timeframes.
The strategy is very simplistic. It doesn't take into account the cost of trading (like slippage or commissions), which can significantly impact trading performance.
How to trade with this strategy:
The strategy is designed for short trades. It enters a trade when the RSI crosses above 51 and the closing price is below the 200-period SMA. It will exit the trade when the RSI goes above 54 or falls below 32, or when the price rises above the lowest closing price since the position was opened.
Please note, this strategy or any strategy should not be used in isolation. It's important to consider other aspects of trading such as risk management, capital allocation, and combining different strategies to diversify. Back-testing the strategy on historical data and demo trading before going live is also a recommended practice.
D-Bot Alpha RSI Breakout StrategyHello dear Traders,
Here is a simple yet effective strategy to use, for best profit higher time frame, such as daily.
Structure of the code
The code defines inputs for SMA (simple moving average) length, RSI (relative strength index) length, RSI entry level, RSI stop loss level, and RSI take profit level. The default values of these variables can be customized as per the user's preferences.
The script calculates SMA and RSI based on the input parameters and the closing price of the asset.
Trading logic
This strategy allows the placement of a long position when:
The RSI crosses above the RSI entry level and
The close price is above the SMA value.
After entering a long position, it applies a trailing stop mechanism. The stop price is updated to the close price if the close price is lower than the last close price.
The script closes the long position when:
RSI falls below the stop loss level.
RSI reaches or exceeds the take profit level.
If the trailing stop is activated (once RSI reaches or exceeds the take profit level), the closing price falls below the trailing stop level.
Strengths
The strategy includes mechanisms for entering a position, taking profit, and stopping losses, which are fundamental aspects of a trading strategy.
It applies a trailing stop mechanism that allows to capture further gains if the price keeps increasing while protecting from losses if the price starts to decrease.
Weaknesses
This strategy only contemplates long positions. Depending on the market situation, the strategy may miss opportunities for short selling when the market is on a downward trend.
The choice of the fixed RSI entry, stop loss, and take profit levels may not be ideal for all market conditions or assets. It might benefit from a more adaptive mechanism that adjusts these levels according to market volatility or trend.
The strategy doesn't factor in trading costs (such as spread or commission), which could have a significant impact on the net profit, especially if the user is trading with a high frequency or in a low liquidity market.
How to trade with this strategy
Given these parameters and the strategy outlined by the code, the trader would enter a long position when the RSI crosses above the RSI entry level (default 34) and the closing price is above the SMA value (SMA calculated with default period of 200). The trader would exit the position when either the RSI falls below the RSI stop loss level (default 30), or RSI rises above the RSI take profit level (default 50), or when the trailing stop is hit.
Remember "The strategies I have prepared are entirely for educational purposes and should not be considered as investment advice. Support your trades using other tools. Wishing everyone profitable trades..."
Range Deviations @joshuuuThis indicator is able to show ranges, the equlibrium (50%) and range deviations.
It has four pre-defined options and one custom version.
Asia (2000-0000) ny time
CBDR(1400-2000) ny time
Flout(1400-0000) ny time
ONS (OverNightSession)(0400-0800) chicago time
Custom (you can choose the times)
ICT (Inner Circle Traders) teaches, that those range deviations of asia,cbdr,flout can be used to find the daily high/low.
TCM (The Currency Merchant) teaches, that a move out of the range often is a false move to trap traders into the wrong direction.
Reversal Signals [LuxAlgo]The Reversal Signals indicator is a technical analysis tool that aims to identify when a trend is fading and potentially starting to reverse.
As a counter-trend tool, the Reversal Signals indicator aims to solve the problem of several technical analysis indicators that perform well during trending markets but struggle in ranging markets. By understanding the key concepts and applications of the tool, traders can enhance their market timing and improve their trading strategies.
Note: It's important to explore the settings of the indicator to customize to your own usage & display as there are various options available as covered below.
🔶 USAGE
The Reversal Signals indicator is comprised of two main phases: Momentum Phase and Trend Exhaustion Phase . These phases help identify potential trend reversals in bullish, bearish, and ranging markets.
🔹The Momentum Phase
The momentum phase consists of a 9-candle count and in rare cases 8-candle count. In a bullish trend, a starting number ‘1’ is plotted if a candle closes higher than the close of a candle four periods ago. In a bearish trend, a starting number ‘1’ is plotted if a candle closes lower than the close of a candle four periods ago.
The following numbers are plotted when each successive candle satisfies the four-period rule. The potential reversal point comes when the Reversal Signals plot a label on top of a candle in a bullish trend or at the bottom of a candle in a bearish trend. The momentum phase is immediately canceled if, at any point, a candle fails to satisfy the four-period rule.
Based on the extremes of the momentum phase, the Reversal Signals generate support & resistance levels as well as risk/stop levels.
🔹 The Trend Exhaustion Phase
The trend exhaustion phase starts after completing the momentum phase and consists of a 13-candle count. In a bullish trend exhaustion phase, each candle’s close is compared to the close of two candles earlier, and the close must be greater than the close two periods earlier. In a bearish trend exhaustion phase, each candle’s close is compared to the close of two candles earlier, and the close must be lower than the close two periods earlier.
The trend exhaustion phase does not require a consecutive sequence of candles; if the order of candles is interrupted, the trend exhaustion phase is not canceled. The trend exhaustion phase generates stronger trading signals than the momentum phase, with the potential for longer-lasting price reversals.
🔹 Trading Signals
The Reversal Signals script presents an overall setup and some phase-specific trade setup options, where probable trades might be considered. All phase-specific trade setups, presented as options, are triggered once the selected phase is completed and followed by a price flip in the direction of the trade setup.
Please note that those setups are presented for educational purposes only and do not constitutes professional and/or financial advice
- Momentum: Enter a trade at momentum phase completion, and search for buy (sell) when the bullish (bearish) momentum phase pattern is complete. Ideally, the momentum phase completion should close near its support/resistance line but shall not be above them, which indicates continuation of the trend
- Exhaustion: Enter a trade on trend exhaustion phase completion, and search for buy (sell) when the bullish (bearish) trend exhaustion phase is complete
- Qualified: Buy (sell) when a bullish (bearish) trend exhaustion phase combined with another bullish (bearish) momentum phase sequence is complete
Long trade setups are presented with "L" label and short trade setups with "S" label, where the content of the label displays details related to the probable trade opportunity
Once a phase-specific trade setup is triggered then the Reversal Signals script keeps checking the status of the price action relative to the phase-specific trade setups and in case something goes wrong presents a caution label. Pay attention to the content of the caution labels as well as where they appear. A trade signal, followed immediately by a warning indication can be assumed as a continuation of the underlying trend and can be traded in the opposite direction of the suggested signal
It is strongly advised to confirm trading setups in conjunction with other forms of technical and fundamental analysis, including technical indicators, chart/candlestick pattern analysis, etc.
🔶 DETAILS
The Reversal Signals script performs the detection of the phases by counting the candlestick meeting the specific conditions, which includes:
- Detection of the 8th and 9th candle perfection during the momentum phase
- In some cases, the 8th count will be assumed as momentum phase completion
- Trend exhaustion phase counting stops in case any type of momentum phase completion is detected during the counting process
- Postponing the last count of the trend exhaustion phase, the 13th candle must be below/above the 8th candle and if not the candles will be indicated with '+' sign under them and the script continues to search for a 13th candle at the next ones until the conditions are met
🔶 ALERTS
When an alert is configured, the user will have the ability to be notified in case;
Momentum / Trend Exhaustion phase completion
Support & Resistance level cross detection
Stop / Risk level cross detection
Long / Short Trade Setups are triggered
Please note, alerts are available with 'any alert() function call' and the alerts will be received only for the features that are enabled during alert configuration
🔶 SETTINGS
🔹 Momentum Phase
Display Phases: displays the momentum phases, where the Completed option allows the display of only completed momentum phases. The detailed option allows the display of the entire process of the momentum phase processes
Support & Resistance Levels: Toggles the visibility of the Support & Resistance Levels and Line Styling options
Momentum Phase Risk Levels: Toggles the visibility of the momentum phase Stop/Risk Levels and Line Styling options
For color options please refer to the options available under the style tab
🔹 Trend Exhaustion Phase
Display Phases: displays the trend exhaustion phases, where the Completed option allows the display of only completed trend exhaustion phases. The detailed option allows the display of the entire process of the trend exhaustion phase processes
Trend Exhaustion Phase Risk Levels: Toggles the visibility of the trend exhaustion phase Stop/Risk Levels
Trend Exhaustion Phase Target Levels: Toggles the visibility of the trend exhaustion phase Target Levels
For color options please refer to the options available under the style tab
🔹 Trade Setups
Overall Trend Direction & Trade Setup: displays the overall trend and probable trade setup levels, the users should search for a price flip and confirm with other means of technical and fundamental analysis for the trade setups once the label is plotted
Phase-Specific Trade Setup Options
Momentum: Searches for a trade setup after momentum phase completion
Exhaustion: Searches for a trade setup after trend exhaustion phase completion, stronger trend reversal possibility compared to momentum phase setup
Qualified: Searches for a trade setup after the trend exhaustion phase followed by a momentum phase completion
None: No trade setups are presented
Price Flips against the Phase Specific Trade Setups: enables checking the price action relative to the phase-specific trade setups
🔶 RELATED SCRIPTS
Here are the scripts that may add additional insight during potential trading decisions.
Buyside-Sellside-Liquidity
Support-Resistance-Classification
Position Size Calculator (EzAlgo)Upon adding the indicator to the chart, you will be prompted to place entry price lines, stop loss price line, and multiple take profit price lines by clicking at the desired price level on the chart.
Section Summaries
Table Settings: Allows users to select position and font size from drop-down menus. Displays current settings and potential profit/loss values.
Price Points: Users can set their Entry and select whether they want to include a DCA entry, Stop Loss price, Liquidation Buffer %, Take Profit levels and the amount of position to close at each level.
Risk Management: Users fill out their Account Size, set their Risk % (or fixed $ amount) for each Entry, set Manual Leverage, or allow the indicator to automatically choose the leverage based on the Stop Loss price distance from Entry and the Risk % per Entry.
User-Input Descriptions
DCA Price: The price at which users initiate their second, equally sized and leveraged position when using a Dollar-Cost Averaging (DCA) strategy. Upon reaching the DCA Price, the Entry Price adjusts to the Avg Price, calculated as the midpoint between initial and DCA entries.
Liquidation Buffer: A pre-set percentage that determines how close to the Stop Loss a position can get before it's liquidated. This assists the Auto Leverage feature in optimizing the leverage amount according to risk tolerance.
Risk per Entry: The proportion of the account, in % or a fixed dollar amount, that users are willing to risk for each trading position. If DCA is checked, this will assume users are entering with half of the total position size per entry.
Automatic Leverage: Auto Leverage automatically determines the optimal leverage level for a trade based on the user's Stop Loss price distance from the Entry point and the user-defined risk percentage per Entry. It also considers a user-defined Liquidation Buffer, which is a preset percentage determining how close to the Stop Loss a position can get before it's liquidated. This tool allows traders to optimize their leverage amount according to their risk tolerance.
Max Leverage: The highest leverage level users are willing to use, even if the exchange permits higher. This limit applies when the Auto Leverage feature is enabled.
Mechanical Trading StrategyThe "Mechanical Trading Strategy" is a simple and systematic approach to trading that aims to capture short-term price movements in the financial markets. This strategy focuses on executing trades based on specific conditions and predetermined profit targets and stop loss levels.
Key Features:
Profit Target: The strategy allows you to set a profit target as a percentage of the entry price. This target represents the desired level of profit for each trade.
Stop Loss: The strategy incorporates a stop loss level as a percentage of the entry price. This level represents the maximum acceptable loss for each trade, helping to manage risk.
Entry Condition: The strategy triggers trades at a specific time. In this case, the condition for entering a trade is based on the hour of the candle being 16 (4:00 PM). This time-based entry condition provides a systematic approach to executing trades.
Position Sizing: The strategy determines the position size based on a fixed percentage of the available equity. This approach ensures consistent risk management and allows for potential portfolio diversification.
Execution:
When the entry condition is met, signified by the hour being 16, the strategy initiates a long position using the strategy.entry function. It sets the exit conditions using the strategy.exit function, with a limit order for the take profit level and a stop order for the stop loss level.
Take Profit and Stop Loss:
The take profit level is calculated by adding a percentage of the entry price to the entry price itself. This represents the profit target for the trade. Conversely, the stop loss level is calculated by subtracting a percentage of the entry price from the entry price. This level represents the maximum acceptable loss for the trade.
By using this mechanical trading strategy, traders can establish a disciplined and systematic approach to their trading decisions. The predefined profit target and stop loss levels provide clear exit rules, helping to manage risk and potentially maximize returns. However, it is important to note that no trading strategy is guaranteed to be profitable, and careful analysis and monitoring of market conditions are always recommended.
120x ticker screener (composite tickers)In specific circumstances, it is possible to extract data, far above the 40 `request.*()` call limit for 1 single script .
The following technique uses composite tickers . Changing tickers needs to be done in the code itself as will be explained further.
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
🔶 PRINCIPLE
Standard example:
c1 = request.security('MTLUSDT' , 'D', close)
This will give the close value from 1 ticker (MTLUSDT); c1 for example is 1.153
Now let's add 2 tickers to MTLUSDT; XMRUSDT and ORNUSDT with, for example, values of 1.153 (I), 143.4 (II) and 0.8242 (III) respectively.
Just adding them up 'MTLUSDT+XMRUSDT+ORNUSDT' would give 145.3772 as a result, which is not something we can use...
Let's multiply ORNUSDT by 100 -> 14340
and multiply MTLUSDT by 1000000000 -> 1153000000 (from now, 10e8 will be used instead of 1000000000)
Then we make the sum.
When we put this in a security call (just the close value) we get:
c1 = request.security('MTLUSDT*10e8+XMRUSDT*100+ORNUSDT', 'D', close)
'MTLUSDT*10e8+XMRUSDT*100+ORNUSDT' -> 1153000000 + 14340 + 0.8242 = 1153014340.8242 (a)
This (a) will be split later on, for example:
1153014330.8242 / 10e8 = 1.1530143408242 -> round -> in this case to 1.153 (I), multiply again by 10e8 -> 1153000000.00 (b)
We subtract this from the initial number:
1153014340.8242 (a)
- 1153000000.0000 (b)
–––––––––––––––––
14340.8242 (c)
Then -> 14340.8242 / 100 = 143.408242 -> round -> 143.4 (II) -> multiply -> 14340.0000 (d)
-> subtract
14340.8242 (c)
- 14340.0000 (d)
––––––––––––
0.8242 (III)
Now we have split the number again into 3 tickers: 1.153 (I), 143.4 (II) and 0.8242 (III)
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
In this publication the function compose_3_() will make a composite ticker of 3 tickers, and the split_3_() function will split these 3 tickers again after passing 1 request.security() call.
In this example:
t46 = 'BINANCE:MTLUSDT', n46 = 10e8 , r46 = 3, t47 = 'BINANCE:XMRUSDT', n47 = 10e1, r47 = 1, t48 = 'BINANCE:ORNUSDT', r48 = 4 // T16
•••
T16= compose_3_(t48, t47, n47, t46, n46)
•••
= request.security(T16, res, )
•••
= split_3_(c16, n46, r46, n47, r47, r48)
🔶 CHANGING TICKERS
If you need to change tickers, you only have to change the first part of the script, USER DEFINED TICKERS
Back to our example, at line 26 in the code, you'll find:
t46 = 'BINANCE:MTLUSDT', n46 = 10e8 , r46 = 3, t47 = 'BINANCE:XMRUSDT', n47 = 10e1, r47 = 1, t48 = 'BINANCE:ORNUSDT', r48 = 4 // T16
( t46 , T16 ,... will be explained later)
You need to figure out how much you need to multiply each ticker, and the number for rounding, to get a good result.
In this case:
'BINANCE:MTLUSDT', multiply number = 10e8, round number is 3 (example value 1.153)
'BINANCE:XMRUSDT', multiply number = 10e1, round number is 1 (example value 143.4)
'BINANCE:ORNUSDT', NO multiply number, round number is 4 (example value 0.8242)
The value with most digits after the decimal point by preference is placed to the right side (ORNUSDT)
If you want to change these 3, how would you do so?
First pick your tickers and look for the round values, for example:
'MATICUSDT', example value = 0.5876 -> round -> 4
'LTCUSDT' , example value = 77.47 -> round -> 2
'ARBUSDT' , example value = 1.0231 -> round -> 4
Value with most digits after the decimal point -> MATIC or ARB, let's pick ARB to go on the right side, LTC at the left of ARB, and MATIC at the most left side.
-> 'MATICUSDT', LTCUSDT', ARBUSDT'
Then check with how much 'LTCUSDT' and 'MATICUSDT' needs to be multiplied to get this: 5876 0 7747 0 1.0231
'MATICUSDT' -> 10e10
'LTCUSDT' -> 10e3
Replace:
t46 = 'BINANCE:MTLUSDT', n46 = 10e8 , r46 = 3, t47 = 'BINANCE:XMRUSDT', n47 = 10e1, r47 = 1, t48 = 'BINANCE:ORNUSDT', r48 = 4 // T16
->
t46 = 'BINANCE:MATICUSDT', n46 = 10e10 , r46 = 4, t47 = 'BINANCE:LTCUSDT', n47 = 10e3, r47 = 2, t48 = 'BINANCE:ARBUSDT', r48 = 4 // T16
DO NOT change anything at t46, n46,... if you don't know what you're doing!
Only
• tickers ('BINANCE:MTLUSDT', 'BINANCE:XMRUSDT', 'BINANCE:ORNUSDT', ...),
• multiply numbers (10e8, 10e1, ...) and
• round numbers (3, 1, 4, ...)
should be changed.
There you go!
🔶 LIMITATIONS
🔹 The composite ticker fails when 1 of the 3 isn't in market in the weekend, while the other 2 are.
That is the reason all tickers are crypto. I think it is possible to combine stock,... tickers, but they have to share the same market hours.
🔹 The number cannot be as large as you want, the limit lays around 15-16 digits.
This means when you have for example 123, 45.67 and 0.000000000089, you'll get issues when composing to this:
-> 123045670.000000000089 (21 digits)
Make sure the numbers are close to each other as possible, with 1 zero (or 2) in between:
-> 1.230045670089 (13 digits by doing -> (123 * 10e-3) + (45.67 * 10e-7) + 0.000000000089)
🔹 This script contains examples of calculated values, % change, SMA, RMA and RSI.
These values need to be calculated from HTF close data at current TF (timeframe).
This gives challenges. For example the SMA / %change is not a problem (same values at 1h TF from Daily data).
RMA , RSI is not so easy though...
Daily values are rather similar on a 2-3h TF, but 1h TF and lower is quite different.
At the moment I haven't figured out why, if someone has an idea, don't hesitate to share.
The main goal of this publication is 'composite tickers ~ request.security()' though.
🔹 When a ticker value changes substantially (x10, x100), the multiply number needs to be adjusted accordingly.
🔶 SETTINGS
SHOW SETS
SET
• Length : length of SMA, RMA and RSI
• HTF : Higher TimeFrame (default Daily)
TABLE
• Size table : \ _ Self-explanatory
• Include exchange name : /
• Sort : If exchange names are shown, the exchanges will be sorted first
COLOURS
• CH%
• RSI
• SMA (RMA)
DEBUG
Remember t46 , T16 ,... ?
This can be used for debugging/checking
ALWAYS DISABLE " sort " when doing so.
Example:
Set string -> T1 (tickers FIL, CAKE, SOL)
(Numbers are slightly different due to time passing by between screen captures)
Placing your tickers at the side panel makes it easy to compare with the printed label below the table (right side, 332201415014.45 ),
together with the line T1 in the script:
t1 = 'BINANCE:FILUSDT' , n1 = 10e10, r1 = 4, t2 = 'BINANCE:CAKEUSDT' , n2 = 10e5 , r2 = 3, t3 = 'BINANCE:SOLUSDT' , r3 = 2 // T1
FIL : 3.322
CAKE: 1.415
SOL : 14.56
Now it is easy to check whether the tickers are placed close enough to each other, with 1-2 zero's in between.
If you want to check a specific ticker, use " Show Ticker" , see out initial example:
Set string -> T16
Show ticker -> 46 (in the code -> t46 = 'BINANCE:MTLUSDT')
(Set at 0 to disable " check string " and NONE to disable " Set string ")
-> Debug/check/set away! 😀
🔶 OTHER TECHNIQUES
• REGEX ( Regular expression ) and str.match() is used to delete the exchange name from the ticker, in other words, everything before ":" is deleted by following regex:
exch(t) => incl_exch ? t : str.match(t, "(?<=:) +")
• To sort, array.sort_indices() is used (line 675 in the code), just as in my first "sort" publication Sort array alphabetically - educational
aSort = arrT.copy()
sort_Indices = array.sort_indices(id= aSort, order= order.ascending)
• Numbers and text colour will adjust automatically when switching between light/dark mode by using chart.fg_color / chart.bg_color
🔹 DISCLAIMER
Please don't ask me for custom screeners, thank you.
Simple Ultimate Oscillator█ OVERVIEW
This indicator as an educational and showcase the usage of user-defined types (UDT) or objects for Ultimate Oscillator.
█ CREDITS
TradingView
█ FEATURES
1. Color of plot is based on contrast color of chart background.
2. Plot fill of overbought and oversold.
3. Support Multi Timeframe.
Simple Ichimoku Kinko Hyo Cloud█ OVERVIEW
This indicator as an educational and showcase the usage of user-defined types or objects (UDT) for Ichimoku Kinko Hyo or Ichimoku Cloud.
█ CREDITS
TradingView
DEVPRO TradingDEVPRO Trading system comprises of the following:
D - Double (EMA and VWAP)
E - EMA
V - VWAP (current and previous day ending VWAP level)
P - Standard Pivot Point
R - RSI (Multi-time frame table is added at the top and traders can add standard RSI 14 as an additional non-overlay indicator)
O - OI data (not available for options trading in TV but trader can always check in their broker terminal)
Double EMA have been color coded in red and green for bullish and bearish trends.
Candles are colored for bullish (green), sideways (grey) and bearish (red) phases.
Setup to be traded with monthly options for stocks and weekly options for indices.
Bullish Setup:
RSI greater than 50
Current candle close above VWAP and previous day closing VWAP
Current candle close above daily Pivot
For option buying (Call option OI should be falling below its moving average 20 meaning short covering)
For option selling (Put option OI should be rising above its moving average 20 meaning Put writers confidence is increasing)
Book partial qty profits at R1/R2/R3 and/or exit completely on Doji candle low break
Bearish Setup:
RSI less than 50
Current candle close below VWAP and previous day closing VWAP
Current candle close below daily Pivot
For option buying (Put option OI should be falling below its moving average 20 meaning short covering)
For option selling (Call option OI should be rising above its moving average 20 meaning Call writers confidence is increasing)
Book partial qty profits at S1/S2/S3 and/or exit completely on Doji candle high break
Open Interest Chart [LuxAlgo]The Open Interest Chart displays Commitments of Traders %change of futures open interest , with a unique circular plotting technique, inspired from this publication Periodic Ellipses .
🔶 USAGE
Open interest represents the total number of contracts that have been entered by market participants but have not yet been offset or delivered. This can be a direct indicator of market activity/liquidity, with higher open interest indicating a more active market.
Increasing open interest is highlighted in green on the circular plot, indicating money coming into the market, while decreasing open interests highlighted in red indicates money coming out of the market.
You can set up to 6 different Futures Open interest tickers for a quick follow up:
🔶 DETAILS
Circles are drawn, using plot() , with the functions createOuterCircle() (for the largest circle) and createInnerCircle() (for inner circles).
Following snippet will reload the chart, so the circles will remain at the right side of the chart:
if ta.change(chart.left_visible_bar_time ) or
ta.change(chart.right_visible_bar_time)
n := bar_index
Here is a snippet which will draw a 39-bars wide circle that will keep updating its position to the right.
//@version=5
indicator("")
n = bar_index
barsTillEnd = last_bar_index - n
if ta.change(chart.left_visible_bar_time ) or
ta.change(chart.right_visible_bar_time)
n := bar_index
createOuterCircle(radius) =>
var int end = na
var int start = na
var basis = 0.
barsFromNearestEdgeCircle = 0.
barsTillEndFromCircleStart = radius
startCylce = barsTillEnd % barsTillEndFromCircleStart == 0 // start circle
bars = ta.barssince(startCylce)
barsFromNearestEdgeCircle := barsTillEndFromCircleStart -1
basis := math.min(startCylce ? -1 : basis + 1 / barsFromNearestEdgeCircle * 2, 1) // 0 -> 1
shape = math.sqrt(1 - basis * basis)
rad = radius / 2
isOK = barsTillEnd <= barsTillEndFromCircleStart and barsTillEnd > 0
hi = isOK ? (rad + shape * radius) - rad : na
lo = isOK ? (rad - shape * radius) - rad : na
start := barsTillEnd == barsTillEndFromCircleStart ? n -1 : start
end := barsTillEnd == 0 ? start + radius : end
= createOuterCircle(40)
plot(h), plot(l)
🔶 LIMITATIONS
Due to the inability to draw between bars, from time to time, drawings can be slightly off.
Bar-replay can be demanding, since it has to reload on every bar progression. We don't recommend using this script on bar-replay. If you do, please choose the lowest speed and from time to time pause bar-replay for a second. You'll see the script gets reloaded.
🔶 SETTINGS
🔹 TICKERS
Toggle :
• Enabled -> uses the first column with a pre-filled list of Futures Open Interest tickers/symbols
• Disabled -> uses the empty field where you can enter your own ticker/symbol
Pre-filled list : the first column is filled with a list, so you can choose your open interest easily, otherwise you would see COT:088691_F_OI aka Gold Futures Open Interest for example.
If applicable, you will see 3 different COT data:
• COT: Legacy Commitments of Traders report data
• COT2: Disaggregated Commitments of Traders report data
• COT3: Traders in Financial Futures report data
Empty field : When needed, you can pick another ticker/symbol in the empty field at the right and disable the toggle.
Timeframe : Commitments of Traders (COT) data is tallied by the Commodity Futures Trading Commission (CFTC) and is published weekly. Therefore data won't change every day.
Default set TF is Daily
🔹 STYLE
From middle:
• Enabled (default): Drawings start from the middle circle -> towards outer circle is + %change , towards middle of the circle is - %change
• Disabled: Drawings start from the middle POINT of the circle, towards outer circle is + OR -
-> in both options, + %change will be coloured green , - %change will be coloured red .
-> 0 %change will be coloured blue , and when no data is available, this will be coloured gray .
Size circle : options tiny, small, normal, large, huge.
Angle : Only applicable if "From middle" is disabled!
-> sets the angle of the spike:
Show Ticker : Name of ticker, as seen in table, will be added to labels.
Text - fill
• Sets colour for +/- %change
Table
• Sets 2 text colours, size and position
Circles
• Sets the colour of circles, style can be changed in the Style section.
You can make it as crazy as you want:
Volume Spread Analysis Candle PatternsVolume Spread Analysis (VSA) is a methodology used in trading and investing to analyze the relationship between volume, price spread, and price movement in financial markets. It was developed by Richard Wyckoff, a prominent trader and market observer.
The core principle of VSA is that changes in volume can provide insights into the strength or weakness of price movements and indicate the intentions of market participants. By examining the interplay between volume and price, traders aim to identify the behavior of smart money (informed institutional investors) versus less-informed market participants.
Key concepts in Volume Spread Analysis include:
1. Volume: VSA places significant emphasis on volume as a leading indicator. It suggests that changes in volume precede price movements and can provide clues about the market's sentiment.
2. Spread: The spread refers to the price range between the high and low of a given trading period (e.g., a candlestick or bar). VSA considers the relationship between volume and spread to gauge the strength of price action.
3. Upthrust and Springs: These are VSA candle patterns that indicate potential market reversals. An upthrust occurs when prices briefly move above a resistance level but fail to sustain the upward momentum. Springs, on the other hand, happen when prices briefly dip below a support level but quickly rebound.
4. No Demand and No Supply: These patterns suggest a lack of interest or participation from buyers (no demand) or sellers (no supply) at a particular price level. These conditions may foreshadow a potential price reversal or consolidation.
5. Hidden Buying and Selling: Hidden buying occurs when prices close near the high of a bar, indicating the presence of buyers even though the market appears weak. Hidden selling is the opposite, where prices close near the low of a bar, suggesting the presence of sellers despite apparent strength.
By combining these VSA concepts with other technical analysis tools, traders seek to identify potential trading opportunities with favorable risk-reward ratios. VSA can be applied to various financial markets, including stocks, futures, forex, and cryptocurrencies.
It's important to note that while VSA provides a framework for analyzing volume and price, its interpretation and application require experience, skill, and subjective judgment. Traders often use VSA in conjunction with other technical indicators and chart patterns to make well-informed trading decisions.
Range Projections [TFO]The purpose of this indicator is to see how often price reached certain standard deviations from a selected time range. The inspiration for this was to study ICT (Inner Circle Trader) concepts regarding the Central Bank Dealer’s Range (CBDR), which is 2:00 pm - 8:00 pm New York local time according to ICT Core Content. However, the idea and data collection could certainly be applied to any range of time.
The main settings of this indicator are session time, range type, and the standard deviation filter. The session time is the window of price that will be utilized for range projections. The range type can be either body or wick (on the current timeframe). The standard deviation filter is used to eliminate sessions whose ranges (from high to low) are greater than the desired/input number of standard deviations from all available session ranges.
In this example, the time range is set to 16:00 - 20:00, or the time between the New York session close and the Asia session open. Our standard deviations are set to 1, 2, 2.5, and 4. Now, by taking this session’s price range and extrapolating these extensions from the initial range, we can use these levels to see if and how price interacts with them before the next 16:00 - 20:00 session.
Furthermore, we can enable the Data Table to analyze how often price trades to these levels for the sessions that are deemed valid (determined by the standard deviation filter). This time our standard deviations are set to 1, 2, 3, and 4.
This concept can theoretically be applied to any window of time. ICT has mentioned that, in instances where the CBDR is too large, the Asia range may be used instead. We can observe that the indicator behaves the same way when we change the session to the Asia range, 20:00 - 00:00.
bar viewBar view is a simple script to show other higher time frame windows while you are focusing on lower time for precise decision making.
For example you are currently operating at 1 minute time frame and you want to see other bars on higher time frames e.g. 5 minute, 15 minutes etc.
Feel free to add multiple bar view to see different time frames.
Interactive Motive Wave ChecklistHere is an interactive tool that can be used for learning a bit about Elliott Waves
🎲 How it works?
The script upon load asks users to enter 6 pivots in an order. Once all 6 pivots are selected on the interactive chart, the script will calculate if the structure is a valid motive wave.
When you load the script, you will see a prompt on the chart to select points on the chart to form 6 pivots.
When you select the 6 pivots, the checklists are populated on the chart to notify users which conditions for qualifying the selection has passed and which of them are failed.
🎲 Conditions for Motive Wave
Motive wave can be either Impulse or Diagonal Wave. Diagonal wave can be either expanding or contracting diagonals. To learn more about diagonal waves, please go through this idea.
Rules for generic motive waves are as below
Pivots in order - Checks wether the pivots selected are in progressive order.
Directions in order - Checks if the pivot directions are correct - either PH, PL, PH, PL, PH, PL or PL, PH, PL, PH, PL, PH
Wave 2 never moves beyond the start of wave 1 - Wave 2 retracement is less than 100% of wave1
Wave 3 always moves beyond the end of wave 1 - Wave 3 retracement is more than 100% of wave2
Wave 3 is never the shortest one - Checks if Wave 3 is bigger than either Wave 1 or wave 5 or both.
Now, these are the specific rules for Impulse Waves on top of Motive Wave conditions
Wave 4 never moves beyond the end of Wave 1 - meaning wave 1 and wave 4 never overlap on price scale.
Wave 1, 3, 5 are all not extended. We check for retracement ratios of more than 200% to be considered as extended wave.
Below are the conditions for Diagonal Waves on top of Motive Wave conditions
Wave4 never moves beyond the start of Wave 3 - Wave 4 retracement is less than 100%
Wave 4 always ends within the price territory of Wave 1 - Unlike impulse wave, wave 4 intersects with wave 1 in case of diagonal waves. This is the major difference between impulse and diagonal wave.
Waves are progressively expanding or contracting - Wave1 > Wave3 > Wave5 and Wave2 > Wave4 to be contracting diagonal. Wave1 < Wave3 < Wave5 and Wave2 < Wave4 to be expanding diagonal wave.
Here is an example of diagonal wave projection
Here is an example of impulse wave projection
Machine Learning : Cosine Similarity & Euclidean DistanceIntroduction:
This script implements a comprehensive trading strategy that adheres to the established rules and guidelines of housing trading. It leverages advanced machine learning techniques and incorporates customised moving averages, including the Conceptive Price Moving Average (CPMA), to provide accurate signals for informed trading decisions in the housing market. Additionally, signal processing techniques such as Lorentzian, Euclidean distance, Cosine similarity, Know sure thing, Rational Quadratic, and sigmoid transformation are utilised to enhance the signal quality and improve trading accuracy.
Features:
Market Analysis: The script utilizes advanced machine learning methods such as Lorentzian, Euclidean distance, and Cosine similarity to analyse market conditions. These techniques measure the similarity and distance between data points, enabling more precise signal identification and enhancing trading decisions.
Cosine similarity:
Cosine similarity is a measure used to determine the similarity between two vectors, typically in a high-dimensional space. It calculates the cosine of the angle between the vectors, indicating the degree of similarity or dissimilarity.
In the context of trading or signal processing, cosine similarity can be employed to compare the similarity between different data points or signals. The vectors in this case represent the numerical representations of the data points or signals.
Cosine similarity ranges from -1 to 1, with 1 indicating perfect similarity, 0 indicating no similarity, and -1 indicating perfect dissimilarity. A higher cosine similarity value suggests a closer match between the vectors, implying that the signals or data points share similar characteristics.
Lorentzian Classification:
Lorentzian classification is a machine learning algorithm used for classification tasks. It is based on the Lorentzian distance metric, which measures the similarity or dissimilarity between two data points. The Lorentzian distance takes into account the shape of the data distribution and can handle outliers better than other distance metrics.
Euclidean Distance:
Euclidean distance is a distance metric widely used in mathematics and machine learning. It calculates the straight-line distance between two points in Euclidean space. In two-dimensional space, the Euclidean distance between two points (x1, y1) and (x2, y2) is calculated using the formula sqrt((x2 - x1)^2 + (y2 - y1)^2).
Dynamic Time Windows: The script incorporates a dynamic time window function that allows users to define specific time ranges for trading. It checks if the current time falls within the specified window to execute the relevant trading signals.
Custom Moving Averages: The script includes the CPMA, a powerful moving average calculation. Unlike traditional moving averages, the CPMA provides improved support and resistance levels by considering multiple price types and employing a combination of Exponential Moving Averages (EMAs) and Simple Moving Averages (SMAs). Its adaptive nature ensures responsiveness to changes in price trends.
Signal Processing Techniques: The script applies signal processing techniques such as Know sure thing, Rational Quadratic, and sigmoid transformation to enhance the quality of the generated signals. These techniques improve the accuracy and reliability of the trading signals, aiding in making well-informed trading decisions.
Trade Statistics and Metrics: The script provides comprehensive trade statistics and metrics, including total wins, losses, win rate, win-loss ratio, and early signal flips. These metrics offer valuable insights into the performance and effectiveness of the trading strategy.
Usage:
Configuring Time Windows: Users can customize the time windows by specifying the start and finish time ranges according to their trading preferences and local market conditions.
Signal Interpretation: The script generates long and short signals based on the analysis, custom moving averages, and signal processing techniques. Users should pay attention to these signals and take appropriate action, such as entering or exiting trades, depending on their trading strategies.
Trade Statistics: The script continuously tracks and updates trade statistics, providing users with a clear overview of their trading performance. These statistics help users assess the effectiveness of the strategy and make informed decisions.
Conclusion:
With its adherence to housing trading rules, advanced machine learning methods, customized moving averages like the CPMA, and signal processing techniques such as Lorentzian, Euclidean distance, Cosine similarity, Know sure thing, Rational Quadratic, and sigmoid transformation, this script offers users a powerful tool for housing market analysis and trading. By leveraging the provided signals, time windows, and trade statistics, users can enhance their trading strategies and improve their overall trading performance.
Disclaimer:
Please note that while this script incorporates established tradingview housing rules, advanced machine learning techniques, customized moving averages, and signal processing techniques, it should be used for informational purposes only. Users are advised to conduct their own analysis and exercise caution when making trading decisions. The script's performance may vary based on market conditions, user settings, and the accuracy of the machine learning methods and signal processing techniques. The trading platform and developers are not responsible for any financial losses incurred while using this script.
By publishing this script on the platform, traders can benefit from its professional presentation, clear instructions, and the utilisation of advanced machine learning techniques, customised moving averages, and signal processing techniques for enhanced trading signals and accuracy.
I extend my gratitude to TradingView, LUX ALGO, and JDEHORTY for their invaluable contributions to the trading community. Their innovative scripts, meticulous coding patterns, and insightful ideas have profoundly enriched traders' strategies, including my own.
Support Resistance Classification (VR) [LuxAlgo]The Support Resistance Classification (VR) indicator shows SR levels on any chart's visible range using higher time-frame data (HTF). Levels are classified 1 through 10 based on their strength, with lower values indicating stronger support/resistance levels.
This indicator uses visible range functionality, whereas if you adjust your chart to show previous price data, the indicator may show new levels.
🔶 USAGE
Certain indicators on higher timeframes can provide longer term support/resistance levels on lower timeframes. Users can use the provided levels on a chart visible range and use them as reference for future support/resistance levels.
The classification algorithm measures the strength of a support/resistance level using the entire chart visible range and is in a range of 1 to 10, with higher values indicating a weaker support/resistance.
Supports/resistances highlighted by the indicator can be used for future applications by marking them on the chart (quickly done with alt + h).
🔶 DETAILS
All calculations are based on what you see on the Visible Chart, as such changing the chart will recalculate the indicator.
Since only Swings which are not broken are included, every break would exclude that swing. Therefore, even when 'value' is chosen at Settings ('Value'), breaks are always calculated on the entire line.
🔶 SETTINGS
Fade: After x breaks the line becomes invisible
Value:
value:
• SMA, upper/lower: the breaks are triggered on the moving average itself
• Fibonacci Pivot Point levels, Previous High, Previous Low: only last HTF values can be used for breaks
• Swings (see SWING SETTINGS)
line:
• SMA, upper/lower: the breaks are triggered on the entire line, based on its latest value
• Fibonacci Pivot Point Levels, Previous High, Previous Low: breaks are triggered on the entire line, based on its latest value
• Swings (see SWING SETTINGS)
🔹 Swing Settings
Swings are always calculated at current timeframe, setting a HTF is not applicable on Swings.
Left/Right: for Swing calculation ( pivothigh , pivotlow )
Show: enables you to see the pivot points
🔹 Set
N°: The concerning number
TYPE:
• SMA (Simple Moving Average)
• Previous High/Low
• Upper/Lower ( Bollinger Bands )
• Pivot Point levels : "Fibonacci"
LENGTH: sets the 'Number of bars', needed for calculations (applicable for SMA, upper/lower)
MULT: sets the 'Standard deviation factor' (only applicable for upper/lower - BB)
HTF: sets 'Higher Time Frame' (applicable for SMA, upper/lower, Previous High/Low, Fibonacci)
🔹 Show Values
You can make up to 5 values visible (if you want to check/verify), except for Swings (see SWING SETTINGS)
To do so, enable (A -> E), and choose the N° you want to see.
This also is a useful tool if you're not sure which value you want to set.
Rolling Risk-Adjusted Performance RatiosThis simple indicator calculates and provides insights into different performance metrics of an asset - Sharpe, Sortino and Omega Ratios in particular. It allows users to customize the lookback period and select their preferred data source for evaluation of an asset.
Sharpe Ratio:
The Sharpe Ratio measures the risk-adjusted return of an asset by considering both the average return and the volatility or riskiness of the investment. A higher Sharpe Ratio indicates better risk-adjusted performance. It allows investors to compare different assets or portfolios and assess whether the returns adequately compensate for the associated risks. A higher Sharpe Ratio implies that the asset generates more return per unit of risk taken.
Sortino Ratio:
The Sortino Ratio is a variation of the Sharpe Ratio that focuses specifically on the downside risk or volatility of an asset. It takes into account only the negative deviations from the average return (downside deviation). By considering downside risk, the Sortino Ratio provides a more refined measure of risk-adjusted performance, particularly for investors who are more concerned with minimizing losses. A higher Sortino Ratio suggests that the asset has superior risk-adjusted returns when considering downside volatility.
Omega Ratio:
The Omega Ratio measures the probability-weighted ratio of gains to losses beyond a certain threshold or target return. It assesses the skewed nature of an asset's returns by differentiating between positive and negative returns and assigning more weight to extreme gains or losses. The Omega Ratio provides insights into the potential asymmetry of returns, highlighting the potential for significant positive or negative outliers. A higher Omega Ratio indicates a higher probability of achieving large positive returns compared to large negative returns.
Utility:
Performance Evaluation: Provides assessment of an asset's performance, considering both returns and risk factors.
Risk Comparison: Allows for comparing the risk-adjusted returns of different assets or portfolios. Helps identify investments with better risk-reward trade-offs.
Risk Management: Assists in managing risk exposure by evaluating downside risks and volatility.
XAUXXXThis simple script is meant to get around the limitations some data providers have, in terms of the length of historical data they choose to provide traders. Inspired by OANDA's XAUCAD pair only having data as far back as 2005, whereas XAUUSD has data back to to the 19th century.
By taking the OHLC data from XAUUSD and multiplying it by the price of USD in a desired currency you are able to see further back in time, the limitation now being the length of FX data available instead of the price of Precious metal / currency pair. As shown in the chart you can now see the price of Gold in CAD as far back as the late 1960s, a nearly half century of data uncovered for all to see!
Monthly Strategy Performance TableWhat Is This?
This script code adds a Monthly Strategy Performance Table to your Pine Script strategy scripts so you can see a month-by-month and year-by-year breakdown of your P&L as a percentage of your account balance.
The table is based on realized equity rather than open equity, so it only updates the metrics when a trade is closed.
That's why some numbers will not match the Strategy Tester metrics (such as max drawdown), as the Strategy Tester bases metrics like max drawdown on open trade equity and not realized equity (closed trades).
The script is still a work-in-progress, so make sure to read the disclaimer below. But I think it's ready to release the code for others to play around with.
How To Use It
The script code includes one of my strategies as an example strategy. You need to replace my strategy code with your own. To do that just copy the source code below into a blank script, delete lines 11 -> 60 and paste your strategy code in there instead of mine. The script should work with most systems, but make sure to read the disclaimer below.
It works best with a significant amount of historical data, so it may not work very effectively on intraday timeframes as there is a severe limitation of available bars on TradingView. I recommend using it on 4HR timeframes and above, as anything less will produce very little usable data. Having a premium TradingView plan will also help boost the number of available bars.
You can hover your mouse over a table cell to get more information in the form of tooltips (such as the Long and Short win rate if you hover over your total return cell).
Credit
The code in this script is based on open-source code originally written by QuantNomad, I've made significant changes and additions to the original script but all credit for the idea and especially the display table code goes to them - I just built on top of it:
Why Did I Make This?
None of this is trading or investment advice, just my personal opinion based on my experience as a trader and systems developer these past 6+ years:
The TradingView Strategy Tester is severely limited in some important ways. And unless you use complex Excel formulas on exported test data, you can't see a granular perspective of your system's historical performance.
There is much more to creating profitable and tradeable systems than developing a strategy with a good win rate and a good return with a reasonable drawdown.
Some additional questions we need to ask ourselves are:
What did the system's worst drawdown look like?
How long did it last?
How often do drawdowns occur, and how quickly are they typically recovered?
How often do we have a break-even or losing month or year?
What is our expected compounded annual growth rate, and how does that growth rate compare to our max drawdown?
And many more questions that are too long to list and take a lifetime of trading experience to answer.
Without answering these kinds of questions, we run the risk of developing systems that look good on paper, but when it comes to live trading, we are uncomfortable or incapable of enduring the system's granular characteristics.
This Monthly Performance Table script code is intended to help bridge some of that gap with the Strategy Tester's limited default performance data.
Disclaimer
I've done my best to ensure the numbers this code outputs are accurate, and according to my testing with my personal strategy scripts it appears to work fine. But there is always a good chance I've missed something, or that this code will not work with your particular system.
The majority of my TradingView systems are extremely simple single-target systems that operate on a closed-candle basis to minimize many of the data reliability issues with the Strategy Tester, so I was unable to do much testing with multiple targets and pyramiding etc.
I've included a Debug option in the script that will display important data and information on a label each time a trade is closed. I recommend using the Debug option to confirm that the numbers you see in the table are accurate and match what your strategy is actually doing.
Always do your own due diligence, verify all claims as best you can, and never take anyone's word for anything.
Take care, and best of luck with your trading :)
Kind regards,
Matt.
PS. If you're interested in learning how this script works, I have a free hour-long video lesson breaking down the source code - just check out the links below this script or in my profile.
Advanced Choppiness Indicator with CPMA"The Advanced Choppiness Indicator with CPMA is a technical analysis tool designed to assist traders in identifying choppy market conditions and determining trend direction. It combines two key components: the Choppiness Index and a Custom Price Moving Average (CPMA).
The Choppiness Index is calculated using the Average True Range (ATR), which measures market volatility. It compares the ATR to the highest high and lowest low over a specified period. A higher Choppiness Index value indicates choppier market conditions, while a lower value suggests smoother and more directional price movements.
The CPMA is a custom moving average that takes into account various price types, including the close, high, low, and other combinations. It calculates the average of these price types over a specific length. The CPMA provides a smoother trend line that can help identify support and resistance levels more accurately than traditional moving averages.
When using this indicator, pay attention to the following elements:
Yellow range boxes: These indicate choppy zones, where market conditions are characterized by low momentum and erratic price action. Avoid entering trades during these periods.
Histogram bars: Green bars suggest an uptrend, while red bars indicate a downtrend. These bars are based on the CPMA and can help confirm the prevailing trend direction.
CPMA angle: The angle of the CPMA line provides further insight into the trend. A positive angle indicates an uptrend, while a negative angle suggests a downtrend.
Choppiness thresholds: The indicator includes user-defined thresholds for choppiness. Values above the high threshold indicate high choppiness, while values below the low threshold suggest low choppiness.
Trade decisions: Consider the information provided by the indicator to make informed trading decisions. Avoid trading during choppy zones and consider entering trades in the direction of the prevailing trend.
Remember that the indicator's parameters, such as ATR length and CPMA length, can be adjusted to suit your trading preferences and timeframe. However, it's important to use this indicator in conjunction with other technical analysis tools and your trading strategy for comprehensive market analysis."
By combining the Choppiness Index, CPMA, and other visual cues, this indicator aims to help traders identify suitable trading conditions and make more informed decisions based on market trends and volatility.
Lot Size CalculatorThis is a public release of my Lot Size Calculator. I received a request for the code from a user so I am republishing the script so I can make it public (TV doesn't seem to give me the option to simply make it public once published ).
This is a very simple script to use. Simply choose your entry level and stop level on the chart and the indicator will calculate the lots. You can change your account risk and base currency units in the settings along with changing the scaling of the calculation to adjust the results with the lot sizing units of your broker. This allows the calculator to be used with CFDs, forex, Gold, etc.. Hope it helps in your trading it has been the single most useful tool in my trading as it has helped me always keep my risk locked up and on point that is why I released it.
One final quick note: Remember you can save your settings for your own account size and risk so you do not always have to modify the defaults when loading the script. Just a ease of use tip. I only add the script to my chart when I am about to take a trade so it is helpful to have everything set up in advance.