TRON / TetherUS

Test

158
import pandas as pd

def ichimoku(df):
# Calculate the Ichimoku components
high_9 = df['High'].rolling(window=9).max()
low_9 = df['Low'].rolling(window=9).min()
df['Tenkan-sen'] = (high_9 + low_9) / 2 # Conversion Line

high_26 = df['High'].rolling(window=26).max()
low_26 = df['Low'].rolling(window=26).min()
df['Kijun-sen'] = (high_26 + low_26) / 2 # Base Line

df['Senkou Span A'] = ((df['Tenkan-sen'] + df['Kijun-sen']) / 2).shift(26) # Leading Span A
df['Senkou Span B'] = ((df['High'].rolling(window=52).max() + df['Low'].rolling(window=52).min()) / 2).shift(26) # Leading Span B

df['Chikou Span'] = df['Close'].shift(-26) # Lagging Span

return df

# Example usage:
# df = pd.read_csv('your_data.csv') # Load your data
# df = ichimoku(df)
# print(df[['Tenkan-sen', 'Kijun-sen', 'Senkou Span A', 'Senkou Span B', 'Chikou Span']])

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.