Particle Physics Moving AverageThis indicator simulates the physics of a particle attracted by a distance-dependent force towards the evolving value of the series it's applied to.
Its parameters include:
The mass of the particle
The exponent of the force function f=d^x
A "medium damping factor" (viscosity of the universe)
Compression/extension damping factors (for simulating spring-damping functions)
This implementation also adds a second set of all of these parameters, and tracks 16 particles evenly interpolated between the two sets.
It's a kind of Swiss Army Knife of Moving Average-type functions; For instance, because the position and velocity of the particle include a "historical knowlege" of the series, it turns out that the Exponential Moving Average function simply "falls out" of the algorithm in certain configurations; instead of being configured by defining a period of samples over which to calculate an Exponential Moving Average, in this derivation, it is tuned by changing the mass and/or medium damping parameters.
But the algorithm can do much more than simply replicate an EMA... A particle acted on by a force that is a linear function of distance (force exponent=1) simulates the physics of a sprung-mass system, with a mass-dependent resonant frequency. By altering the particle mass and damping parameters, you can simulate something like an automobile suspension, letting your particle track a stock's price like a Cadillac or a Corvette (or both, including intermediates) depending on your setup. Particles will have a natural resonance with a frequency that depends on its mass... A higher mass particle (i.e. higher inertia) will resonate at a lower frequency than one with a lower mass (and of course, in this indicator, you can display particles that interpolate through a range of masses.)
The real beauty of this general-purpose algorithm is that the force function can be extended with other components, affecting the trajectory of the particle; For instance "volume" could be factored into the current distance-based force function, strengthening or weakening the impulse accordingly. (I'll probably provide updates to the script that incoroprate different ideas I come up with.)
As currently pictured above, the indicator is interpolating between a medium-damped EMA-like configuration (red) and a more extension-damped suspension-like configuration (blue).
This indicator is merely a tool that provides a space to explore such a simulation, to let you see how tweaking parameters affects the simulations. It doesn't provide buy or sell signals, although you might find that it could be adapted into an MACD-like signal generator... But you're on your own for that.
Physics
Diego Riobo Cabot's Force Indicator Diego Riobo Cabot
© riobocabotd
Analysing the Market as Physical Forces
Credits First:
Tradingview Pine Comunity, it's just amazing, honestly.
Godmode Indicator's creators. I was inspired by them to create an indicator that takes a lot of variables into account. I also took the idea of the Momentum and LSMA from there
Function te get volume from lower tf was taken from a post in stack overflow. So, credits to you, anonymous hero.
Let's get to it:
so... What is this thing, exactly?
I wanted to measure the market's upward and downard force, in order to calculate the resulting force. Just as a curiosity.
At the end, I got a pretty decent indicator in my hands and I'd like to share it with you guys.
The main goal was to apply basic rules of physics: Velocity, Acceleration, Mass and Force (We could go further if we wanted, such as Impulse, Quantity of Movement, Impact and so on)
Everything appart from mass is a vector, meaning it has a direcction and a magnitude. Each of them were decompossed in upwards and downwards direction
Nevertheless I pictured this Analysis as a "fight" between two teams the Bulls and the Bears (Buyers and Sellers). So I measured two masses: Bulls (+) and Bears(-)
Glossary (internal Clockwork)
° Velocity: Is the ratio between a travelled distance and the time that took to travel it.
+ Upwards Velocity (v_up): Meausures if current source is higher than the previous and stores this value. Has positive values
+ Downwards Velocity (v_dn): Meausures if current source is lower than the previous and stores this value. Has negative values
+ Both vectors are averaged using the rma function (same average type used in the RSI)
+ The length of this average is called length_v: "Lookback - Velocity"
+ Resultant Velocity (v_av): The sum of the averaged v_up and v_dn, since they have equally opposite directions, there's no need for a vectorial sum.
+ Velocity Index (v_in): It's an index between +100% and -100%. Meausures where v_av stands in relation to high (v_up) and low (v_dn). Not used for calculations, but I'll leave it there for further research
° Acceleration: Meausures the rate of change of velocity during time. Since we already have the velocity calculated, it's pretty straight forward
+ Upwards Vel increase (v_up_up): Stores positive variations of upwards' velocity.
+ Upwards Vel decrease (v_up_dn): Stores negative variations of upwards' velocity.
+ Downwards Vel increase (v_dn_up): Stores positive variations of downwards' velocity.
+ Downwards Vel decrease (v_dn_dn): Stores negative variations of downwards' velocity.
+ Upwards Accel. (a_up): v_up_up + v_dn_up
+ Downwards Accel. (a_dn): v_up_dn + v_dn_dn
+ Resultant Accel. (a_av): a_up + a:dn Not used, is there for further research
° Mass: Measures the volume of operations. How much asset is bougth (Bull) or sold (bears).
+ Mass is measured from a lower timeframe. It checks if the candles are Bullish or Bearish (Could be done with closing prices, or typical price)
+ The Lower Timeframe is determined in minutes throught the input variable "Lower Timeframe"
+ Bull mass (vol_up): Total bullish volume in the lower timeframe, for the current candle period
+ Bear mass (vol_dn): Total bearish volume in the lower timeframe, for the current candle period
+ Neutral mass (vol_nt): Total neutral volume in the lower timeframe. (Buy price = Open price) Not used for calculations. Could be used for resistance points?
+ Resultant mass (vol_av): |vol_up - vol_dn|
+ Total mass (vol_tt): Sum of all masses (Just the total volume)
° Force: It's nothing else than mass * acceleration
+ Upwards Force (f_up): vol_up * a_up Bulls mass * Positive Acceleration
+ Downwards Force (f_dn): vol_dn * a_dn Bears mass * Negative Acceleration.
+ Resultant Force (f_av): f_up + f_dn Not used, is there for further research
° Force Index
+ Upwards Channel (fi_up)
+ Downwards Channel (fi_dn)
+ Both vectors are averaged using the rma function (same average type used in the RSI)
+ The length of this average is called length_v: "Lookback - Force"
+ Raw Index (fi_rw): It's an index between +100% and -100%. Meausures where f_av stands in relation to high (f_up) and low (f_dn).
+ Index (fi_in): It's the averaged raw index using the rma function and the "Force Index Smoothing" period
+ Signal (fi_sg): It's the averaged fi_in using the rma function and the "Force Signal Smoothing" period
+ Momentum (fi_mo): fi_in - f_sg. If the momentum is higher than the current force direction, current force should be outwon by previos market trend. It's Smoothed out using the "Force Momentum Lookback"
+ Trend (fi_tr): It's a linear regression of fi_in using a very long period (Force Trend Lookback)
Okay... sure, but how do I use it?
° It is very similar to how the GodMode 3.2 indicator works actually, so if you're familiar with it, you can start trying this indicator out. I've noticed it can provide a bit more timely signals
° It's also similar to Stochastics or RSI indices... but with three lines. an instantaneous one (Force - Blue), an averaged one (Signal - Orange) and a slow one (Trend - Green)
° Bullish/Bearish momentum: Trendline (green) above 0% means Bullish. Above 12% means a trend wants to form and if it reaches 40% means the strend is super strong (Bitcoin like, strong). The opposite goes for bearish trends (values under 0)
° Line crossings: Instant Force Line (Blue) crosses over the Signal Line (Orange), while the orange is going slightly down or flat under the -12%: Means a long signal. The opposite applies for the Short signals
° Line crossings: Same as above, but when the Signal crosses over the Trend Line (Green)
° Reversals: The background columns are supposed to immitate the "Inertia" of movement. If inertia's bars are higher (when positive) or lower (when negative) than the Force Line (Blue), then it means that the current force the market is making, is probably weaker (at that time) than the inertia the market carries with it.
Tips:
° If you wen't long, the orange line is going slightly down, but it's over +12%, it means the bullish trend is still going, although not as strong as before. You could keep your long position. The reverse applies for short.
Escape VelocityThis script is meant to calculate the Escape Velocity from the mean. According to Investopedia "Mean reversion is theory used in finance that suggests that asset prices and historical returns eventually return back to the long-run mean or average level of the entire data set."
Escape Velocity is the lowest velocity which a body must have in order to escape the gravitational attraction of a particular planet or other object, in this case the mean. It is recommended that you use a moving average with the same length as the ones that you decide to use for this indicator.
Escape Velocity= sqrt((2*Gravitational Constant * Mass)/Distance from the mean)
The Escape Velocity is in red and the velocity of price is in green. When price velocity (green) is positive and greater and than escape velocity (red) and price is above the mean, this would indicate that price is breaking away from the mean (bullish). When price velocity is negative and less than escape velocity and price is below the mean, this would indicate that price is breaking away from the mean (bearish).
Newton's Gravitational ForceThis Script is meant to apply Newton's equation for Gravitational Force onto the Financial Markets.
FGrav=Gravitational Constant * (Mass1*Mass2)/(Distance between the two objects' center of mass^2)
This script could be used to identify periods of technical market weakness, when the gravitational force becomes negative.
Newton Force and MomentumThis indicator is meant to show the Force of price, based on Newton's Second Law of Motion; and the momentum of price. Force is the value on the left, and momentum on the right.
Originally this was supposed to only be an indicator looking at Force, but because the already popular indicator called "Momentum" does not calculate the momentum of price, but rather the change of price depending on how far back you want to look; I decided to add the Momentum aspect to the indicator.
*BTW if you find this script useful thank and follow @overttherainbow, because they are the one who gave me the idea for this script.*
Mathematical Derivatives of PriceThis indicator is meant to show the Velocity (1st order derivative), Acceleration (2nd order derivative), Jerk (3rd order derivative), Snap (4th order derivative), Crackle (5th order derivative), & Pop (6th order derivative) of price. The values at the top of the indicator window are in this order from left to right. I don't particularly know how this would be used in a trading strategy, but if you're ever curious about how quickly price is moving and how much it is accelerating, then you could use this tool.
*If you only care about velocity and acceleration, and don't like how squished the window is because of the long decimal numbers then edit the "precision" value in the first line of the script to a smaller number of your choosing.*
B3 Volume Weighted MomentumB3 VWM is a momentum indicator that responds to the change of price in relationship to volume. In the end the final formula is the classic physics test question of p=mv where p is momentum, m is mass and v is velocity. In this indicator mass is the amount of volume it took to move the price where it did, and velocity is the change in price expressed as a percentage of the bar range. Then, the indicator goes through some filtering to help display the line. Should appear with very little lag work it to find the perfect bar for reversals.
This can be thought of as directional volume times directional momentum index, but truly it is not these literally, as the script doesn't discern how many contracts flew to the bid or to the ask for separation. So with this momentum indicator you can hopefully get a feel of the volume flow, yet still use this like a traditional momentum oscillator. Look to hit the reversals at peaks, and use caution when trading longs when this indicator is negative, and vise versa. There can be divergence in this oscillator, and you can help remedy poor divergences by adjusting the smoothness or the flatness of the indicator to suit your chart. Also the dead zone and mid zone are likely in need of adjustments depending on volume flow and price changes for that symbol and resolution. Defaults are a great starting point for most charts 5m to day. Swing traders might enjoy a length of 8-10 to rid some quick changes of direction in the indicator. Love to have things like this up with pivot studies for level reversal entries, like the few on the shared oil chart.
Enjoy, and I hope you like some of my other proprieties too. Feel free to comment! ~B3