Market Structure Targets Model [LuxAlgo]The Market Structure Targets Model indicator provides an algorithmic approach to setting targets from market structure shifts (MSS) and market structure breaks (MSB), two popular Smart Money Concept (SMC) concepts. Depending on the target % settings, they can be used as take profit, confirmation levels, or potential reversal points.
🔶 USAGE
Our Market Structure Targets Model scripts provide automated and customizable targets from MSS and MSB. Each displayed target can be used in several ways described in the sub-sections below:
🔹 Take Profit
The targets can be used as take profit levels, where the target distance can be set separately for bullish/bearish MSS/MSB respectively.
🔹 Confirmation Levels
Alternatively, targets can be used as an additional confirmation level of a trend reversal when set at a lower percentage, filtering out fake signals that might be given from market structures. In this way, targets can be used as potential entry levels.
🔹 Potential Reversal Points
In some circumstances, targets being reached can be indicative of trend reversals. The percentage of the targets would be typically set higher to allow for trend exhaustion.
The above examples highlight this usage for bearish reversal scenarios, while the image below highlights it for bullish reversal scenarios.
🔹 Support/Resistance Levels
The targets, being horizontal levels, can also serve as potential support/resistances, with breakouts potentially confirming new trends. It is important to remain observant of the market structure. An MSS or MSB in the opposite direction provides essential information to be included in future decisions.
Using multiple timeframes can help detect longer-term trends. Depending on the user's preference, they can choose the appropriate timeframe for their needs.
Note that Target lines will only be drawn when the Target Level exceeds the close value when it is drawn.
🔹 Maximum Target Duration
The Maximum Target Duration setting removes unreached target levels when the amount of bars since the associated market structure of that target exceeds the user set limit. This effectively allows the removal of any target that might no longer be relevant to newer trends.
🔹 Type: Switch/Hold
This setting is another way to control unreached target levels.
Switch: When a new MSS/MSB is found, the previous target level associated with a market structure with the same direction (bullish/bearish) is deleted if it hasn't been reached.
Hold: Target levels are retained and continuously evaluated when a new MSS/MSB is formed.
The target level will be removed in both cases when the Maximum Target Duration condition is applied.
The above example shows the case when the Type setting is set to Switch , while in the example below, it is set to Hold .
🔶 DETAILS
🔹 Market Structure
Market structures are commonly classified as follows:
Market Structure Shift (MSS), also referred to as Change of Character (CHoCH)
Market Structure Break (MSB), also referred to as Break of Structure (BOS)
MSS indicates a shift in the market trend, confirming trend reversals. Conversely, MSB occurs once a trend is already determined, confirming new higher highs/lower lows.
🔹 Targets
A: Highest/lowest between the extremities of the MSS/MSB line
B: Price value of the MSS/MSB line
The distance between A and B is projected on the opposite side of the MSS/MSB line, adjusted with a percentage that can be set by the user. The above example used 100% of the distance between A and B.
The Target Percentage of MSS and MSB can be set separately for bullish or bearish market structures.
🔶 SETTINGS
Swings: Period used for the swing detection, with higher values returning longer-term Swing Levels.
Type: the Switch/Hold setting controls unattained target levels
Maximum Target Duration: removes the target lines when the amount of bars since the drawing of the target exceeds the limit and the target has not been reached
🔹 Market Structure Shift (MSS)
Bullish: Toggle, color setting, % Target
Bearish: Toggle, color setting, % Target
🔹 Market Structure Break (MSB)
Bullish: Toggle, color setting, % Target
Bearish: Toggle, color setting, % Target
Model
itradesize /\ Model x RTH Gap
I’m happy to announce my model and sharing it with you as an indicator.
About the model
The model is based on a range from 18:00 until 1:30. If you are keen you probably know that it's something that based on a bit of Daye's Theory. As Daily Q4 is from 18:00 until 0:00 and I've added a 90's Q1 to it as well that's why it ended up at 1:30.
It's an accumulation range and where we are looking for some opportunities above or below it when the algo is trying to fake the traders as the high and the low of the range are both important zones for liquidity pools. This model works on almost every pair but I've been mostly focusing on indices, especially on ES, NQ, and EUR/USD.
Do not trade before 1:30 AM and do not trade this model after 6:00 AM. So any tradable setup must be valid until 6:00 AM.
*All the mentioned times are based on America/NewYork timezone.
A simple sell setup
∆ If it takes the high of the model, then look for short opportunities.
∆ The best reliable scenario is when a high is taken while retracing back to an HTF PD Array so it will end up in a failure swing, Judas swing, you name it.
∆ When a high is taken you should wait for a market structure shift then it should give a nice displacement where it should retrace.
∆ The imbalance after the shift can be on every timeframe, based on your trade idea.
∆ If there are more imbalances, your decision on which to go with (as if there is a BPR, Breaker, OB, etc.. - can change the view of an FVG).
The same story goes for a buy setup.
∆ The first target is always the EQ of the model's range.
∆ The second target could be liquidity inside the EQ and the other side of the model (optional).
∆ The third target is the other side of the model.
∆ You can always leave a runner there if you eyeing some levels outside the model.
Additional information
∆ You can use silver bullet range as an extra confirmation when you looking for the actual displacement.
∆ An RTH range is also added to the indicator (starts drawing at 9:30 when the futures market opens) as it can be used to trade in the NY session and it is a must-have thing when trading indices.
∆ The colors of every label are switched automatically based on your chart's coloring.
Returns Model by TenozenHey there! I've been diving into the book "Paul Wilmott on Quantitative Finance," and I stumbled upon this cool model for calculating and modeling returns. Basically, it helps us figure out how much a price has changed over a set number of periods—I like to use 20 periods as a default. Once we get that rate of change value, we crunch some numbers to find the standard deviation and mean using all the historical data we have. That's the foundation of this model.
Now, let's talk about how to use it. This model shows us how returns and price behavior are connected. When returns hang out in the +1 to +2 standard deviation range, it usually means returns are about to drop, and vice versa. Often, this leads to corresponding price moves. But here's the thing: sometimes prices don't do what we expect. Why? It's because there's another hidden factor at play—I like to call it "power."
This "power" isn't something we can see directly, but it's there. Basically, when returns are within that standard deviation range, the market faces resistance when trying to move in its preferred direction, whether bullish or bearish. The strength of this "power" determines if the market will snap back to the average or go for a wild ride. It can show up as small price wiggles, big price jumps, or lightning-fast moves. By understanding this "power," we can get a better handle on what the market might do next and avoid getting blindsided. In the meantime, I couldn't explain "power" yet, but In the future, when I've learned enough, I'd love to share the model with you guys!
So... I'm planning to explore and share more models from this book as I learn, even if those pesky math formulas can be tough to crack. I hope you find this indicator as helpful as I do, and if you've got any suggestions or feedback, please feel free to share! Ciao!
[TTI] MarketSmith & IBD Style Model Stock Quarters 📜 ––––HISTORY & CREDITS––––
The MarketSmith & IBD Style Model Stock Quarters another Utility indicator is an original creation by TintinTrading inspired by Investor's Business Daily and William O'Neil style of presenting information. While going through the Model Stocks that IBD has been publishing, I realized that I wanted to see the exam same Quarterly presentation on the time axis in order to compare William O'Neil notes better with my own notes from Tradingview. The script is simple and could help you if you study the CANSLIM methodology.
🦄 –––UNIQUENESS–––
The distinctiveness of this indicator lies in its ability to visually delineate stock quarters directly on the price chart. It serves as a handy tool for traders who adopt a quarterly review of stock performance, in line with MarketSmith and IBD's analysis frameworks.
🛠️ ––––WHAT IT DOES––––
Quarter Marking : Draws a black line at the beginning of each financial quarter (January, April, July, and October).
Quarter Labeling : Places a label at the close of the last month in a quarter, indicating the upcoming quarter with its abbreviation and the last two digits of the year.
💡 ––––HOW TO USE IT––––
👉Installation: Add the indicator to your TradingView chart by searching for " MarketSmith & IBD Style Model Stock Quarters" in the indicator library.
👉Add to New Pane and squash the Pane Length: I add the indicator to a new pane under the price and volume charts and squash the height of the pane so that it looks exactly like the MarketSmith visuals.
👉Visual Cues:
Look for the black lines marking the start of a new quarter.
Observe the labels indicating the upcoming quarter and year, positioned at the close of the last month in a quarter.
👉Interpretation: Use these quarterly markers to align your trading strategies with quarterly performance metrics or to conduct seasonal analysis.
👉Settings: The indicator does not require any user-defined settings, making it straightforward to use.
Normal Distribution CurveThis Normal Distribution Curve is designed to overlay a simple normal distribution curve on top of any TradingView indicator. This curve represents a probability distribution for a given dataset and can be used to gain insights into the likelihood of various data levels occurring within a specified range, providing traders and investors with a clear visualization of the distribution of values within a specific dataset. With the only inputs being the variable source and plot colour, I think this is by far the simplest and most intuitive iteration of any statistical analysis based indicator I've seen here!
Traders can quickly assess how data clusters around the mean in a bell curve and easily see the percentile frequency of the data; or perhaps with both and upper and lower peaks identify likely periods of upcoming volatility or mean reversion. Facilitating the identification of outliers was my main purpose when creating this tool, I believed fixed values for upper/lower bounds within most indicators are too static and do not dynamically fit the vastly different movements of all assets and timeframes - and being able to easily understand the spread of information simplifies the process of identifying key regions to take action.
The curve's tails, representing the extreme percentiles, can help identify outliers and potential areas of price reversal or trend acceleration. For example using the RSI which typically has static levels of 70 and 30, which will be breached considerably more on a less liquid or more volatile asset and therefore reduce the actionable effectiveness of the indicator, likewise for an asset with little to no directional volatility failing to ever reach this overbought/oversold areas. It makes considerably more sense to look for the top/bottom 5% or 10% levels of outlying data which are automatically calculated with this indicator, and may be a noticeable distance from the 70 and 30 values, as regions to be observing for your investing.
This normal distribution curve employs percentile linear interpolation to calculate the distribution. This interpolation technique considers the nearest data points and calculates the price values between them. This process ensures a smooth curve that accurately represents the probability distribution, even for percentiles not directly present in the original dataset; and applicable to any asset regardless of timeframe. The lookback period is set to a value of 5000 which should ensure ample data is taken into calculation and consideration without surpassing any TradingView constraints and limitations, for datasets smaller than this the indicator will adjust the length to just include all data. The labels providing the percentile and average levels can also be removed in the style tab if preferred.
Additionally, as an unplanned benefit is its applicability to the underlying price data as well as any derived indicators. Turning it into something comparable to a volume profile indicator but based on the time an assets price was within a specific range as opposed to the volume. This can therefore be used as a tool for identifying potential support and resistance zones, as well as areas that mark market inefficiencies as price rapidly accelerated through. This may then give a cleaner outlook as it eliminates the potential drawbacks of volume based profiles that maybe don't collate all exchange data or are misrepresented due to large unforeseen increases/decreases underlying capital inflows/outflows.
Thanks to @ALifeToMake, @Bjorgum, vgladkov on stackoverflow (and possibly some chatGPT!) for all the assistance in bringing this indicator to life. I really hope every user can find some use from this and help bring a unique and data driven perspective to their decision making. And make sure to please share any original implementaions of this tool too! If you've managed to apply this to the average price change once you've entered your position to better manage your trade management, or maybe overlaying on an implied volatility indicator to identify potential options arbitrage opportunities; let me know! And of course if anyone has any issues, questions, queries or requests please feel free to reach out! Thanks and enjoy.
[TTI] Minervini STEM Model📜 ––––HISTORY & CREDITS 🏦
Introducing the Minervini STEM Model, an innovative indicator developed by Mark Minervini, an experienced trader and author renowned for his expertise in gauging the quality of breakouts. The Stock Tactical Environment Model (STEM) is designed to assess the trading environment based on the performance and setup of stocks, helping traders navigate various market conditions with ease.
🎯 ––––WHAT IT DOES 💡
The Minervini STEM Model measures the quality of breakouts in the stock market and provides valuable insights into the trading environment. The model is subjective based on the performance of the Mark Minervini Focus List on a 5 day rolling basis.
• What is the Mark Minervini Focus List?
- This is a private weekly watchlist of all the best setups provided by Mark Minervini in his Private Access Group
• How is the quality of breakouts measured?
- This is the subjective part of the indicator. A good breakout is one that has definite clear of a pivot, with a good close and strong volume. From then on there are strong follow through buys (consecutive up days with new highs) again with good (above average) volume signatures. When stocks start moving in earnest and together and breakouts happen with quality technical characteristics and keep on holding the new highs, then we have a good quality breakouts, otherwise if there are 'pop and drops' (breakout met with subsequent selling on the next days) - we have a bad quality breakouts.
• What is the 5 day rolling basis?
- As part of the methodology, I have included, how are the watchlist (Focus List) is performing on subsequent on the next 5 days. This means if we have 10 stocks on Friday, how many did close up in the following 5 days, do we have improvement compared to the previous week and the week before that, is there an overall trend of stocks gaining value or not. This also measures the quality of the bearjouts
🚨IMPORTANT! The model is largely subjective based on the various factors. Largely, I look at Mark Minervini's focus list and determine how it is performing on a 5 day rolling basis. Depending on how many of the Focus List stocks are closing down for the 5 day period (e.g. less than 60%) and how are all cumulatively performing, I adjust the model. It generates three distinct color-coded signals to indicate the effectiveness of breakouts and the overall market condition:
Color meanings
🟩Green: Breakouts are working well, indicating an easy dollar environment.
🟨Orange: The market is selective or highly rotational, signalling a need for caution.
🟥Red: Breakouts are not working well, suggesting a hard penny environment and high risk.
This color-coded system allows traders to quickly assess the market's health and adjust their trading strategies accordingly.
🛠️ ––––HOW TO USE IT 🔧
To effectively use the Minervini STEM Model, follow these steps:
1.Load the Minervini STEM Model script into your preferred charting platform.
2.Observe the color-coded signals displayed on your chart.
Interpret the signals as follows:
🟩Green: Breakouts are working well. Consider aggressive trading and increasing exposure.
🟨Orange: The market is selective or highly rotational. Exercise caution when trading and be selective with your stock setups.
🟥Red: Breakouts are not working well, and risk is high. Adopt maximum caution and consider reducing exposure or staying small until you gain traction.
By incorporating the Minervini STEM Model into your trading strategy, you can better gauge the quality of breakouts and the overall market condition, enabling you to make informed decisions on your trades. Remember to use this tool in conjunction with other technical indicators and risk management practices to optimize your success.
Harmonic Sine Waves model plot Hey,
Here is another tool that I created. I could not find anything similar.
This script is creating a sine wave, based on the given length, amplitude, horizontal vertical offset.
After this it plots also nearest harmonics to the base sine wave and draws it on the chart.
At the last step it sums up the value for base sine wave with its harmonics.
This is a great way to experience how 4 basic sine waves, when summed up, are creating more complex chart.
This shows that the 'chaotic' chart can be built on just a few most important factors.
You do not have to "know every single fact" about the asset to make a proper forecast.
You just need those most important.
It is crucial though, to offset the chart in a correct way, so it is in phase with the asset that we work on.
FunctionBlackScholesLibrary "FunctionBlackScholes"
Some methods for the Black Scholes Options Model, which demonstrates several approaches to the valuation of a European call.
// reference:
// people.math.sc.edu
// people.math.sc.edu
asset_path(s0, mu, sigma, t1, n) Simulates the behavior of an asset price over time.
Parameters:
s0 : float, asset price at time 0.
mu : float, growth rate.
sigma : float, volatility.
t1 : float, time to expiry date.
n : int, time steps to expiry date.
Returns: option values at each equal timed step (0 -> t1)
binomial(s0, e, r, sigma, t1, m) Uses the binomial method for a European call.
Parameters:
s0 : float, asset price at time 0.
e : float, exercise price.
r : float, interest rate.
sigma : float, volatility.
t1 : float, time to expiry date.
m : int, time steps to expiry date.
Returns: option value at time 0.
bsf(s0, t0, e, r, sigma, t1) Evaluates the Black-Scholes formula for a European call.
Parameters:
s0 : float, asset price at time 0.
t0 : float, time at which the price is known.
e : float, exercise price.
r : float, interest rate.
sigma : float, volatility.
t1 : float, time to expiry date.
Returns: option value at time 0.
forward(e, r, sigma, t1, nx, nt, smax) Forward difference method to value a European call option.
Parameters:
e : float, exercise price.
r : float, interest rate.
sigma : float, volatility.
t1 : float, time to expiry date.
nx : int, number of space steps in interval (0, L).
nt : int, number of time steps.
smax : float, maximum value of S to consider.
Returns: option values for the european call, float array of size ((nx-1) * (nt+1)).
mc(s0, e, r, sigma, t1, m) Uses Monte Carlo valuation on a European call.
Parameters:
s0 : float, asset price at time 0.
e : float, exercise price.
r : float, interest rate.
sigma : float, volatility.
t1 : float, time to expiry date.
m : int, time steps to expiry date.
Returns: confidence interval for the estimated range of valuation.
vix_vx_regressionAn example of the linear regression library, showing the regression of VX futures on the VIX. The beta might help you weight VX futures when hedging SPX vega exposure. A VX future has point multiplier of 1000, whereas SPX options have a point multiplier of 100. Suppose the front month VX future has a beta of 0.6 and the front month SPX straddle has a vega of 8.5. Using these approximations, the VX future will underhedge the SPX straddle, since (0.6 * 1000) < (8.5 * 100). The position will have about 2.5 ($250) vega. Use the R^2 (coefficient of determination) to check how well the model fits the relationship between VX and VIX. The further from one this value, the less useful the model.
(Note that the mini, VXM futures also have a 100 point multiplier).
Ripple (XRP) Model PriceAn article titled Bitcoin Stock-to-Flow Model was published in March 2019 by "PlanB" with mathematical model used to calculate Bitcoin model price during the time. We know that Ripple has a strong correlation with Bitcoin. But does this correlation have a definite rule?
In this study, we examine the relationship between bitcoin's stock-to-flow ratio and the ripple(XRP) price.
The Halving and the stock-to-flow ratio
Stock-to-flow is defined as a relationship between production and current stock that is out there.
SF = stock / flow
The term "halving" as it relates to Bitcoin has to do with how many Bitcoin tokens are found in a newly created block. Back in 2009, when Bitcoin launched, each block contained 50 BTC, but this amount was set to be reduced by 50% every 210,000 blocks (about 4 years). Today, there have been three halving events, and a block now only contains 6.25 BTC. When the next halving occurs, a block will only contain 3.125 BTC. Halving events will continue until the reward for minors reaches 0 BTC.
With each halving, the stock-to-flow ratio increased and Bitcoin experienced a huge bull market that absolutely crushed its previous all-time high. But what exactly does this affect the price of Ripple?
Price Model
I have used Bitcoin's stock-to-flow ratio and Ripple's price data from April 1, 2014 to November 3, 2021 (Daily Close-Price) as the statistical population.
Then I used linear regression to determine the relationship between the natural logarithm of the Ripple price and the natural logarithm of the Bitcoin's stock-to-flow (BSF).
You can see the results in the image below:
Basic Equation : ln(Model Price) = 3.2977 * ln(BSF) - 12.13
The high R-Squared value (R2 = 0.83) indicates a large positive linear association.
Then I "winsorized" the statistical data to limit extreme values to reduce the effect of possibly spurious outliers (This process affected less than 4.5% of the total price data).
ln(Model Price) = 3.3297 * ln(BSF) - 12.214
If we raise the both sides of the equation to the power of e, we will have:
============================================
Final Equation:
■ Model Price = Exp(- 12.214) * BSF ^ 3.3297
Where BSF is Bitcoin's stock-to-flow
============================================
If we put current Bitcoin's stock-to-flow value (54.2) into this equation we get value of 2.95USD. This is the price which is indicated by the model.
There is a power law relationship between the market price and Bitcoin's stock-to-flow (BSF). Power laws are interesting because they reveal an underlying regularity in the properties of seemingly random complex systems.
I plotted XRP model price (black) over time on the chart.
Estimating the range of price movements
I also used several bands to estimate the range of price movements and used the residual standard deviation to determine the equation for those bands.
Residual STDEV = 0.82188
ln(First-Upper-Band) = 3.3297 * ln(BSF) - 12.214 + Residual STDEV =>
ln(First-Upper-Band) = 3.3297 * ln(BSF) – 11.392 =>
■ First-Upper-Band = Exp(-11.392) * BSF ^ 3.3297
In the same way:
■ First-Lower-Band = Exp(-13.036) * BSF ^ 3.3297
I also used twice the residual standard deviation to define two extra bands:
■ Second-Upper-Band = Exp(-10.570) * BSF ^ 3.3297
■ Second-Lower-Band = Exp(-13.858) * BSF ^ 3.3297
These bands can be used to determine overbought and oversold levels.
Estimating of the future price movements
Because we know that every four years the stock-to-flow ratio, or current circulation relative to new supply, doubles, this metric can be plotted into the future.
At the time of the next halving event, Bitcoins will be produced at a rate of 450 BTC / day. There will be around 19,900,000 coins in circulation by August 2025
It is estimated that during first year of Bitcoin (2009) Satoshi Nakamoto (Bitcoin creator) mined around 1 million Bitcoins and did not move them until today. It can be debated if those coins might be lost or Satoshi is just waiting still to sell them but the fact is that they are not moving at all ever since. We simply decrease stock amount for 1 million BTC so stock to flow value would be:
BSF = (19,900,000 – 1.000.000) / (450 * 365) =115.07
Thus, Bitcoin's stock-to-flow will increase to around 115 until AUG 2025. If we put this number in the equation:
Model Price = Exp(- 12.214) * 114 ^ 3.3297 = 36.06$
Ripple has a fixed supply rate. In AUG 2025, the total number of coins in circulation will be about 56,000,000,000. According to the equation, Ripple's market cap will reach $2 trillion.
Note that these studies have been conducted only to better understand price movements and are not a financial advice.
vol_bracketThis simple script shows an "N" standard deviation volatility bracket, anchored at the opening price of the current month, week, or quarter. This anchor is meant to coincide roughly with the expiration of options issued at the same interval. You can choose between a manually-entered IV or the hv30 volatility model.
Unlike my previous scripts, which all show the volatility bracket as a rolling figure, the anchor helps to visualize the volatility estimate in relation to price as it ranges over the (approximate) lifetime of a single, real contract.
[e2] Fourier series Model Of The MarketFourier series Model Of The Market
John F. Ehlers
TASC Jun 2019
SMA Stochastic ForecastThis tool uses a discrete-time non-Markovian Martingale stochastic process (Please do not confuse with the strategy of the same name) under the hood to forecast a future (up to 28 bars, customizable) behaviour of the Simple Moving Average. The longer the average period, the more accurate the forecast.
The common cases are the next:
You can apply two instances of this indicator to your chart to obtain a crossover forecast
You can decrease an interval between forecasts to obtain a bunch of possible traectories
Decreasing a forecast interval for two instances, you will get the Kraken
This is the further improvement of my research work on forecasting
Mr. @syrinxflunki was the only one who provided a clear and useful feedback after testing, so he get a free lifetime access. I respect a fair play.
If you have any questions you can concat me via private messages.
Good luck.
Random Walk SimulationUnderstanding the Random Walk Simulation
This indicator randomly generates alternative price outcomes derived from the price movements of the underlying security. Monte Carlo methods rely on repeated random sampling to create a data set that has the same characteristics as the sample source, representing examples of alternate outcomes. The data set created using random sampling is called a “random walk”.
First, every bar in the time stamp is measured and put into a logarithmic population. Then, a sample is drawn at random from the population and is used to determine the next price movement of the random walk. This process is repeated fifteen times to visualise whether the alternative outcomes lie above or beneath the current market price of the security.
Random Walk Utility
The random walk generator allows users of the Monte Carlo to further understand how the Monte Carlo projection is generated by creating a visual representation of individual random walks. Trends that occur on the random walks may correlate to the historical price action of the underlying security.
You can find the Monte Carlo Simulator here:
Input Values
Select the “ Format ”, button located next to the indicator label to adjust the input values and the style.
The Random Walk indicator only has one user-defined input value that can be changed.
The Random_Variable randomises a set of random walks. If this variable is changed, it will run a fresh set of 15 random walks which will result in a slightly different outcome.
Adding the indicator to your chart multiple times using many different random variables will allow you to achieve a more accurate reading. Ideally, the Monte Carlo Simulator takes an average of these to be interpreted.
For more information on this indicator, the full PDF can be found here: www.kenzing.com