답변완료
변환 부탁 드립니다.
안녕 하세요.
항상 감사 드리고 있습니다.
키움의 신호 수식인데, 예스트레이더 검색식으로 변경 부탁 드립니다.
ATR_BUY = ATR(c_buy);
NLOSS_BUY = a_buy * ATR_BUY;
TRAIL_BUY = IF(C > TRAIL_BUY(1) AND C(1) > TRAIL_BUY(1),
MAX(TRAIL_BUY(1), C - NLOSS_BUY),
IF(C < TRAIL_BUY(1) AND C(1) < TRAIL_BUY(1),
MIN(TRAIL_BUY(1), C + NLOSS_BUY),
IF(C > TRAIL_BUY(1), C - NLOSS_BUY, C + NLOSS_BUY)));
ATR_SELL = ATR(c_sell);
NLOSS_SELL = a_sell * ATR_SELL;
TRAIL_SELL = IF(C > TRAIL_SELL(1) AND C(1) > TRAIL_SELL(1),
MAX(TRAIL_SELL(1), C - NLOSS_SELL),
IF(C < TRAIL_SELL(1) AND C(1) < TRAIL_SELL(1),
MIN(TRAIL_SELL(1), C + NLOSS_SELL),
IF(C > TRAIL_SELL(1), C - NLOSS_SELL, C + NLOSS_SELL)));
LINREG_CLOSE = LinearRegressionValue(C, linreg_length, 0);
SIGNAL_LINE = AVG(LINREG_CLOSE, signal_length);
C > SIGNAL_LINE AND CROSSUP(EAVG(C, 1), SIGNAL_LINE) AND C>O;
지표변수
a_buy 2
c_buy 1
a_sell 2
c_sell 1
signal_length 7
linreg_length11
답변완료
변환 부탁드립니다.
트레이딩뷰 수식입니다.
변환 부탁 드립니다.
//@version=6
strategy("Triangular Hull Moving Average [BigBeluga X PineIndicators]", "THMA [BigBeluga X PineIndicators]", overlay = true, commission_value = 0.01, slippage = 2, initial_capital = 1000, margin_long = 0, margin_short = 0, default_qty_value = 1)
// INPUTS
int len_ = input.int(40, "Length")
float source = input.source(close, "Source")
bool volat = input.bool(true, "Volatility", inline = "vola"), len_vol = input.int(15, "", inline = "vola")
color_u = input.color(#16e5a0, "", inline = "colors")
color_d = input.color(#741ddd, "", inline = "colors")
// Neue Option: Entry Direction Auswahl
entry_mode = input.string("Long & Short", "Trade Direction", options = ["Only Long", "Only Short", "Long & Short"])
// CALCULATIONS
float volatility = ta.hma(high - low, len_vol)
var string trend = ""
vv = ta.percentile_nearest_rank(volatility, 1000, 100)
vol = volatility / vv
// THMA-Funktion
thma(_src, _length) =>
ta.wma(ta.wma(_src, _length / 3) * 3 - ta.wma(_src, _length / 2) - ta.wma(_src, _length), _length)
float thma = thma(source, len_)
float thma1 = thma[2]
bool signal_up = ta.crossover(thma, thma1)
bool signal_dn = ta.crossunder(thma, thma1)
switch
signal_up => trend := "🢁"
signal_dn => trend := "🢃"
color = thma > thma1 ? color_u : color_d
color1 = color
atr = ta.atr(200)
// PLOT
plotcandle(thma, thma + volatility, thma1 - volatility, thma1, "", color.new(color1, volat ? 40 : 0), color.new(color1, volat ? 40 : 100), bordercolor = color.new(color1,0))
plotshape(signal_up ? thma1 - atr : na, "Up", shape.triangleup, location.absolute, color = color.new(color, 60), size = size.small, force_overlay = true)
plotshape(signal_up ? thma1 - atr : na, "Up", shape.triangleup, location.absolute, color = color.new(color, 0), size = size.tiny, force_overlay = true)
plotshape(signal_dn ? thma1 + atr : na, "Dn", shape.triangledown, location.absolute, color = color.new(color, 60), size = size.small, force_overlay = true)
plotshape(signal_dn ? thma1 + atr : na, "Dn", shape.triangledown, location.absolute, color = color.new(color, 0), size = size.tiny, force_overlay = true)
if barstate.islast
dash = table.new(position.bottom_right, 10, 10, bgcolor = color.new(chart.fg_color, 90), border_color = chart.bg_color, border_width = 5)
dash.cell(0, 0, "Trend: " + trend, text_color = trend == "🢃" ? color_d : color_u)
dash.cell(0, 1, "Volatility: " + str.tostring(vol * 100, format.percent), text_color = chart.fg_color)
// Entry- und Close-Logik
bool allow_long = entry_mode == "Only Long" or entry_mode == "Long & Short"
bool allow_short = entry_mode == "Only Short" or entry_mode == "Long & Short"
// Long & Short-Modus: Positions eröffnen
if signal_up and allow_long
strategy.entry("Long", strategy.long)
if signal_dn and allow_short
strategy.entry("Short", strategy.short)
// Spezielle Schließlogik für "Only Long" und "Only Short"
if entry_mode == "Only Long"
// Bei Short-Signal bestehende Long-Position schließen
if signal_dn
strategy.close("Long")
if entry_mode == "Only Short"
// Bei Long-Signal bestehende Short-Position schließen
if signal_up
strategy.close("Short")