0% found this document useful (0 votes)
216 views

Script THOR

This document defines an indicator called "Relanpago" that calculates the MACD indicator and plots candlestick charts with color bars based on MACD and EMA values. It takes in user-defined inputs for the fast and slow EMA periods used in MACD, the signal line period, an EMA period, and color values. It then calculates the fast and slow EMA, MACD, signal line, and histogram and compares the EMA and histogram values to the previous period to determine the bar color for plotting.

Uploaded by

jdsjdndudjdu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
216 views

Script THOR

This document defines an indicator called "Relanpago" that calculates the MACD indicator and plots candlestick charts with color bars based on MACD and EMA values. It takes in user-defined inputs for the fast and slow EMA periods used in MACD, the signal line period, an EMA period, and color values. It then calculates the fast and slow EMA, MACD, signal line, and histogram and compares the EMA and histogram values to the previous period to determine the bar color for plotting.

Uploaded by

jdsjdndudjdu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

instrument {

name = "Relanpago",
overlay = " true",
}
input_group {
"MACD",
"Slow and fast EMA periods, used in MACD calculation",
fast = input (12, "front.platform.fast period", input.integer, 1, 250),
slow = input (26, "front.platform.fast period", input.integer, 1, 250)
}
input_group {
"front.platform.signal-line",
"Reference signal series period",
signal_period = input (9, "front.period", input.integer, 1, 250)
}
input_group {
"front.newind.emaperiod",
ema_period = input (13, "front.period", input.integer, 1, 250)
}
input_group {
"front.newind.barcolors",
positive = input { default = "#2CAC40", type = input.color },
neutral = input { default = "#C7CAD1", type = input.color },
negative = input { default = "#DB4931", type = input.color },
}
fastMA = ema(close, fast)
slowMA = ema(close, slow)
macd = fastMA - slowMA
signal = sma(macd, signal_period)
hist = macd - signal
ema13 = ema (close, ema_period)
local bar_color
if ema13 > ema13 [1] and hist > hist [1] then
bar_color = positive
elseif ema13 < ema13 [1] and hist < hist [1] then
bar_color = negative
else
bar_color = neutral
end
plot_candle (open, high, low, close, "ES", bar_color)

You might also like