0 Bu tabloyu alın Bu tabloyu alın import numpy as np import pandas as pd import matplotlib.pyplot as plt # Define the technical indicators. def macd(close, fast_period=12, slow_period=26, signal_period=9): """ Calculate the MACD. Args: close (pandas.Series): The closing prices. fast_period (int): The fast period. slow_period (int): The slow period. signal_period (int): The signal period. Returns: pandas.Series: The MACD. """ ema_fast = close.ewm(span=fast_period, adjust=False).mean() ema_slow = close.ewm(span=slow_period, adjust=False).mean() macd = ema_fast - ema_slow signal = macd.ewm(span=signal_period, adjust=False).mean() return macd, signal def rsi(close, period=14): """ Calculate the RSI. Args: close (pandas.Series): The closing prices. period (int): The period. Returns: pandas.Series: The RSI. """ delta = close.diff() up = delta.clip(lower=0) down = -delta.clip(upper=0) ema_up = up.ewm(span=period, adjust=False).mean() ema_down = down.ewm(span=period, adjust=False).mean() rsi = 100 * ema_up / (ema_up + ema_down) return rsi def bollinger_bands(close, period=20, stddev=2): """ Calculate the Bollinger bands. Args: close (pandas.Series): The closing prices.
Feragatname Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez.
Kullanım Şartları 'nda daha fazlasını okuyun.