0% found this document useful (0 votes)
38 views3 pages

Custom Cycle Pro

The document outlines a trading script for a custom indicator called 'Custom Cycle Pro', which includes various input settings for buy/sell configurations, trend periods, and moving averages. It performs calculations for trend analysis, engulfing pattern detection, and includes a ZigZag indicator for price movements. The script visualizes price trends and signals on a chart using specified colors and shapes based on market conditions.
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)
38 views3 pages

Custom Cycle Pro

The document outlines a trading script for a custom indicator called 'Custom Cycle Pro', which includes various input settings for buy/sell configurations, trend periods, and moving averages. It performs calculations for trend analysis, engulfing pattern detection, and includes a ZigZag indicator for price movements. The script visualizes price trends and signals on a chart using specified colors and shapes based on market conditions.
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/ 3

instrument { name = "Custom Cycle Pro", icon = "", overlay = true }

-- Input groups
input_group {
"Buy Settings",
buy_color = input {default = "green", type = input.color}
}

input_group {
"Time Periods",
max_min_period = input {default = "10", type = input.string}
}

input_group {
"Micro Trend Period",
micro_trend_period = input {default = "10", type = input.string}
}

input_group {
"Macro Trend Period",
macro_trend_period = input {default = "100", type = input.string}
}

input_group {
"Fast EMA",
fast_ema_period = input {default = "3", type = input.string}
}

input_group {
"Slow EMA",
slow_ema_period = input {default = "13", type = input.string}
}

input_group {
"Sell Settings",
sell_color = input {default = "#fcf805", type = input.color}
}

input_group {
"Candle Colors",
bullish_color = input {default = "", type = input.color},
neutral_color = input {default = "", type = input.color},
bearish_color = input {default = "", type = input.color}
}

-- Calculations
ema_micro = ema(close, micro_trend_period)
ema_macro = ema(close, macro_trend_period)
fast_ema = ema(hlc3, fast_ema_period)
slow_ema = ema(hlc3, slow_ema_period)
high_period = highest(high, max_min_period)
low_period = lowest(low, max_min_period)

-- Trend analysis
bullish_trend = (close > close[1]) and (close > ema_micro) and (ema_micro >
ema_micro[1])
bearish_trend = (close < close[1]) and (close < ema_micro) and (ema_micro <
ema_micro[1])
bullish_cross = (fast_ema[1] < slow_ema[1]) and (fast_ema > slow_ema)
bearish_cross = (fast_ema[1] > slow_ema[1]) and (fast_ema < slow_ema)

sec_data = security(current_ticker_id, "1m")


if sec_data then
local candle_color

if bullish_trend then
candle_color = bullish_color
elseif bearish_trend then
candle_color = bearish_color
else
candle_color = neutral_color
end

plot_candle(open, high, low, close, "Price", candle_color)


plot(high_period, "Resistance", "")
plot(low_period, "Support", "")
end

-- Engulfing pattern detection


input_group { "Up Color", call_color = input { default = "#0bd104", type =
input.color } }
input_group { "Down Color", put_color = input { default = "#f70202", type =
input.color } }

if ((close[1] < open[1]) and (close > open) and (close > high[1]) and close[2] >=
open) then
plot_shape(1, 'Bull_Engulfing', shape_style.labelup, shape_size.huge,
call_color, shape_location.belowbar, 0, "Eng", "White")
elseif ((close[1] > open[1]) and (close < open) and (close < low[1]) and close[2]
<= open) then
plot_shape(1, 'Bear_Engulfing', shape_style.labeldown, shape_size.huge,
put_color, shape_location.abovebar, 0, "Eng", "White")
end

-- Trend direction analysis


if (close > close[1]) and (close[1] > open[2]) and (close[3] > close[2]) then
plot_shape(1, 'Bullish', shape_style.arrowup, shape_size.huge, call_color,
shape_location.belowbar, 0, "Buy", "#fcfc03")
elseif (close < close[1]) and (close[1] < open[2]) and (close[3] < close[2]) then
plot_shape(1, 'Bearish', shape_style.arrowdown, shape_size.huge, put_color,
shape_location.abovebar, 0, "Sell", "#fcfc03")
end

-- ZigZag Indicator
instrument { name = "ZigZag", overlay = true }
percentage = input(2, "Reversal Percentage", input.double, 0.01, 100, 1.0) / 100
zigzag_period = 3

input_group {
"ZigZag Colors",
up_color = input { default = "", type = input.color },
down_color = input { default = "", type = input.color },
line_width = input { default = 6, type = input.line }
}

local reference = make_series()


reference:set(nz(reference[1], high))
local trend_up = make_series()
trend_up:set(nz(trend_up[1], true))
local high_track = make_series()
local low_track = make_series()
local pivot_point = make_series()
reversal_range = reference * percentage / 100

if get_value(trend_up) then
high_track:set(max(high, nz(high_track[1], high)))
if close < high_track[1] - reversal_range then
pivot_point:set(high_track)
trend_up:set(false)
reference:set(high_track)
end
else
low_track:set(min(low, nz(low_track[1], low)))
if close > low_track[1] + reversal_range then
pivot_point:set(low_track)
trend_up:set(true)
reference:set(low_track)
end
end

plot(pivot_point, 'ZigZag', trend_up() and up_color or down_color, line_width, -1,


style.area, na_mode.continue)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy