Professional Documents
Culture Documents
input_group {
"front.bottom line",
lower_line_visible = input { default = true, type = input.plot_visibility },
lower_line_color = input { default = "#FA0A53", type = input.color },
lower_line_width = input { default = 2, type = input.line_width }
}
input_group {
"front.newind.adx.fill",
fill_visible = input { default = true, type = input.plot_visibility },
fill_color = input { default = rgba(226, 0, 255, 0.12), type = input.color },
}
local averageFunction = averages [fn]
middle = averageFunction (hlc3, period)
offset = rma(tr, period) * shift
upper = middle + offset
lower = middle - offset
if fill_visible then
fill { first = upper, second = lower, color = fill_color }
end
if upper_line_visible then
plot (upper, "Upper", upper_line_color, upper_line_width, 0, style.dash_line)
end
if lower_line_visible then
plot (lower, "Lower", lower_line_color, lower_line_width, 0, style.dash_line)
end
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 = "#00ff00", type = input.color },
neutral = input { default = "#ffffff", type = input.color },
negative = input { default = "#FF0000", 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)
instrument { name = "pdv_Trailing Stops", icon="jpg", 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 = "#00ff00", type = input.color },
neutral = input { default = "#ffffff", type = input.color },
negative = input { default = "#FF0000", 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)