예스스탁
예스스탁 답변
2025-09-08 13:50:44
안녕하세요
예스스탁입니다.
input : ma_type(2);#1: SMA, 2:EMA, 3:WMA, 4:VWMA, 5:DEMA,6:TEMA, 7:RMA, 8:HMA, 9:TMA, 10:ZLEMA, 11:AMA, 12:SMMA
input : ma_length(75);
input : ma_lengthSmoothing(25);
input : smoothingBool(False);
input : toleranceInputS(0.0025);
input : toleranceInputR(0.0025);
input : customRise(25);
input : trend_type(1);#1:Source Above MA,2:Rising MA
input : d_sr_sigs(true);
input : d_r_signs(true);
input : UpC(Lime);
input : DnC(Red);
var : Simple(0),Exponential(0),Weighted(0),Geometric(0),ii(0),Harmonic(0);
var : DEMA(0),TEMA(0),TMA(0),alpha(0),RMA(0);
var : zxLag(0),zxEMAData(0),ZLEMA(0),Hull(0);
var : Noise(0), Signal(0), Diff(0), efRatio(0), Smooth(1), Fastest(0.6667), Slowest(0.0645), AdaptMA(0);
var : VWMA(0),SMMA(0);
var : source(0),length(0),smoothADD(0),mav(0);
source = close;
smoothADD = ma_length + ma_lengthSmoothing;
length = iff(smoothingBool , smoothADD , ma_length);
if ma_type == 1 Then
mav = ma(close, length);
if ma_type == 2 Then
mav = ema(close, length);
if ma_type == 3 Then
mav = wma(close, length);
if ma_type == 4 Then
VWMA = ma(close * volume, length) / ma(volume, length);
if ma_type == 5 Then
mav = 2 * ema(close, length) - ema(ema(c, length), length);
if ma_type == 6 Then
mav = (3 * Ema(close,length)) - (3 * Ema(Ema(close,length),length)) + (Ema(Ema(Ema(close,length),length),length));
if ma_type == 7 Then
{
alpha = 1/length;
mav = iff(Isnan(mav[1]) == true , ma(close, length) , alpha * close + (1 - alpha) * iff(isnan(mav[1]) == true,0,mav[1]));
}
if ma_type == 8 Then
mav = wma(2 * wma(close, length / 2) - wma(close, length), round(sqrt(length),0));
if ma_type == 9 Then
mav = ma(ma(close, Ceiling(length / 2)), floor(length / 2) + 1);
if ma_type == 10 Then
{
zxLag = iff(length / 2 == round(length / 2,0) , length / 2 , (length - 1) / 2);
zxEMAData = close + (close - close[zxLag]);
mav = ema(zxEMAData, length);
}
if ma_type == 11 Then
{
Diff = AbsValue(Close - Close[1]);
IF Index <= length Then
mav = Close;
else
{
Signal = AbsValue(Close - Close[length]);
Noise = accumN(Diff, length);
efRatio = Signal / Noise;
Smooth = Power(efRatio * (Fastest - Slowest) + Slowest, 2);
mav = AdaptMA[1] + Smooth * (Close - mav[1]);
}
}
if ma_type == 12 Then
{
SMMA = iff(IsNan(SMMA[1]) == true, ma(Close, length) , (SMMA[1] * (length - 1) + close) / length);
}
var : toleranceCodeS(0),toleranceCodeR(0),bandtouch_score(Nan),rejection_score(nan),pc(0),tx(0);
toleranceCodeS = mav * toleranceInputS;
toleranceCodeR = mav * toleranceInputS;
if close > mav + toleranceCodeS and low < mav Then
bandtouch_score = 1; // Support
else if close < mav - toleranceCodeS and high > mav Then
bandtouch_score = -1; // Resistance
else
bandtouch_score = 0;
var : bull_c(False),bear_c(False);
bull_c = CrossUp(close, mav + toleranceCodeR);
bear_c = CrossDown(close, mav - toleranceCodeR);
if bandtouch_score[1] == -1 and bull_c == true Then
rejection_score = 1;
else if bandtouch_score[1] == 1 and bear_c == true Then
rejection_score = -1;
else
rejection_score = 0;
// Plots
pc = iff(trend_type == 1 ,IFF(close > mav , UpC , DnC) , iff(trend_type == 2 , IFf(mav > mav[customRise] , UpC , DnC) , Nan));
plot1(mav,"Moving Average",pc);
if CrossUp(rejection_score, 0) Then
{
tx = Text_New(sDate,sTime,L,"▲");
Text_SetColor(tx,upc);
Text_SetStyle(tx,2,0);
}
if CrossDown(rejection_score, 0) Then
{
tx = Text_New(sDate,sTime,H,"▼");
Text_SetColor(tx,dnc);
Text_SetStyle(tx,2,1);
}
즐거운 하루되세요
> 파생돌이 님이 쓴 글입니다.
> 제목 : 부탁드립니다
> 수고하십니다
예스로 수식부탁드립니다
//@version=6
indicator("MA Suite | Lyro RS", overlay= true)
// Library
import LyroRS/LMAs/1 as DynamicMAs
// LyroRS v1.0
// Groups (For Inputs)
ma_g = "𝗠𝗢𝗩𝗜𝗡𝗚 𝗔𝗩𝗘𝗥𝗔𝗚𝗘"
signal_g = '𝗦𝗜𝗚𝗡𝗔𝗟𝗦'
colors_g = '𝗖𝗢𝗟𝗢𝗥𝗦'
// Inputs
// -- MA Inputs
source = input.source(close, "Source", group= ma_g, tooltip= "S E ECT where the data originates (open, high, low, close, etc..).")
ma_type = input.string("EMA", "S E ECT Moving Average", options=["SMA", "EMA", "WMA", "VWMA", "DEMA", "TEMA", "RMA", "HMA", "LSMA", "SMMA", "ALMA", "ZLSMA", "FRAMA", "KAMA", "JMA", "T3"], group=ma_g, tooltip="Choose a moving average to apply to the calculation.")
ma_length = input.int(75, "Moving Average Length", group= ma_g, tooltip= "Defines the length or period of the S E ECTed moving average.")
ma_lengthSmoothing = input.int(25, "MA - Smooth", group=ma_g)
toleranceInputS = input.float(0.0025, "Tolerance - 1", group = ma_g, tooltip = "Tolerance for Support and Resistance", step = 0.0001)
toleranceInputR = input.float(0.0025, "Tolerance - 2", group = ma_g, tooltip = "Tolerance for Rejection Signs", step = 0.0001)
customRise = input.int(25, "Rising MA", group = ma_g, tooltip = "Change Resistance of Rising MA / Long to Short Term")
// -- Display Inputs
trend_type = input.string("Source Above MA", "S E ECT Trend Type", options=["Source Above MA", "Rising MA"], group=signal_g, tooltip="S E ECT a moving average trend following method.")
d_sr_sigs = input.bool (true, "Display Support/Resistance Signs", group= signal_g, display=display.none, tooltip="Enables triangle signs to be displayed.")
d_r_signs = input.bool (true, "Display Rejection Signs", group= signal_g, display=display.none, tooltip="Enables signs for Trend mode.")
smoothingBool = input.bool (false, "Enable / Disable Smoothing", group= signal_g, display=display.none, tooltip="Enables or Disables smoothing.")
// -- Color Inputs
ColMode = input.string("Mystic", "Custom Color Palette", inline="D R OP", options=["Classic", "Mystic", "Accented", "Royal"], group=colors_g, tooltip="Choose a predefined color scheme for indicator visualization.")
cpyn = input.bool(true, "Use Custom Palette", tooltip="Enable manual S E ECTion of custom colors for trend signals.", group=colors_g, display=display.none)
cp_UpC = input.color(#00ff00, "Custom Up", inline="Custom Palette", tooltip="Set a custom color for bullish signals.", group=colors_g, display=display.none)
cp_DnC = input.color(#ff0000, "Custom Down", inline="Custom Palette", tooltip="Set a custom color for bearish signals.", group=colors_g, display=display.none)
// Colors
color UpC = na
color DnC = na
switch ColMode
"Classic" =>
UpC := #00E676
DnC := #880E4F
"Mystic" =>
UpC := #30FDCF
DnC := #E117B7
"Accented" =>
UpC := #9618F7
DnC := #FF0078
"Royal" =>
UpC := #FFC107
DnC := #673AB7
if cpyn
UpC := cp_UpC
DnC := cp_DnC
smoothADD = ma_length + ma_lengthSmoothing
// Moving Average Switch (Standard, No Volume Weighting)
float ma = na
switch ma_type
"SMA" => ma := DynamicMAs.SMA(source, smoothingBool ? smoothADD : ma_length)
"EMA" => ma := DynamicMAs.EMA(source, smoothingBool ? smoothADD : ma_length)
"WMA" => ma := DynamicMAs.WMA(source, smoothingBool ? smoothADD : ma_length)
"VWMA" => ma := DynamicMAs.VWMA(source, volume, smoothingBool ? smoothADD : ma_length)
"DEMA" => ma := DynamicMAs.DEMA(source, smoothingBool ? smoothADD : ma_length)
"TEMA" => ma := DynamicMAs.TEMA(source, smoothingBool ? smoothADD : ma_length)
"RMA" => ma := DynamicMAs.RMA(source, smoothingBool ? smoothADD : ma_length)
"HMA" => ma := DynamicMAs.HMA(source, smoothingBool ? smoothADD : ma_length)
"LSMA" => ma := DynamicMAs.LSMA(source, smoothingBool ? smoothADD : ma_length, 0)
"SMMA" => ma := DynamicMAs.SMMA(source, smoothingBool ? smoothADD : ma_length)
"ALMA" => ma := DynamicMAs.ALMA(source, smoothingBool ? smoothADD : ma_length, 0, 20)
"ZLSMA" => ma := DynamicMAs.ZLSMA(source, smoothingBool ? smoothADD : ma_length)
"FRAMA" => ma := DynamicMAs.FRAMA(source, smoothingBool ? smoothADD : ma_length)
"KAMA" => ma := DynamicMAs.KAMA(source, smoothingBool ? smoothADD : ma_length)
"JMA" => ma := DynamicMAs.JMA(source, smoothingBool ? smoothADD : ma_length, 0)
"T3" => ma := DynamicMAs.T3(source, smoothingBool ? smoothADD : ma_length, 0.5)
toleranceCodeS = ma * toleranceInputS
toleranceCodeR = ma * toleranceInputS
// MA Touch (Support & Resistance)
var float bandtouch_score = na
if close > ma + toleranceCodeS and low < ma
bandtouch_score := 1 // Support
else if close < ma - toleranceCodeS and high > ma
bandtouch_score := -1 // Resistance
else
bandtouch_score := 0
//-- Rejection (Bullish & Bearish Price Behavior)
var float rejection_score = na
bull_c = ta.crossover(close, ma + toleranceCodeR) // Bullish cross
bear_c = ta.crossunder(close, ma - toleranceCodeR) // Bearish cross
if bandtouch_score[1] == -1 and bull_c == true
rejection_score := 1
else if bandtouch_score[1] == 1 and bear_c == true
rejection_score := -1
else
rejection_score := 0
// Plots
pc = trend_type == "Source Above MA" ? (close > ma ? UpC : DnC) : trend_type == "Rising MA" ? (ma > ma[customRise] ? UpC : DnC) : na
plot(ma, color = pc, title= "Moving Average")
plot(ma, color = color.new(pc, 75), linewidth= 5, title= "Moving Average Glow", display = display.pane)
plot(ma, color = color.new(pc, 80), linewidth= 10, title= "Moving Average Glow 2", display = display.pane)
barcolor(pc, title= "Bar Color")
// -- MA Touch Chars
displays_MATC = d_sr_sigs ? display.pane : display.none
plotchar(low, char='▲', color= bandtouch_score == 1 ? UpC : na, location=location.absolute, title= "Support Signals", display= displays_MATC, size= size.tiny)
plotchar(high, char='▼', color= bandtouch_score == -1 ? DnC : na, location=location.absolute, title= "Resistance Signals", display= displays_MATC, size= size.tiny)
// -- Rejection Shapes
displays_rs = d_r_signs ? display.pane : display.none
plotshape(ta.crossover(rejection_score, 0), title="Rejection Signal", location=location.belowbar,
style=shape.labelup, text="𝓑𝓾𝓵𝓵𝓲𝓼𝓱 𝓡𝓮𝓳𝓮𝓬𝓽𝓲𝓸𝓷", textcolor=#000000, size=size.small,
color=UpC, force_overlay=true, display= displays_rs)
plotshape(ta.crossunder(rejection_score, 0), title="Rejection Signal", location=location.abovebar,
style=shape.labeldown, text="𝓑𝓮𝓪𝓻𝓲𝓼𝓱 𝓡𝓮𝓳𝓮𝓬𝓽𝓲𝓸𝓷", textcolor=#000000, size=size.small,
color=DnC, force_overlay=true, display= displays_rs)