예스스탁
예스스탁 답변
2020-10-06 15:03:00
안녕하세요
예스스탁입니다.
input : periods(5),threshold(0),usewicks(false);
var : ob_period(0),absmove(0),relmove(False),cnt(0);
var : bullishOB(False),upcandles(0),OB_bull(False),OB_bull_high(0),OB_bull_low(0),OB_bull_avg(0);
var : bearishOB(False),downcandles(0),OB_bear(False),OB_bear_high(0),OB_bear_low(0),OB_bear_avg(0);
ob_period = periods + 1;
absmove = ((abs(close[ob_period] - close[1]))/close[ob_period]) * 100;
relmove = absmove >= threshold;
bullishOB = close[ob_period] < open[ob_period];
upcandles = 0;
for cnt = 1 to periods
{
upcandles = upcandles + IFf(close[cnt] > open[cnt], 1 , 0);
}
OB_bull = bullishOB and (upcandles == (periods)) and relmove;
OB_bull_high = iff(OB_bull, IFf(usewicks , high[ob_period] , open[ob_period]), Nan);
OB_bull_low = iff(OB_bull, low[ob_period] ,Nan);
OB_bull_avg = (OB_bull_high + OB_bull_low)/2;
bearishOB = close[ob_period] > open[ob_period];
downcandles = 0;
for cnt = 1 to periods
{
downcandles = downcandles + IFf(close[cnt] < open[cnt] , 1 , 0);
}
OB_bear = bearishOB and (downcandles == (periods)) and relmove;
OB_bear_high = iff(OB_bear,high[ob_period] , Nan);
OB_bear_low = iff(OB_bear,IFf(usewicks,low[ob_period] , open[ob_period]),Nan);
OB_bear_avg = (OB_bear_low + OB_bear_high)/2;
if OB_bull == true Then
Buy();
if OB_bear == true Then
Sell();
즐거운 하루되세요
> as8282 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 아래수식을 예스로 변환부탁합니다.
어려운부분을 부탁드려 죄송합니다.
시스템신호만 부탁드립니다.
periods = input(5, "Relevant Periods to identify OB")
threshold = input(0.0, "Min. Percent move to identify OB", step = 0.1)
usewicks = input(false, "Use whole range [High/Low] for OB marking?" )
showbull = input(true, "Show latest Bullish Channel?")
showbear = input(true, "Show latest Bearish Channel?")
showdocu = input(true, "Show Label for documentation tooltip?")
ob_period = periods + 1
absmove = ((abs(close[ob_period] - close[1]))/close[ob_period]) * 100
relmove = absmove >= threshold
bullishOB = close[ob_period] < open[ob_period]
int upcandles = 0
for i = 1 to periods
upcandles := upcandles + (close[i] > open[i]? 1 : 0)
OB_bull = bullishOB and (upcandles == (periods)) and relmove
OB_bull_high = OB_bull? usewicks? high[ob_period] : open[ob_period] : na
OB_bull_low = OB_bull? low[ob_period] : na
OB_bull_avg = (OB_bull_high + OB_bull_low)/2
bearishOB = close[ob_period] > open[ob_period]
int downcandles = 0
for i = 1 to periods
downcandles := downcandles + (close[i] < open[i]? 1 : 0)
OB_bear = bearishOB and (downcandles == (periods)) and relmove
OB_bear_high = OB_bear? high[ob_period] : na
OB_bear_low = OB_bear? usewicks? low[ob_period] : open[ob_period] : na
OB_bear_avg = (OB_bear_low + OB_bear_high)/2
plotshape(OB_bull, title="Bullish OB", style = shape.triangleup, color = color.white, size = size.tiny, location = location.belowbar, offset = -ob_period, text = "Bullish OB")
bull1 = plot(OB_bull_high, title="Bullish OB open", style = plot.style_linebr, color = color.white, offset = -ob_period, linewidth = 3)
bull2 = plot(OB_bull_low, title="Bullish OB low", style = plot.style_linebr, color = color.white, offset = -ob_period, linewidth = 3)
fill(bull1, bull2, color=color.white, transp = 0, title = "Bullish OB fill")
plotshape(OB_bull_avg, title="Bullish OB Average", style = shape.cross, color = color.white, size = size.normal, location = location.absolute, offset = -ob_period)
plotshape(OB_bear, title="Bearish OB", style = shape.triangledown, color = color.blue, size = size.tiny, location = location.abovebar, offset = -ob_period, text = "Bearish OB")
bear1 = plot(OB_bear_low, title="Bearish OB open", style = plot.style_linebr, color = color.blue, offset = -ob_period, linewidth = 3)
bear2 = plot(OB_bear_high, title="Bearish OB high", style = plot.style_linebr, color = color.blue, offset = -ob_period, linewidth = 3)
fill(bear1, bear2, color=color.blue, transp = 0, title = "Bearish OB fill")
plotshape(OB_bear_avg, title="Bearish OB Average", style = shape.cross, color = color.blue, size = size.normal, location = location.absolute, offset = -ob_period)
var line linebull1 = na // Bullish OB average
var line linebull2 = na // Bullish OB open
var line linebull3 = na // Bullish OB low
var line linebear1 = na // Bearish OB average
var line linebear2 = na // Bearish OB high
var line linebear3 = na // Bearish OB open
if OB_bull and showbull
line.delete(linebull1)
linebull1 := line.new(x1 = bar_index, y1 = OB_bull_avg, x2 = bar_index - 1, y2 = OB_bull_avg, extend = extend.left, color = color.white, style = line.style_solid, width = 1)
line.delete(linebull2)
linebull2 := line.new(x1 = bar_index, y1 = OB_bull_high, x2 = bar_index - 1, y2 = OB_bull_high, extend = extend.left, color = color.white, style = line.style_dashed, width = 1)
line.delete(linebull3)
linebull3 := line.new(x1 = bar_index, y1 = OB_bull_low, x2 = bar_index - 1, y2 = OB_bull_low, extend = extend.left, color = color.white, style = line.style_dashed, width = 1)
if OB_bear and showbear
line.delete(linebear1)
linebear1 := line.new(x1 = bar_index, y1 = OB_bear_avg, x2 = bar_index - 1, y2 = OB_bear_avg, extend = extend.left, color = color.blue, style = line.style_solid, width = 1)
line.delete(linebear2)
linebear2 := line.new(x1 = bar_index, y1 = OB_bear_high, x2 = bar_index - 1, y2 = OB_bear_high, extend = extend.left, color = color.blue, style = line.style_dashed, width = 1)
line.delete(linebear3)
linebear3 := line.new(x1 = bar_index, y1 = OB_bear_low, x2 = bar_index - 1, y2 = OB_bear_low, extend = extend.left, color = color.blue, style = line.style_dashed, width = 1)
chper = time - time[1]
chper := change(chper) > 0 ? chper[1] : chper