Welborg 2024This script was not built directly by me; but then it is as a result of combining other existing indicators and I would want to say a big thank you to them all; Smoothed Heiken Ashi - SamX by SamAccountX, UT Bot Alerts by QuantNomad, Volumatic Variable Index Dynamic Average by Bigbeluga and the use of EMA 6 and EMA 8. The reason for the mashup is that I noticed an increased win rate upon combining them up as per only one indicator use. and modifying the initial settings and back-testing it on GOLD; XAUUSD.
I would love to share with the community so we all can make some money; As the saying goes; sharing is caring.
Secondly; the best time frame for the strategy is 5min, 10min, 15min and 30min.
With crypto Assetts 3min or 1 min timeframe can be considered.
RAW CHART
I am using Candlestick to demonstrate the usage of the Welborg 2024, per House Rules.
This is the Raw Chart without the indicatore on the 15minute Timeframe.
EMA CROSS OVER
Ema 6 and Ema 8
Ema 6 and Ema 8 cross over activated here.
FULL SCALE RELEASE IN WELBORG
Smoothed Heiken Ashi
UT Bot
VIDYA
WHEN YOU GO TO SETTINGS;
Turn off HIGHLIGHTS TREND
GO TO INPUTS;
Turn off the "SHOW WICKS"
And keep the VIDYA Momentum at 1
SAVE AS DEFAULT AND CLICK OKAY.
ON the main chart; hide the candles of the commodity or pair you are on, so you have only the WELBORG displaying it prints. This helps you to overcome noise from the Candlestick Chart.
BUY = Yellow / White Heiken Ashi print
SELL = Pink Heiken Ashi print
THANK YOU.
Forecasting
Range Expansion Predictor with Position SizingThe Range Expansion Predictor with Position Sizing is a trading tool that helps predict potential price movements based on the expansion of a market's range. It calculates the predicted high for future price action by analyzing the range of the previous day's candle and multiplying it by a user-defined multiplier. This predictor is combined with position sizing, allowing traders to determine the optimal trade size based on their account size and risk tolerance. The tool calculates the appropriate entry price, stop loss, and position size for both predicted price levels and the current close price, offering a comprehensive approach to managing risk and maximizing potential gains. It also displays these values in clear, visual tables, assisting traders in making informed decisions during their trading activities.
Solar and Lunar Eclipse Bu komut tam olarak güneş ve ay tutulmalarını vermektedir. Güneş tutulması ve ay tutulması hemen hemen aynı zamanlarda gerçekleşir.
1.Güneş tutulması Ay tutulmasından önce gerçekleşmişse; Ayı sezonu
2. Ay tutulması Güneş tutulmasından önce gerçekleşmişse; Boğa sezonu
This allows solar and lunar eclipses as a full command. Solar tearing and lunar tearing occur around the same time.
1. If the Sun tear occurred before the Moon tear; Bearish
2. If the Lunar tear occurred before the Sun tear; Bullish
**4 kere Güneş aydan önce olur 4 kere ise ay güneşten. Bu yüzden güneş tutulmasının öne geçeceğini önceden görüp hareket edebilirsiniz.
M2 Money Shift for Bitcoin [SAKANE]M2 Money Shift for Bitcoin was developed to visualize the impact of M2 Money, a macroeconomic indicator, on the Bitcoin market and to support trade analysis.
Bitcoin price fluctuations have a certain correlation with cycles in M2 money supply.In particular, it has been noted that changes in M2 supply can affect the bitcoin price 70 days in advance.Very high correlations have been observed in recent years in particular, making it useful as a supplemental analytical tool for trading.
Support for M2 data from multiple countries
M2 supply data from the U.S., Europe, China, Japan, the U.K., Canada, Australia, and India are integrated and all are displayed in U.S. dollar equivalents.
Slide function
Using the "Slide Days Forward" setting, M2 data can be slid up to 500 days, allowing for flexible analysis that takes into account the time difference from the bitcoin price.
Plotting Total Liquidity
Plot total liquidity (in trillions of dollars) by summing the M2 supply of multiple countries.
How to use
After applying the indicator to the chart, activate the M2 data for the required country from the settings screen. 2.
2. adjust "Slide Days Forward" to analyze the relationship between changes in M2 supply and bitcoin price
3. refer to the Gross Liquidity plot to build a trading strategy that takes into account macroeconomic influences.
Notes.
This indicator is an auxiliary tool for trade analysis and does not guarantee future price trends.
The relationship between M2 supply and bitcoin price depends on many factors and should be used in conjunction with other analysis methods.
Institutional Entry DetectorExplanation:
Volume Multiplier and Price Change: These inputs allow you to adjust the sensitivity of the indicator.
Average Volume: Calculated over the last 20 periods to identify volume spikes.
Volume Spike: A condition where the current volume is significantly higher than the average volume.
Price Movement: A condition where the price change exceeds a certain percentage.
Institutional Entry: Combines the volume spike and price movement conditions.
Plotting: Displays a green arrow above the candlestick when both conditions are met.
Changes Made:
Entry Price Level: Added a plot to mark the entry price level with a green line when an institutional entry is detected.
Plotting: The plot function now includes a condition to display the entry price level only when the institutional entry condition is met.
3 Consecutive Higher Lows with Blue CandleCheckout this custom indicator I built. The Candlestick turns blue on the 3rd consecutive Higher Low. Cheers! - Celery
Short Term Stop Loss Clusters
The script identifies potential stop-loss clusters by analyzing swing points and volume
Uses a dynamic strength calculation based on volume and recency of the level
Visualizes clusters using horizontal lines with varying opacity
Implements efficient array management to prevent memory issues
Uses input parameters for customization
MA Crossover Strategy with Multiple TPs and SLQuesto indicatore utilizza l'incrocio di due medie mobili semplici (SMA) per generare segnali di acquisto e vendita. Inoltre, permette di impostare e visualizzare tre livelli di take profit (TP) regolabili direttamente dalle impostazioni.
Kill Zones by ShakhzodTrade Session Separator - Simplify Your Trading with Clear Session Boundaries
Struggling to keep track of trading hours? The Trade Session Separator makes it effortless to identify session boundaries on your chart, helping you analyze market movements with precision.
Key Features:
✅ Session Identification – Clearly marks the start and end of each trading session.
✅ Customizable Settings – Tailor it to fit different markets and time zones.
✅ Enhanced Visibility – Choose colors and styles that match your trading preferences.
✅ Improved Analysis – Gain insights into session-specific trends and optimize your strategy.
This tool ensures you never miss the transition between sessions, allowing for better market analysis and smarter decision-making.
Trade Session Separator – your ultimate companion for cleaner, more effective trading! 🌟
ICT Macro Sessions by @zeusbootrading Copenhagen timeThis is based on this script with copenhagen times
MACD and RSI Future Crossover Prediction (Beta)The arrows in the script indicate MACD crossovers and crossunders, providing visual markers for these key events:
Green Up Arrow: This indicates a MACD crossover, where the MACD line crosses above the signal line, suggesting a potential buy signal or upward momentum. This is typically seen as a sign of positive market movement, signaling the possibility of a price increase.
Red Down Arrow: This indicates a MACD crossunder, where the MACD line crosses below the signal line, suggesting a potential sell signal or downward momentum. This is usually interpreted as a sign of a possible price decrease or market reversal.
These arrows help traders quickly identify important shifts in market trends and potential entry/exit points based on the MACD's behavior. The script also uses RSI levels to refine predictions, adjusting the significance of the crossovers based on whether the market is overbought or oversold.
This script analyzes the MACD and RSI indicators to predict future price movements based on historical crossovers and current market conditions. It identifies when the MACD line crosses above or below the signal line (crossover and crossunder events) and tracks the percentage change between these points. The script calculates the maximum percentage gain from the crossover to crossunder and estimates the potential gain for the next crossover based on historical data. Additionally, the estimation is adjusted based on the RSI's current level: a low RSI (below 30) suggests stronger potential upward movement, while a high RSI (above 70) suggests a potential decrease. This combination of indicators aims to provide an informed prediction of future market movements.
The script also visually annotates the chart with labels showing the maximum gain from each crossover and the estimated gain for the next potential crossover.
Disclaimer:
The information provided by this script is for educational and informational purposes only. It is not intended as financial, investment, or trading advice. The creator of this script is not responsible for any financial losses, damages, or consequences that may arise from using this tool or from relying on the predictions or analysis provided. Always conduct your own research and consult with a qualified financial advisor before making any trading or investment decisions. By using this script, you acknowledge and accept these terms.
Simple Decesion Matrix Classification Algorithm [SS]Hello everyone,
It has been a while since I posted an indicator, so thought I would share this project I did for fun.
This indicator is an attempt to develop a pseudo Random Forest classification decision matrix model for Pinescript.
This is not a full, robust Random Forest model by any stretch of the imagination, but it is a good way to showcase how decision matrices can be applied to trading and within Pinescript.
As to not market this as something it is not, I am simply calling it the "Simple Decision Matrix Classification Algorithm". However, I have stolen most of the aspects of this machine learning algo from concepts of Random Forest modelling.
How it works:
With models like Support Vector Machines (SVM), Random Forest (RF) and Gradient Boosted Machine Learning (GBM), which are commonly used in Machine Learning Classification Tasks (MLCTs), this model operates similarity to the basic concepts shared amongst those modelling types. While it is not very similar to SVM, it is very similar to RF and GBM, in that it uses a "voting" system.
What do I mean by voting system?
How most classification MLAs work is by feeding an input dataset to an algorithm. The algorithm sorts this data, categorizes it, then introduces something called a confusion matrix (essentially sorting the data in no apparently order as to prevent over-fitting and introduce "confusion" to the algorithm to ensure that it is not just following a trend).
From there, the data is called upon based on current data inputs (so say we are using RSI and Z-Score, the current RSI and Z-Score is compared against other RSI's and Z-Scores that the model has saved). The model will process this information and each "tree" or "node" will vote. Then a cumulative overall vote is casted.
How does this MLA work?
This model accepts 2 independent variables. In order to keep things simple, this model was kept as a three node model. This means that there are 3 separate votes that go in to get the result. A vote is casted for each of the two independent variables and then a cumulative vote is casted for the overall verdict (the result of the model's prediction).
The model actually displays this system diagrammatically and it will likely be easier to understand if we look at the diagram to ground the example:
In the diagram, at the very top we have the classification variable that we are trying to predict. In this case, we are trying to predict whether there will be a breakout/breakdown outside of the normal ATR range (this is either yes or no question, hence a classification task).
So the question forms the basis of the input. The model will track at which points the ATR range is exceeded to the upside or downside, as well as the other variables that we wish to use to predict these exceedences. The ATR range forms the basis of all the data flowing into the model.
Then, at the second level, you will see we are using Z-Score and RSI to predict these breaks. The circle will change colour according to "feature importance". Feature importance basically just means that the indicator has a strong impact on the outcome. The stronger the importance, the more green it will be, the weaker, the more red it will be.
We can see both RSI and Z-Score are green and thus we can say they are strong options for predicting a breakout/breakdown.
So then we move down to the actual voting mechanisms. You will see the 2 pink boxes. These are the first lines of voting. What is happening here is the model is identifying the instances that are most similar and whether the classification task we have assigned (remember out ATR exceedance classifier) was either true or false based on RSI and Z-Score.
These are our 2 nodes. They both cast an individual vote. You will see in this case, both cast a vote of 1. The options are either 1 or 0. A vote of 1 means "Yes" or "Breakout likely".
However, this is not the only voting the model does. The model does one final vote based on the 2 votes. This is shown in the purple box. We can see the final vote and result at the end with the orange circle. It is 1 which means a range exceedance is anticipated and the most likely outcome.
The Data Table Component
The model has many moving parts. I have tried to represent the pivotal functions diagrammatically, but some other important aspects and background information must be obtained from the companion data table.
If we bring back our diagram from above:
We can see the data table to the left.
The data table contains 2 sections, one for each independent variable. In this case, our independent variables are RSI and Z-Score.
The data table will provide you with specifics about the independent variables, as well as about the model accuracy and outcome.
If we take a look at the first row, it simply indicates which independent variable it is looking at. If we go down to the next row where it reads "Weighted Impact", we can see a corresponding percent. The "weighted impact" is the amount of representation each independent variable has within the voting scheme. So in this case, we can see its pretty equal, 45% and 55%, This tells us that there is a slight higher representation of z-score than RSI but nothing to worry about.
If there was a major over-respresentation of greater than 30 or 40%, then the model would risk being skewed and voting too heavily in favour of 1 variable over the other.
If we move down from there we will see the next row reads "independent accuracy". The voting of each independent variable's accuracy is considered separately. This is one way we can determine feature importance, by seeing how well one feature augments the accuracy. In this case, we can see that RSI has the greatest importance, with an accuracy of around 87% at predicting breakouts. That makes sense as RSI is a momentum based oscillator.
Then if we move down one more, we will see what each independent feature (node) has voted for. In this case, both RSI and Z-Score voted for 1 (Breakout in our case).
You can weigh these in collaboration, but its always important to look at the final verdict of the model, which if we move down, we can see the "Model prediction" which is "Bullish".
If you are using the ATR breakout, the model cannot distinguish between "Bullish" or "Bearish", must that a "Breakout" is likely, either bearish or bullish. However, for the other classification tasks this model can do, the results are either Bullish or Bearish.
Using the Function:
Okay so now that all that technical stuff is out of the way, let's get into using the function. First of all this function innately provides you with 3 possible classification tasks. These include:
1. Predicting Red or Green Candle
2. Predicting Bullish / Bearish ATR
3. Predicting a Breakout from the ATR range
The possible independent variables include:
1. Stochastics,
2. MFI,
3. RSI,
4. Z-Score,
5. EMAs,
6. SMAs,
7. Volume
The model can only accept 2 independent variables, to operate within the computation time limits for pine execution.
Let's quickly go over what the numbers in the diagram mean:
The numbers being pointed at with the yellow arrows represent the cases the model is sorting and voting on. These are the most identical cases and are serving as the voting foundation for the model.
The numbers being pointed at with the pink candle is the voting results.
Extrapolating the functions (For Pine Developers:
So this is more of a feature application, so feel free to customize it to your liking and add additional inputs. But here are some key important considerations if you wish to apply this within your own code:
1. This is a BINARY classification task. The prediction must either be 0 or 1.
2. The function consists of 3 separate functions, the 2 first functions serve to build the confusion matrix and then the final "random_forest" function serves to perform the computations. You will need all 3 functions for implementation.
3. The model can only accept 2 independent variables.
I believe that is the function. Hopefully this wasn't too confusing, it is very statsy, but its a fun function for me! I use Random Forest excessively in R and always like to try to convert R things to Pinescript.
Hope you enjoy!
Safe trades everyone!
Weekly Bullish Pattern DetectorThis script is a TradingView Pine Script designed to detect a specific bullish candlestick pattern on the weekly chart. Below is a detailed breakdown of its components:
1. Purpose
The script identifies a four-candle bullish pattern where:
The first candle is a long green (bullish) candlestick.
The second and third candles are small-bodied candles, signifying consolidation or indecision.
The fourth candle is another long green (bullish) candlestick.
When this pattern is detected, the script:
Marks the chart with a visual label.
Optionally triggers an alert to notify the trader.
2. Key Features
Overlay on Chart:
indicator("Weekly Bullish Pattern Detector", overlay=true) ensures the indicator draws directly on the price chart.
Customizable Inputs:
length (Body Size Threshold):
Defines the minimum percentage of the total range that qualifies as a "long" candle body (default: 14%).
smallCandleThreshold (Small Candle Body Threshold):
Defines the maximum percentage of the total range that qualifies as a "small" candle body (default: 10%).
Candlestick Property Calculations:
bodySize: Measures the absolute size of the candle body (close - open).
totalRange: Measures the total high-to-low range of the candle.
bodyPercentage: Calculates the proportion of the body size relative to the total range ((bodySize / totalRange) * 100).
isGreen and isRed: Identify bullish (green) or bearish (red) candles based on their open and close prices.
Pattern Conditions:
longGreenCandle:
Checks if the candle is bullish (isGreen) and its body percentage exceeds the defined length threshold.
smallCandle:
Identifies small-bodied candles where the body percentage is below the smallCandleThreshold.
consolidation:
Confirms the second and third candles are both small-bodied (smallCandle and smallCandle ).
Bullish Pattern Detection:
bullishPattern:
Detects the full four-candle sequence:
The first candle (longGreenCandle ) is a long green candle.
The second and third candles (consolidation) are small-bodied.
The fourth candle (longGreenCandle) is another long green candle.
Visualization:
plotshape(bullishPattern):
Draws a green label ("Pattern") below the price chart whenever the pattern is detected.
Alert Notification:
alertcondition(bullishPattern):
Sends an alert with the message "Bullish Pattern Detected on Weekly Chart" whenever the pattern is found.
3. How It Works
Evaluates Candle Properties:
For each weekly candle, the script calculates its size, range, and body percentage.
Identifies Each Component of the Pattern:
Checks for a long green candle (first and fourth).
Verifies the presence of two small-bodied candles (second and third).
Detects and Marks the Pattern:
Confirms the sequence and marks the chart with a label if the pattern is complete.
Sends Alerts:
Notifies the trader when the pattern is detected.
4. Use Cases
This script is ideal for:
Swing Traders:
Spotting weekly patterns that indicate potential bullish continuations.
Breakout Traders:
Identifying consolidation zones followed by upward momentum.
Pattern Recognition:
Automatically detecting a commonly used bullish formation.
5. Key Considerations
Timeframe: Works best on weekly charts.
Customization: The thresholds for "long" and "small" candles can be adjusted to suit different markets or volatility levels.
Limitations:
It doesn't confirm the pattern's success; further analysis (e.g., volume, support/resistance levels) may be required for validation
ATR% Multiple from Key Moving AverageThis script gives signal when the ATR% multiple from any chosen moving average is beyond the configurable threshold value. This indicator quantifies how extended the stock is from a given key moving average.
A lot of traders use ATR% multiple from 10DMA, 21EMA, 50SMA or 200SMA to determine how extended a stock is and accordingly sell partials or exit. By default the indicator takes 50SMA and when the ATR% multiple is greater than 7 then it gives the signal to take partials. You can back test this indicator with previous trades and determine the ideal threshold for the signal. For small and midcaps a threshold of 7 to 10 ATR% multiples from 50SMA is where partials can be taken while large caps can revert to mean even earlier at 3 to 5 ATR% multiples from 50SMA.
You can modify this script and use it anyway you please as long as you make it opensource on TradingView.
Hybrid Triple Exponential Smoothing🙏🏻 TV, I present you HTES aka Hybrid Triple Exponential Smoothing, designed by Holt & Winters in the US, assembled by me in Saint P. I apply exponential smoothing individually to the data itself, then to residuals from the fitted values, and lastly to one-point forecast (OPF) errors, hence 'hybrid'. At the same time, the method is a closed-form solution and purely online, no need to make any recalculations & optimize anything, so the method is O(1).
^^ historical OPFs and one-point forecasting interval plotted instead of fitted values and prediction interval
Before the How-to, first let me tell you some non-obvious things about Triple Exponential smoothing (and about Exponential Smoothing in general) that not many catch. Expo smoothing seems very straightforward and obvious, but if you look deeper...
1) The whole point of exponential smoothing is its incremental/online nature, and its O(1) algorithm complexity, making it dope for high-frequency streaming data that is also univariate and has no weights. Consequently:
- Any hybrid models that involve expo smoothing and any type of ML models like gradient boosting applied to residuals rarely make much sense business-wise: if you have resources to boost the residuals, you prolly have resources to use something instead of expo smoothing;
- It also concerns the fashion of using optimizers to pick smoothing parameters; honestly, if you use this approach, you have to retrain on each datapoint, which is crazy in a streaming context. If you're not in a streaming context, why expo smoothing? What makes more sense is either picking smoothing parameters once, guided by exogenous info, or using dynamic ones calculated in a minimalistic and elegant way (more on that in further drops).
2) No matter how 'right' you choose the smoothing parameters, all the resulting components (level, trend, seasonal) are not pure; each of them contains a bit of info from the other components, this is just how non-sequential expo smoothing works. You gotta know this if you wanna use expo smoothing to decompose your time series into separate components. The only pure component there, lol, is the residuals;
3) Given what I've just said, treating the level (that does contain trend and seasonal components partially) as the resulting fit is a mistake. The resulting fit is level (l) + trend (b) + seasonal (s). And from this fit, you calculate residuals;
4) The residuals component is not some kind of bad thing; it is simply the component that contains info you consciously decide not to include in your model for whatever reason;
5) Forecasting Errors and Residuals from fitted values are 2 different things. The former are deltas between the forecasts you've made and actual values you've observed, the latter are simply differences between actual datapoints and in-sample fitted values;
6) Residuals are used for in-sample prediction intervals, errors for out-of-sample forecasting intervals;
7) Choosing between single, double, or triple expo smoothing should not be based exclusively on the nature of your data, but on what you need to do as well. For example:
- If you have trending seasonal data and you wanna do forecasting exclusively within the expo smoothing framework, then yes, you need Triple Exponential Smoothing;
- If you wanna use prediction intervals for generating trend-trading signals and you disregard seasonality, then you need single (simple) expo smoothing, even on trending data. Otherwise, the trend component will be included in your model's fitted values → prediction intervals.
8) Kind of not non-obvious, but when you put one smoothing parameter to zero, you basically disregard this component. E.g., in triple expo smoothing, when you put gamma and beta to zero, you basically end up with single exponential smoothing.
^^ data smoothing, beta and gamma zeroed out, forecasting steps = 0
About the implementation
* I use a simple power transform that results in a log transform with lambda = 0 instead of the mainstream-used transformers (if you put lambda on 2 in Box-Cox, you won't get a power of 2 transform)
* Separate set of smoothing parameters for data, residuals, and errors smoothing
* Separate band multipliers for residuals and errors
* Both typical error and typical residuals get multiplied by math.sqrt(math.pi / 2) in order to approach standard deviation so you can ~use Z values and get more or less corresponding probabilities
* In script settings → style, you can switch on/off plotting of many things that get calculated internally:
- You can visualize separate components (just remember they are not pure);
- You can switch off fit and switch on OPF plotting;
- You can plot residuals and their exponentially smoothed typical value to pick the smoothing parameters for both data and residuals;
- Or you might plot errors and play with data smoothing parameters to minimize them (consult SAE aka Sum of Absolute Errors plot);
^^ nuff said
More ideas on how to use the thing
1) Use Double Exponential Smoothing (data gamma = 0) to detrend your time series for further processing (Fourier likes at least weakly stationary data);
2) Put single expo smoothing on your strategy/subaccount equity chart (data alpha = data beta = 0), set prediction interval deviation multiplier to 1, run your strat live on simulator, start executing on real market when equity on simulator hits upper deviation (prediction interval), stop trading if equity hits lower deviation on simulator. Basically, let the strat always run on simulator, but send real orders to a real market when the strat is successful on your simulator;
3) Set up the model to minimize one-point forecasting errors, put error forecasting steps to 1, now you're doing nowcasting;
4) Forecast noisy trending sine waves for fun.
^^ nuff said 2
All Good TV ∞
Asset MaxGain MinLoss Tracker [CHE]Asset MaxGain MinLoss Tracker – Your Tool to Discover the Best Trading Opportunities
Introduction
Hello dear traders,
Today, I'd like to introduce you to a fantastic tool: the Asset MaxGain MinLoss Tracker . This indicator is designed to help you identify the best trading opportunities in the market by analyzing the maximum gain and adjusted maximum loss potentials of various assets.
Why Use This Indicator?
1. Time-Saving Analysis
Instead of spending hours sifting through different charts, this indicator provides you with key metrics for up to 10 assets at a glance.
2. Compare Multiple Assets Simultaneously
Monitor and compare multiple assets to discover which ones offer the highest profit potential and the lowest risk of loss.
3. Customizable Settings
Adjust the observation period and select the assets you want to analyze according to your trading strategy.
4. Clear Visual Representation
Data is presented in an easy-to-read table directly on your chart, highlighting assets with the highest maximum gain and the lowest adjusted maximum loss.
How to Use It in Everyday Trading
Step 1: Setting Up the Indicator
Select Your Assets: Choose up to 10 assets you wish to track. These can be cryptocurrencies, stocks, forex pairs, etc.
Configure the Trading Period Length: Set the number of bars (candles) over which you want to calculate the maximum gain and adjusted maximum loss. This allows you to tailor the analysis to your preferred time frame, whether it's short-term trading or long-term investing.
Step 2: Interpreting the Results
Maximum Gain (%): This value shows the potential upside of each asset over the selected period. A higher percentage indicates a greater potential for profit if the asset's price moves upward.
Adjusted Maximum Loss (%): This figure represents the potential downside risk, adjusted to give a more accurate reflection of loss potential. A lower percentage means less risk of significant loss.
Category Highlighting: Assets are categorized based on their performance:
High Gain & Low Loss: Assets that have both the highest max gain and the lowest adjusted max loss.
High Gain: Assets with the highest max gain.
Low Loss: Assets with the lowest adjusted max loss.
Step 3: Making Trading Decisions
Identify Opportunities: Focus on assets categorized as High Gain & Low Loss for the most favorable risk-to-reward scenarios.
Risk Management: Use the adjusted maximum loss to assess and mitigate potential risks associated with each asset.
Portfolio Diversification: Allocate your investments across assets with varying levels of gain and loss potentials to diversify your portfolio effectively.
Practical Example
Imagine you're monitoring the following assets:
Asset 1: BTCUSD
Asset 2: ETHUSD
Asset 3: ADAUSD
Asset 4: XRPUSD
After applying the indicator:
BTCUSD shows a high maximum gain but also a high adjusted maximum loss.
ETHUSD has both a high maximum gain and a low adjusted maximum loss, categorizing it as High Gain & Low Loss.
ADAUSD indicates a low maximum gain but the lowest adjusted maximum loss.
XRPUSD reflects moderate values in both categories.
Decision Making:
Primary Focus: ETHUSD may be your top choice due to its high reward and lower risk.
Risk-Averse Option: ADAUSD could be considered if you prioritize minimizing losses.
Balanced Approach: Diversify by investing in both ETHUSD and ADAUSD.
Understanding the Core Functionality
While you don't need to delve deep into the code to use the indicator effectively, understanding its core function can enhance your confidence in the tool.
The Main Function: Calculating Max Gain and Adjusted Max Loss
The heart of the indicator is a function that calculates two critical metrics for each asset:
Maximum Gain (sym_MaxGain):
Purpose: Measures the highest potential profit over the selected period.
How It Works: It finds the lowest price (sym_minlow) within the period and calculates the percentage increase to the current high price. This shows how much you could have gained if you bought at the lowest point.
Adjusted Maximum Loss (sym_AdjustedMaxLoss):
Purpose: Provides an adjusted measure of the potential loss, giving a more realistic risk assessment.
How It Works: It identifies the highest price (sym_maxhigh) within the period and calculates the percentage decrease to the current low price. This value is adjusted to account for the diminishing impact as losses approach 100%.
Simplified Explanation of the Function
Data Retrieval: For each asset (sym), the function retrieves the high and low prices over the specified timeframe.
Calculations:
Find Highest and Lowest Prices: Determines sym_maxhigh and sym_minlow within the tracking period.
Compute Max Gain: Calculates the potential gain from sym_minlow to the current high.
Compute Max Loss: Calculates the potential loss from sym_maxhigh to the current low.
Adjust Max Loss: Adjusts the max loss calculation to prevent distortion as losses near 100%.
Output: Returns both sym_MaxGain and sym_AdjustedMaxLoss for further analysis.
Benefits of Understanding the Function
Transparency: Knowing how these values are calculated can increase your trust in the indicator's outputs.
Customization: If you're familiar with coding, you might tailor the function to suit specific trading strategies.
Enhanced Analysis: Understanding the underlying calculations allows you to interpret the results more effectively, aiding in better decision-making.
Conclusion
The Asset MaxGain MinLoss Tracker is a powerful tool that can significantly enhance your trading efficiency and effectiveness by:
Providing Quick Insights: Save time by getting immediate access to essential performance metrics of multiple assets.
Assisting in Risk Management: Use the adjusted maximum loss to understand and mitigate potential risks.
Supporting Strategic Decisions: Identify assets with the best risk-to-reward ratios to optimize your trading strategy.
Take advantage of this indicator to elevate your trading game and make more informed decisions with confidence.
Thank you for your time, and happy trading!
Disclaimer:
The content provided, including all code and materials, is strictly for educational and informational purposes only. It is not intended as, and should not be interpreted as, financial advice, a recommendation to buy or sell any financial instrument, or an offer of any financial product or service. All strategies, tools, and examples discussed are provided for illustrative purposes to demonstrate coding techniques and the functionality of Pine Script within a trading context.
Any results from strategies or tools provided are hypothetical, and past performance is not indicative of future results. Trading and investing involve high risk, including the potential loss of principal, and may not be suitable for all individuals. Before making any trading decisions, please consult with a qualified financial professional to understand the risks involved.
By using this script, you acknowledge and agree that any trading decisions are made solely at your discretion and risk.
This indicator is inspired by the "Max Gain" indicator. A special thanks to Skipper86 for his relentless effort, creativity, and contributions to the TradingView community, which served as a foundation for this work.
Previous Candle AverageDescription:
The Previous Candle Average indicator is a powerful tool designed to provide traders with insights into market momentum by visualizing the relationship between the current and previous open levels for a customizable timeframe. This versatile indicator allows you to select from various timeframes, including 1 Month, 1 Week, 1 Day, 8 Hours, 4 Hours, and 1 Hour, making it suitable for different trading strategies, whether you're a swing trader, day trader, or scalper.
The indicator plots the Current Open and Previous Open levels for the selected timeframe and calculates the average value between them. By displaying these critical levels, traders can quickly gauge the current market dynamics relative to the previous period, making it easier to identify support, resistance, or trend continuation.
Key Features:
Custom Timeframe Selection: Easily select the desired timeframe from a variety of options (1M, 1W, 1D, 8H, 4H, 1H) to align with your trading strategy.
Current and Previous Open Levels: The indicator plots both the Current Open and Previous Open levels for the chosen timeframe, providing clear visual guidance on where the market is opening relative to the previous period.
Open Fill with Adjustable Transparency: The area between the Current Open and Previous Open levels is filled with color to represent the relationship between the two. The fill color changes based on whether the Current Open is above or below the Previous Open, with a default 20% opacity for better clarity without overwhelming the chart.
Average Line: The indicator also plots the average value between the Current Open and Previous Open levels, painted by default in a solid white color with a line thickness of 2. This average helps identify potential key levels where the price might react.
Dynamic Coloring: The fill color changes dynamically based on whether the Current Open is higher or lower than the Previous Open, using green to indicate bullish behavior and red for bearish behavior.
How to Use:
The Previous Candle Average indicator can help traders identify the momentum of the market by visually comparing the relationship between consecutive open levels.
Use the Average Line as a reference for potential support or resistance, especially when the market opens near this average.
The Open Fill color can quickly indicate a shift in market sentiment. A green fill suggests that the market is opening stronger than the previous period, while a red fill indicates weakness.
Best Practices:
Combine this indicator with other technical analysis tools, such as trend lines, moving averages, or volume analysis, to confirm potential trading opportunities.
The custom timeframe feature is particularly useful for multi-timeframe analysis. For instance, you can monitor weekly open levels while trading on an hourly chart.
Note: The indicator uses real-time open data and is updated accordingly, ensuring there is no delay or repainting of historical values.
Ideal For:
Traders who want a clear visual representation of market open levels relative to previous periods.
Those who want to identify potential shifts in momentum by comparing open levels across different timeframes.
Traders seeking to add an additional layer of analysis to their existing strategy by incorporating key opening levels and their averages.
Drummond Geometry - Pldot and EnvelopeThis Pine Script will:
1.Calculate and display the PL Dot (Price Level Dot), a moving average that reflects short-term market trends.
2.Plot the Envelope Top and Bottom lines based on averages of previous highs and lows, which represent key areas of resistance and support.
Drummond Geometry Overview
Drummond Geometry is a method of market analysis focused on:
PL Dot : Captures market energy and trend direction. It reacts to price deviations and serves as a magnet for price returns, often referred to as a "PL Dot Refresh."
Envelope Theory : Considers price movements as cycles oscillating between the Envelope Top and Bottom. Prices breaking these boundaries often indicate trends, retracements, or exhaustion.
The geometry helps traders visualize energy flows in the market and anticipate directional changes using established support and resistance zones.
Understanding PL Dot and Envelope Top/Bottom
PL Dot:
Formula: Average(Average(H, L, C) of last three bars)
Usage: Indicates short-term trends:
Trend: PL Dot slopes upward or downward.
Congestion: PL Dot moves horizontally.
Envelope Top and Bottom:
Formula:
Top: (11 H1 + 11 H2 + 11 H3) / 3
Bottom: (11 L1 + 11 L2 + 11 L3) / 3
Usage: Acts as dynamic resistance and support:
Price above the top: Indicates strong bullish momentum.
Price below the bottom: Indicates strong bearish momentum.
Advantages of Drummond Geometry
Clarity of Market Flow: Highlights the relationship between price and key levels (PL Dot, Envelope Top/Bottom).
Predictive Power: Suggests possible reversals or continuation based on energy distribution.
Adaptability: Works across multiple time frames and market types (trending, congestion).
Trading Strategy
PL Dot Trades:
Buy: When price returns to the PL Dot in an uptrend.
Sell: When price returns to the PL Dot in a downtrend.
Envelope Trades:
Reversal: Trade counter to price if it breaks and retreats from the Envelope Top/Bottom.
Continuation: Trade in the direction of price if it sustains movement beyond the Envelope Top/Bottom.
Real-Time Custom Candle Range Color Indicator
The script allows the user to input a custom range value (default set to 100 points) through the userDefinedRange variable. This value determines the minimum range required for a candle to change color.
Calculating Candle Range:
The script calculates the range of each candle by subtracting the low from the high price.
Determining Bullish or Bearish Candles:
It checks whether the close price is higher than the open price to determine if a candle is bullish (isBullish variable).
Coloring Candles:
Based on the custom range input, the script changes the color of the candles:
If the candle's range is greater than or equal to the custom range and it is bullish, the candle color is set to blue (bullishColor).
If the range condition is met and the candle is bearish, the color is set to orange (bearishColor).
If the range condition is not met, the color is set to na (not applicable).
Plotting Colored Candles:
The plotcandle function is used to plot candles with colors based on the custom range and bullish/bearish conditions. The candles will have a higher z-order to be displayed in front of default candles.
Displaying High and Low Price Points:
Triangular shapes are plotted at the high and low price levels using the plotshape function, with colors representing bullish (blue) and bearish (orange) conditions.
In trading, this indicator can help traders visually identify candles that meet a specific range criteria, potentially signaling strength or weakness in price movements. By customizing the range parameter, traders can adapt the indicator to different market conditions and trading strategies. It can be used in conjunction with other technical analysis tools to make informed trading decisions based on candlestick patterns and price movements.
Refined Entries with AlertsHELLO? this is an indicator that uses, different strategies to find you some nice entries, you can try using it and also feel free to help me add more on it to make it easy, to trade.
Currency StrengthThis innovative Currency Strength Indicator is a powerful tool for forex traders, offering a comprehensive and visually intuitive way to analyze the relative strength of multiple currencies simultaneously. Here's what makes this indicator stand out:
Extensive Currency Coverage
One of the most striking features of this indicator is its extensive coverage of currencies. While many similar tools focus on just the major currencies, this indicator includes:
Major currencies: USD, EUR, JPY, GBP, CHF, CAD, AUD, NZD
Additional currencies: CNY, HKD, KRW, MXN, INR, RUB, SGD, TRY, BRL, ZAR, THB
This wide range allows traders to gain insights into a broader spectrum of the forex market, including emerging markets and less commonly traded currencies.
Unique Visual Presentation
The indicator boasts a clear and user-friendly interface:
Each currency is represented by a distinct colored line for easy identification
A legend is prominently displayed at the top of the chart, using color-coded labels for quick reference
Users can customize which currencies to display, allowing for a tailored analysis
This clean, organized presentation enables traders to quickly grasp the relative strengths of different currencies at a glance.
Robust Measurement Methodology
The indicator employs the True Strength Index (TSI) to calculate currency strength, which provides several advantages:
TSI is a momentum oscillator that shows both trend direction and overbought/oversold conditions
It uses two smoothing periods (fast and slow), which helps filter out market noise and provides more reliable signals
The indicator calculates TSI for each currency index (e.g., DXY for USD, EXY for EUR), ensuring a comprehensive strength measurement
By using TSI, this indicator offers a more nuanced and accurate representation of currency strength compared to simpler moving average-based indicators.
Customization and Flexibility
Traders can fine-tune the indicator to suit their needs:
Adjustable TSI parameters (fast and slow periods)
Ability to show/hide specific currencies
Customizable color scheme for each currency line
Practical Applications
This Currency Strength Indicator can be used for various trading strategies:
Identifying potential trend reversals when a currency reaches extreme overbought or oversold levels
Spotting divergences between currency pairs
Confirming trends across multiple timeframes
Enhancing multi-pair trading strategies
By providing a clear, comprehensive, and customizable view of currency strength across a wide range of currencies, this indicator equips traders with valuable insights for making informed trading decisions in the complex world of forex.
Marcel's Dynamic Profit / Loss Calculator for GoldOverview
This Dynamic Risk / Reward Tool for Gold is designed to help traders efficiently plan and manage their trades in the volatile gold market. This script provides a clear visualisation of trade levels (Entry, Stop Loss, Take Profit) while dynamically calculating potential profit and loss. It ensures gold traders can assess their positions with precision, saving time and improving risk management.
Key Features
1. Trade Level Visualisation:
Plots Entry (Blue), Stop Loss (Red), and Take Profit (Green) lines directly on the chart.
Helps you visualise and confirm trade setups quickly which is good for scalping and day trades.
2. Dynamic Risk and Reward Calculations:
Calculates potential profit and loss in real time based on user-defined inputs such as position size, leverage, and account equity.
Displays a summary panel showing risk/reward metrics directly on the chart.
3. Customisable Settings:
Allows you to adjust key parameters like account equity, position size, leverage, and specific price levels for Entry, Stop Loss, and Take Profit.
Defaults are dynamically generated for convenience but remain fully adjustable for flexibility.
How It Works
The script uses gold-specific conventions (e.g., 1 lot = 100 ounces, 1 pip = 0.01 price change) to calculate accurate risk and reward metrics.
It dynamically positions Stop Loss and Take Profit levels relative to the entry price, based on user-defined or default offsets.
A real-time summary panel is displayed in the bottom-right corner of the chart, showing:
Potential Profit: The monetary value if the Take Profit is hit.
Potential Lo
ss: The monetary value if the Stop Loss is hit.
How to Use It
1. Add the script to your chart on a gold trading pair (e.g., XAUUSD).
2. Input your:
Account equity.
Leverage.
Position size (in lots).
Desired En
try Price (default: current close price).
3. Adjust the Stop Loss and Take Profit levels to your strategy, or let the script use default offsets of:
500 pips below the Entry for Stop Loss.
1000 pips above the Entry for Take Profit.
4. Review the plotted levels and the summary panel to confirm your trade aligns with your risk/reward goals.
Why Use This Tool?
Clarity and Precision:
Provides clear trade visuals and financial metrics for confident decision-making.
Time-Saving:
Automates the calculations needed to evaluate trade risk and reward.
Improved Risk Management:
Ensures you never trade without knowing your exact potential loss and gain.
This script is particularly useful for both novice and experienced traders looking to enhance their risk management and trading discipline in the Gold market. Enjoy clearer trades at speed.
Advanced Pattern Detector**Script Overview**
**Indicator Name:** Advanced Pattern Detector
**Pine Script Version:** v5
**Indicator Type:** Overlaid on the chart (overlay=true)
**Main Features:**
- Detection and visualization of various technical patterns.
- Generation of BUY and SELL signals based on detected patterns.
- Display of Fibonacci levels to identify potential support and resistance levels.
- Ability to enable or disable each pattern through the indicator settings.
---
**Indicator Settings**
**Switches to Enable/Disable Patterns**
At the top of the indicator, there are parameters that allow the user to select which patterns will be displayed on the chart:
- Three Drives
- Rounding Top
- Rounding Bottom
- ZigZag Pattern
- Inverse Head and Shoulders
- Fibonacci Retracement
**Parameters for ZigZag**
Settings are also available for the ZigZag pattern, such as the depth of peak and trough detection, allowing the user to adjust the indicator's sensitivity to price changes.
---
**Pattern Detection**
Each pattern is implemented with its own logic, which checks specific conditions on the current bar (candle). Below are the main patterns:
1. **Three Drives**
- **Description:** This pattern consists of three consecutive price movements in one direction (up or down). It can signal the continuation of the current trend or its reversal.
- **How It Works:**
- **Upward Drive:** The indicator checks that the closing price of each subsequent candle is higher than the previous one for three bars.
- **Downward Drive:** The indicator checks that the closing price of each subsequent candle is lower than the previous one for three bars.
2. **Rounding Top**
- **Description:** A pattern representing a smooth decrease in maximum prices over several bars, which may indicate a potential downward trend reversal.
- **How It Works:**
- The indicator checks that the maximum prices of the last five bars are gradually decreasing, and the current bar shows a decrease in the maximum price.
3. **Rounding Bottom**
- **Description:** A pattern characterized by a smooth increase in minimum prices over several bars, signaling a possible upward trend reversal.
- **How It Works:**
- The indicator checks that the minimum prices of the last five bars are gradually increasing, and the current bar shows an increase in the minimum price.
4. **ZigZag Pattern**
- **Description:** Used to identify corrective movements on the chart. The pattern shows peak and trough points connected by lines, helping to visualize the main price movement.
- **How It Works:**
- The indicator uses a function to determine local maxima and minima based on the specified depth.
- Detected peaks and troughs are connected by lines to create a visual zigzag structure.
5. **Inverse Head and Shoulders**
- **Description:** An inverted head and shoulders formation signals a possible reversal of a downward trend to an upward one.
- **How It Works:**
- The indicator looks for three local minima: the left shoulder, the head (the lowest minimum), and the right shoulder.
- It checks that the left and right shoulders are approximately at the same level and below the head.
6. **Fibonacci Retracement Levels**
- **Description:** Automatically builds key Fibonacci levels based on the maximum and minimum prices over the last 50 bars. These levels are often used as potential support and resistance levels.
- **How It Works:**
- Daily, the minimum and maximum prices over the last 50 bars are calculated.
- Based on these values, Fibonacci levels are drawn: 100%, 23.6%, 38.2%, 50%, 61.8%, and 0%.
- Old levels are removed when a new day begins to keep the chart clean and up-to-date.
---
**Generation of Buy and Sell Signals**
The indicator combines the results of detected patterns to generate trading signals:
- **Buy Signals (BUY):**
- Rounding Bottom
- Three Drives Up
- Inverse Head and Shoulders
- ZigZag Low
- **Sell Signals (SELL):**
- Rounding Top
- Three Drives Down
- Inverse Head and Shoulders
- ZigZag High
**How It Works:**
- If one or more buy conditions are met, a "BUY" label is displayed below the corresponding bar on the chart.
- If one or more sell conditions are met, a "SELL" label is displayed above the corresponding bar on the chart.
---
**Visualization of Patterns on the Chart**
Each detected pattern is visualized using various graphical elements, allowing traders to easily identify them on the chart:
- **Three Drives Up:** Green upward triangle below the bar.
- **Three Drives Down:** Red downward triangle above the bar.
- **Rounding Top:** Orange "RT" label above the bar.
- **Rounding Bottom:** Blue "RB" label below the bar.
- **Inverse Head and Shoulders:** Turquoise "iH&S" label below the bar.
- **ZigZag High/Low:** Purple circles at the peaks and troughs of the zigzag.
---
**Displaying Fibonacci Levels**
Fibonacci levels are displayed as horizontal lines on the chart with corresponding labels. These levels help traders determine potential entry and exit points, as well as support and resistance levels.
---
**Drawing ZigZag Lines**
ZigZag lines connect the detected peaks and troughs, visualizing corrective movements. To avoid cluttering the chart, the number of lines is limited, and old lines are automatically removed as new ones are added.