The Upperband is calculated: Middleband + (D + sqrt(((close - Middle band)^2)/n))
And I know how to calculate the lower bollinger band and middle bollinger bands.
But there is an elusive indicator called the bollinger oscillator which I find combines the bollinger bands into a single oscillating indicator. Please explain how to calculate it.
Use SQL if possible assume fields contain relevant values.
Find the 9-day moving average average (n1 + n2 ... + n9)/9
Find the standard deviation of the 9-days
Subtract 9-day Moving average from the current ruling price
Take the answer devide by the standard deviation
Answer is the BOS (Bollinger Oscillator)
Related
I try to calculate the mass of the component stars in a binary system.
I only have the period and the largest and smallest distance between them and know how to use them to get the total mass.
To my knowledge, I think I need the distance from one of the stars to the barycenter.
Is that possible to calculate each mass of the component members with this information?
Thank you for your help!
I think, if you only have the period T and the largest a_max and smallest a_min distance between the two stars, as you pointed out, you can calculate the total mass, using the formula
mass_1 + mass_2 = (2*pi / T)^2 * ((a_min + a_max)^3 / G)
However, you cannot calculate the individual masses solely from this information, because the prescribed data, the period T and the largest a_max and smallest a_min distance, are for the relative postion of the stars, not the individual.
What do I mean. Assume you have two stars whose motion has the parameters given above. Then, by Newtonian mechanics, let us assume your coordinate system is placed at the barycenter and if you denote the position vectors r1 and r2 pointing from the barycenter to the respective stars, then, the equations of motion are
(d/dt)^2 r1 = - ( mass_2*G / |r2 - r1|^3 )*(r1 - r2)
(d/dt)^2 r2 = - ( mass_1*G / |r2 - r1|^3 )*(r2 - r1)
If you subtract the first vector differential equation from the second, and you set r = r2 - r1, you obtain the vector differential equation (3 scalar differential equations and 3 scalar variables, the 3D coordinates of the relative position vector r)
(d/dt)^2 r = - ( (mass_1 + mass_2)*G / |r|^3 ) * r
This is the classical vector differential equation that describes the time-evolution of the relative position vector r between the two stars. The information you have, the period T and the largest a_max and smallest a_min, can be used to find a specific solution to the last equation above, the one for r, which gives you the relative motion r = r(t) between the two stars with the prescribed properties. However, the motion of any pair of stars with arbitrary masses mass_1 and mass_2, that sum up to the same value mass_1 + mass_2, will provide a solution to the vector differential equation
(d/dt)^2 r = - ( (mass_1 + mass_2)*G / |r|^3 ) * r
and among all such solution there will be some that posses the desired properties: period T and the largest a_max and smallest a_min. Observe that T, a_min and a_max are properties of the vector r and not so much properties of the individual r1 and r2, which tells you that you cannot find the individual masses.
I am trying to calculate the slope of the line for a 50 day EMA I created from the adjusted closing price on a few stocks I downloaded using the getSymbols function.
My EMA looks like this :
getSymbols("COLUM.CO")
COLUM.CO$EMA <- EMA(COLUM.CO[,6],n=50)
This gives me an extra column that contains the 50 day EMA on the adjusted closing price. Now I would like to include an additional column that contains the slope of this line. I'm sure it's a fairly easy answer, but I would really appreciate some help on this. Thank you in advance.
A good way to do this is with rolling least squares regression. rollSFM does a fast and efficient job for computing the slope of a series. It usually makes sense to look at the slope in relation to units of price activity in time (bars), so x can simply be equally spaced points.
The only tricky part is working out an effective value of n, the length of the window over which you fit the slope.
library(quantmod)
getSymbols("AAPL")
AAPL$EMA <- EMA(Ad(AAPL),n=50)
# Compute slope over 50 bar lookback:
AAPL <- merge(AAPL, rollSFM(Ra = AAPL[, "EMA"],
Rb = 1:nrow(AAPL), n = 50))
The column labeled beta contains the rolling window value of the slope (alpha contains the intercept, r.squared contains the R2 value).
what is the denominator in average rating of a user in Adjusted cosine similarity? (Item Based Collaborative Filtering)
Is it number all Items in system?? Or Just number of rated items by user??
and
is there a function in MatLab for Adjusted Cosine?
thanks
Question 1: Is it number all Items in system?? Or Just number of rated items by
user??
Answer 1: Neither
If you see this formula:
in the denominator you need to calculate the rooted sum for each Rating of user u for item i minus the average rating of this User (mean rating) and this subtraction is squared then it is the same thing for item j which you have to multiply together.
Question 2: is there a function in MatLab for Adjusted Cosine?
Answer 2: By default no. But it should be relatively easy to write it your self given that you have the formula.
I want to calculate average speed of the distance traveled using gps signals.
Is this formula calculates correct avg speed?
avgspeed = totalspeed/count
where count is the no.of gps signals.
If it is wrong,please any one tell me the correct formula.
While that should work, remember that GPS signals can be confused easily if you're in diverse terrain. Therefore, I would not use an arithmetic mean, but compute the median, so outliers (quick jumps) would not have such a big effect on the result.
From Wikipedia (n being the number of signals):
If n is odd then Median (M) = value of ((n + 1)/2)th item term.
If n is even then Median (M) = value of [((n)/2)th item term + ((n)/2
+ 1)th item term ]/2
http://lucene.apache.org/java/2_3_0/api/org/apache/lucene/misc/SweetSpotSimilarity.html
Implemented as: 1/sqrt( steepness * (abs(x-min) + abs(x-max) - (max-min)) + 1 ) .
This degrades to 1/sqrt(x) when min and max are both 1 and steepness is 0.5
Can anyone explain this formula for me? How steepness is decided and what is exactly referring to?
Any help is appreciated.
With the DefaultSimilarity, the shorter the field in terms of number of tokens, the higher the score.
e.g. if you have two docs, with indexed field values of "the quick brown fox" and "brown fox", respectively, the latter would score higher in a query for "fox".
SweetSpotSimilarity lets you define a "sweet spot" for the length of a field in terms of a range defined by min and max. Field lengths within the range will score equally, and field lengths outside the range will score lower, depending on the distance the length is form the range boundary. "steepness" determines how quickly the score degrades as a function of distance.