답변완료
수식전환 요청드립니다.
안녕하세요.
아래 트레이딩뷰 수식을 예스트레이더 형식으로 변환을 부탁드립니다.
감사합니다.
//@version=5
indicator(shorttitle="E9 BRange", title="E9 Bollinger Range", overlay=true, timeframe="", timeframe_gaps=true)
//input parameters
length = input.int(70, minval=1)
maType = input.string("EMA", "Basis MA Type", options = ["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"])
src = input(ohlc4, title="Source")
offset = input.int(0, "Offset", minval = -500, maxval = 500, display = display.data_window)
show_HB = input.bool(false, title="Show Highlight Price Bars")
col_trnd_Up = input.color(#97ff9c, "Trend Up")
col_trnd_Dn = input.color(color.rgb(250, 86, 143), "Trend Down")
ema1 = ta.ema(ohlc4, 50)
ema2 = ta.ema(ohlc4, 200)
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)
basis = ma(src, length, maType)
//Signals
trend_up = close > basis
trend_dn = close < basis
trend_up1 = ta.crossover(close, basis)
trend_dn1 = ta.crossunder(close, basis)
//EMA's
MA1 = plot(ema1, "EMA1", color = #4136e8, linewidth = 3)
MA2 = plot(ema2, "EMA2", color = color.red, linewidth = 3)
//Bands1
mult = input.float(1.0, minval=0.001, maxval=50, title="StdDev Bands 1")
dev = mult * ta.stdev(src, length)
upper = basis + dev
lower = basis - dev
plot(basis, "Basis", color=color.rgb(255, 255, 255), offset = offset)
p1 = plot(upper, "Upper", color=color.rgb(246, 125, 135, 100), offset = offset)
p2 = plot(lower, "Lower", color=color.rgb(165, 249, 135, 100), offset = offset)
fill(p1, p2, title = "Background", color=color.rgb(255, 255, 255, 82))
//Bands2
mult1 = input.float(2.0, minval=0.001, maxval=50, title="StdDev Bands 2")
dev1 = mult1 * ta.stdev(src, length)
upper1 = basis + dev1
lower1 = basis - dev1
p3 = plot(upper1, "Upper", color=color.rgb(246, 125, 135, 100), offset = offset)
p4 = plot(lower1, "Lower", color=color.rgb(165, 249, 135, 100), offset = offset)
fill(p3, p4, title = "Background", color=color.rgb(255, 255, 255, 84))
//Bands3
mult2 = input.float(3.0, minval=0.001, maxval=50, title="StdDev Bands 3")
dev2 = mult2 * ta.stdev(src, length)
upper2 = basis + dev2
lower2 = basis - dev2
p5 = plot(upper2, "Upper", color=#f67d87, offset = offset)
p6 = plot(lower2, "Lower", color=#a5f987, offset = offset)
fill(p5, p6, title = "Background", color=#ffffff0d)
//Bands3
mult3 = input.float(3.5, minval=0.001, maxval=50, title="StdDev Bands 4")
dev3 = mult3 * ta.stdev(src, length)
upper3 = basis + dev3
lower3 = basis - dev3
p7 = plot(upper3, "Upper", color=#f67d87, linewidth = 2, offset = offset)
p8 = plot(lower3, "Lower", color=#a5f987, linewidth = 2, offset = offset)
fill(p7, p8, title = "Background", color=#ffffff0d)
//Signals 2
upperbreak = close > upper3
lowerbreak = close < lower3
// Bar Color Function
barColor() =>
trend_up ? col_trnd_Up : trend_dn ? col_trnd_Dn : na
barcolor(show_HB ? barColor() : na, title="Trend Bars")
//Trendchange
plotshape(trend_up1, "Signal Arrows Up", style = shape.triangleup, location = location.belowbar, color = color.white, size = size.tiny)
plotshape(trend_dn1, "Signal Arrows Down", style = shape.triangledown, location = location.abovebar, color = color.white, size = size.tiny)
//Extension
plotshape(upperbreak, "Extension Dots Upper", style = shape.circle, location = location.abovebar, color = #f67b7b, size = size.tiny)
plotshape(lowerbreak, "Extension Dots Lower", style = shape.circle, location = location.belowbar, color = #a4f67b, size = size.tiny)
2024-12-07
795
글번호 186041
지표
답변완료
문의 드립니다.
안녕하세요?
아래의 지표를 일봉/ 주봉/ 월봉에 적용시 수정 수식 부탁드립니다.
감사합니다.
Input : AF(0.02), AFMAX(0.2);
Var : Direction(0), SAR_Value(Close), AF_Value(.02), HighValue(High), LowValue(Low), EP(0),CSarv(0);
if Index == 0 or (Bdate != Bdate[1]) Then
{
Direction = 0;
SAR_Value = C;
AF_Value = 0.02;
HighValue = H;
LowValue = L;
EP = 0;
}
if EP != 0 Then
{
if Direction == 1 then
{
EP = HighValue;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if High > HighValue then
{
HighValue = High;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
if Close < SAR_Value then
{
Direction = -1;
SAR_Value = EP;
AF_Value = 0;
EP = 0;
LowValue = low;
}
}
else
{
EP = LowValue;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if Low < LowValue then
{
LowValue = Low;
AF_Value = AF_Value + Af;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
if Close > SAR_Value then
{
Direction = 1;
SAR_Value = EP;
AF_Value = 0;
EP = 0;
HighValue = High;
}
}
CSarv = SAR_Value;
}
else
{
if SAR_Value != 0 && EP == 0 then
{
if Direction == 1 then
{
EP = HighValue;
AF_Value = AF;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if High > HighValue then
{
HighValue = High;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
}
else
{
EP = LowValue;
AF_Value = Af;
SAR_Value = SAR_Value + AF_Value * (EP - SAR_Value);
if Low < LowValue then
{
LowValue = Low;
AF_Value = AF_Value + AF;
if AF_Value >= AFMAX then AF_Value = AFMAX;
}
}
CSarv = SAR_Value;
}
else
{
if Direction == 0 then
{
if Close > Close[1] then Direction = 1;
else
if Close < Close[1] then Direction = -1;
}
else
{
if Direction == 1 then
{
if Close < Close[1] then
{
Direction = -1;
SAR_Value = HighValue;
CSarv = SAR_Value;
}
}
if Direction == -1 then
{
if Close > Close[1] then
{
Direction = 1;
SAR_Value = LowValue;
CSarv = SAR_Value;
}
}
}
LowValue = min(Low, LowValue);
HighValue = max(High, HighValue);
}
}
var : t(0),hh(0),hl(0),lh(0),ll(0);
var : hh1(0),hl1(0),lh1(0),ll1(0);
var : hh2(0),hl2(0),lh2(0),ll2(0);
if CrossUp(C,CSarv) Then
{
t = 1;
hh = h;
hl = l;
hh1 = hh[1];
hl1 = hl[1];
var1 = hh1*2-ll;
Var2 = hh1;
Var3 = ll;
Var7 = ll*2-hh1;
Var9 = CSarv;
}
if CrossDown(C,CSarv) Then
{
t = -1;
lh = h;
ll = l;
lh1 = lh[1];
ll1 = ll[1];
var4 = ll1*2-hh;
Var5 = ll1;
Var6 = hh;
Var8 = hh*2-ll1;
Var10= CSarv;
}
if t == 1 Then
{
if h > hh Then
hh = h;
if l < hl Then
hl = h;
}
if t == -1 Then
{
if h > lh Then
lh = h;
if l < ll Then
ll = l;
}
Plot1(var1,"상승목표");
Plot2(var2,"HH1");
Plot3(var3,"LL");
Plot4(var4,"하락목표"); #녹밴 하락대칭
Plot5(var5,"LL1");
Plot6(var6,"HH");
Plot7(var7,"하락목표1");
Plot8(var8,"상승목표1");
Plot9(var1+PriceScale,"상승목표+");
Plot10(var8+PriceScale,"상승목표1+");
Plot11(var4-PriceScale,"하락목표-");
Plot12(var7-PriceScale,"하락목표1-");
2024-12-07
484
글번호 186040
지표