Comments (9)
thenx man i add my indicators file...that is corrrect results...thank you for help....
#117 I hope I could help..
from technical.
If you think an indicator is wrong and you have a fix, please open a pull request submitting the fix (please with sample code/screenshots showing missalignment / new alignment with tradingview).
Please understand that i'll not be extracting code from issue comments - which will have me repeat the work you already did (compare it with tradingview, ...).
from technical.
I guess the following should work:
def VIDYA(dataframe, length=9, select=True):
"""
Source: https://www.tradingview.com/script/64ynXU2e/
Author: Tushar Chande
Pinescript Author: KivancOzbilgic
To achieve the goals, the indicator filters out the market fluctuations (noises)
by averaging the price values of the periods, over which it is calculated.
In the process, some extra value (weight) is added to the average prices,
as it is done during calculations of all weighted indicators, such as EMA , LWMA, and SMMA.
But during the VIDIYA indicator's calculation, every period's price
receives a weight increment adapted to the current market's volatility .
select: True = CMO, False= StDev as volatility index
usage:
dataframe['VIDYA'] = VIDYA(dataframe)
"""
df = dataframe.copy()
alpha = 2 / (length + 1)
df['momm'] = df['close'].diff()
df['m1'] = np.where(df['momm'] >= 0, df['momm'], 0.0)
df['m2'] = np.where(df['momm'] >= 0, 0.0, -df['momm'])
df['sm1'] = df['m1'].rolling(length).sum()
df['sm2'] = df['m2'].rolling(length).sum()
df['chandeMO'] = 100 * (df['sm1'] - df['sm2']) / (df['sm1'] + df['sm2'])
if select:
df['k'] = abs(df['chandeMO']) / 100
else:
df['k'] = df['close'].rolling(length).std()
df.fillna(0.0, inplace=True)
df['VIDYA'] = 0.0
for i in range(length, len(df)):
df['VIDYA'].iat[i] = alpha * df['k'].iat[i] * df['close'].iat[i] + (1 - alpha * df['k'].iat[i]) * df['VIDYA'].iat[i-1]
return df['VIDYA']
I'm no expert in pinescript though - so please help me validate this so we can add it to technical in the future.
from technical.
thanks buddy i will try and inform you about it works properly...
I hope you took a look at my other indicator posts..
i checked it and they are working properly
supertrend , MADR , VWMACD , RMI ... and the others.. @xmatthias
from technical.
oh well, you bet (RMI + VWMACD + TKE are in #117) 👍
from technical.
Thanks for the feedback, added it to #117 too.
from technical.
hi, indicator calculation does not match tradingview.
I found a code that works correctly.
However, I am a beginner in python. I can't give you ready code.
from technical.
well the link is for a completely different indicator (OTT) - so i'm not sure how that comment is relevant here.
from technical.
Thank you for the answer.
There is no error in the link. Calculating "vidya" in OTT indicator. Written as df['var'] in the code.
I took the relevant part in the code of the OTT indicator and tried to make it usable. The results are the same as with Tradindview.
def vidya (dataframe=df, length = 4, source="close"):
alpha = 2 / (length + 1)
df['ud1'] = np.where(df[source] > df[source].shift(1), (df[source] - df[source].shift()), 0)
df['dd1'] = np.where(df[source] < df[source].shift(1), (df[source].shift() - df[source]), 0)
df['UD'] = df['ud1'].rolling(9).sum()
df['DD'] = df['dd1'].rolling(9).sum()
df['CMO'] = ((df['UD'] - df['DD']) / (df['UD'] + df['DD'])).fillna(0).abs()
df['Var'] = 0.0
for i in range(length, len(df)):
df['Var'].iat[i] = (alpha * df['CMO'].iat[i] * df[source].iat[i]) + (1 - alpha * df['CMO'].iat[i]) * \
df['Var'].iat[
i - 1]
# print("vidya indicator\n", df['Var'])
return df['Var']
vidya ()
from technical.
Related Issues (20)
- Trend Step Channel - appreciate it HOT 4
- resample_to_interval date shifted HOT 1
- Help with Trend Trader Strategy HOT 1
- ichimoku different value proposal HOT 1
- How to import external data to populate entry/exit trend conditions HOT 14
- Multiple timeframe merge HOT 10
- Laguerre RSI wrong computation HOT 3
- ```crossed``` function throws error with numpy integers
- utils bug HOT 4
- How to plot segtrends or gentrends using freqtrade plot-dataframe ? HOT 1
- Phase Change Index HOT 18
- I try to convert Predictive Ranges [LuxAlgo] to the py, whats the problem? HOT 7
- Involvement of Heikenashi candles could be helpful in trend prediction HOT 1
- Help needed with: AttributeError: 'SSL' object has no attribute 'copy' HOT 3
- warning util.py
- 16 tests failed HOT 4
- Pandas warning when setting fillna(0) on RMI calc HOT 2
- Issues with PMAX indicator HOT 1
- A few Pinescript lines HOT 2
- Error thrown at numpy_rolling_window HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from technical.