예스스탁
예스스탁 답변
2025-03-14 16:14:19
안녕하세요
예스스탁입니다.
input : ema12Length(12);
input : ema26Length(26);
input : ema200Length(200);
input : rsiLength(14);
var : ema12(0),ema26(0),ema200(0),rsiValue(0);
var : longC(False),bullishEngulfing(False),bullishC(False);
var : shortC(False),bearishEngulfing(False),bearishC(False);
var : tx1(0),tx2(0),tx3(0),tx4(0);
// EMA settings
ema12 = ema(close, ema12Length);
ema26 = ema(close, ema26Length);
ema200 = ema(close, ema200Length);
// RSI settings
rsiValue = rsi(rsiLength);
// Golden Cross for L
longC = crossup(ema12, ema26) and close > ema200;
// Dead Cross for Short
shortC = CrossDown(ema12, ema26) and close < ema200;
// Bullish Engulfing Pattern with RSI Filter
bullishEngulfing = close[1] < open[1] and close > open and close > open[1] and open < close[1];
bullishC = bullishEngulfing and rsiValue <= 35;
// Bearish Engulfing Pattern with RSI Filter
bearishEngulfing = close[1] > open[1] and close < open and close < open[1] and open > close[1];
bearishC = bearishEngulfing and rsiValue >= 65;
// Plot buy and sell signals
if LongC == true Then
{
tx1 = Text_New(sDate,sTime,L,"▲");
Text_SetStyle(tx1,2,0);
Text_SetColor(tx1,Green);
}
if shortC == true Then
{
tx2 = Text_New(sDate,sTime,H,"▼");
Text_SetStyle(tx2,2,1);
Text_SetColor(tx2,Red);
}
// Plot Engulfing Patterns with RSI Filter
if bullishC == true Then
{
tx3 = Text_New(sDate,sTime,L,NewLine+ "▲");
Text_SetStyle(tx3,2,0);
Text_SetColor(tx3,Lime);
}
if bearishC == true Then
{
tx4 = Text_New(sDate,sTime,H,"▼"+NewLine);
Text_SetStyle(tx4,2,1);
Text_SetColor(tx4,Magenta);
}
// Plot EMAs
plot1(ema12,"12 EMA",blue);
plot2(ema26,"26 EMA",orange);
plot3(ema200,"200 EMA",purple);
즐거운 하루되세요
> 이글루 님이 쓴 글입니다.
> 제목 : 수식변환 부탁드립니다.
> 트레이딩뷰 수식을 예스로 변환하고자 합니다.
부탁드립니다.
//@version=5
indicator("EMA Crossover Signals with Engulfing Patterns and RSI Filter", overlay = true)
// Input settings
ema12Length = input.int(12, title="12 EMA Length")
ema26Length = input.int(26, title="26 EMA Length")
ema200Length = input.int(200, title="200 EMA Length")
rsiLength = input.int(14, title="RSI Length")
// EMA settings
ema12 = ta.ema(close, ema12Length)
ema26 = ta.ema(close, ema26Length)
ema200 = ta.ema(close, ema200Length)
// RSI settings
rsiValue = ta.rsi(close, rsiLength)
// Golden Cross for L ta.crossover(ema12, ema26)
l goldenCross and close > ema200
// Dead Cross for Short
deadCross = ta.crossunder(ema12, ema26)
shortC deadCross and close < ema200
// Bullish Engulfing Pattern with RSI Filter
bullishEngulfing = close[1] < open[1] and close > open and close > open[1] and open < close[1]
bullishC bullishEngulfing and rsiValue <= 35
// Bearish Engulfing Pattern with RSI Filter
bearishEngulfing = close[1] > open[1] and close < open and close < open[1] and open > close[1]
bearishC bearishEngulfing and rsiValue >= 65
// Plot buy and sell signals
plotshape(l"Buy Signal", location=locaticolor.green, style=shape.labelup, text="LONG")
plotshape(shortC"Sell Signal", location=locaticolor.red, style=shape.labeldown, text="SHORT")
// Plot Engulfing Patterns with RSI Filter
plotshape(bullishC"Bullish Engulfing", location=locaticolor.lime, style=shape.labelup, text="BULL")
plotshape(bearishC"Bearish Engulfing", location=locaticolor.maroshape.labeldown, text="BEAR")
// Plot EMAs
plot(ema12, title="12 EMA", color=color.blue)
plot(ema26, title="26 EMA", color=color.orange)
plot(ema200, title="200 EMA", color=color.purple)