OPEN-SOURCE SCRIPT

BTMM EMA's

This script is written in Pine Script version 5 for TradingView and is designed to display multiple Exponential Moving Averages (EMAs) on a price chart. Here's a breakdown of its components:

1. Indicator Declaration
indicator(title="Moving Averages", shorttitle="BFX BTMM EMA", overlay=true):
Declares an indicator named "Moving Averages" with a short title "BFX BTMM EMA".
overlay=true means the indicator will be plotted directly on the price chart, not in a separate window.
2. EMA Calculation
The script calculates EMAs for the lengths of 5, 13, 50, 200, and 800 using the ta.ema() function, which applies the exponential moving average to the closing price (close).
pinescript
Copy code
ema5 = ta.ema(close, 5)
ema13 = ta.ema(close, 13)
ema50 = ta.ema(close, 50)
ema200 = ta.ema(close, 200)
ema800 = ta.ema(close, 800)
3. Plotting EMAs
Each EMA is plotted on the chart using the plot() function with specific colors for visual distinction:
EMA5: Yellow (color.rgb(255, 213, 0))
EMA13: Red (color.rgb(255, 0, 0))
EMA50: Light Blue (color.rgb(111, 183, 242))
EMA200: White (color.rgb(255, 255, 255))
EMA800: Purple (color.rgb(60, 0, 255))
4. Custom Smoothing Function
ma(source, length, type) is a custom function that allows users to select different types of moving averages, such as SMA, EMA, SMMA (RMA), WMA, and VWMA.
pinescript
Copy code
ma(source, length, type) =>
switch type
"SMA" => ta.sma(source, length)
"EMA" => ta.ema(source, length)
"SMMA (RMA)" => ta.rma(source, length)
"WMA" => ta.wma(source, length)
"VWMA" => ta.vwma(source, length)
5. User Inputs
typeMA and smoothingLength are user inputs for selecting the smoothing method and the length of the moving average. These inputs allow customization of the indicator:
typeMA provides options for the smoothing method.
smoothingLength sets the length of the smoothing.
pinescript
Copy code
typeMA = input.string(title = "Method", defval = "SMA", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="Smoothing")
smoothingLength = input.int(title = "Length", defval = 5, minval = 1, maxval = 100, group="Smoothing")
Summary:
This script calculates and plots five EMAs on the price chart, providing a visual representation of different time-frame trends. Additionally, it includes a custom function to allow the user to apply other smoothing techniques to the data, offering flexibility in analysis.
Exponential Moving Average (EMA)exponentialmovingavarage

Open-source Skript

Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun das Script auch andere Trader verstehen und prüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.

Möchten Sie dieses Skript auf einem Chart verwenden?

Haftungsausschluss