예스스탁
예스스탁 답변
2025-07-22 10:27:17
안녕하세요
예스스탁입니다.
올리신 수식에 시간을 지정하면 타주기의 내용을 그려주는 내용이 있는데
해당 부분은 주기별로 내용이 다르고 작성에 시간이 많이 걸려 추가해 드리기 어렵습니다.
적용하는 차트의 주기의 내용으로만 그리게 됩니다.
지표식으로 작성하신 후에 문법검증 후에 f5키를 누르면 지표속성창이 나타납니다.
차트표시탭에서 그래프는 모두 점그래프로 지정하시고 굵기를 조금 굵게 지정하신 후에
적용하시면 됩니다.
input : leftLenH(5);
input : rightLenH(5);
input : colorH(red);
input : leftLenL(5);
input : rightLenL(5);
input : colorL(blue);
var : ph(Nan),pl(Nan),pht1(0),pht2(0),plt1(0),plt2(0);
if SwingHigh(1,H,leftLenH,rightLenH,leftLenH+rightLenH+1) != -1 Then
{
ph = H[rightLenH];
pht1 = Text_New(sDate[rightLenH],sTime[rightLenH],Ph,NumToStr(ph,2)+NewLine);
pht2 = Text_New(sDate[rightLenH],sTime[rightLenH],Ph,"▼");
Text_SetStyle(pht1,2,1);
Text_SetColor(pht1,colorH);
Text_SetStyle(pht2,2,1);
Text_SetColor(pht2,colorH);
}
if Swinglow(1,L,leftLenL,rightLenL,leftLenL+rightLenL+1) != -1 Then
{
pl = L[rightLenL];
plt1 = Text_New(sDate[rightLenL],sTime[rightLenL],Pl,NewLine+NumToStr(pl,2));
plt2 = Text_New(sDate[rightLenL],sTime[rightLenL],Pl,"▲");
Text_SetStyle(plt1,2,0);
Text_SetColor(plt1,colorL);
Text_SetStyle(plt2,2,0);
Text_SetColor(plt2,colorL);
}
if ph > 0 Then
Plot1(ph,"ph",colorH);
if pl > 0 Then
Plot2(pl,"pl",colorL);
즐거운 하루되세요
> 니콜라스킹 님이 쓴 글입니다.
> 제목 : 예스랭귀지로 변환 부탁드립니다.
> 안녕하세요. 예스스탁님.
파인스크립트 지표를 예스랭귀지로 변환 부탁 드립니다.
바쁘신데도 불구하고 매번 친절하게 대응해주셔서 감사합니다.
-----------------------
//@version=5
indicator("Swing Pivots High Low", "Swing Pivots High Low", overlay=true, max_labels_count=500)
tf = input.timeframe(title="Timeframe", defval="")
gr="LENGTH LEFT / RIGHT"
leftLenH = input.int(title="Pivot High", defval=5, minval=1, inline="Pivot High",group=gr)
rightLenH = input.int(title="/", defval=5, minval=1, inline="Pivot High",group=gr)
colorH = input(title="", defval=color.red, inline="Pivot High",group=gr)
leftLenL = input.int(title="Pivot Low", defval=5, minval=1, inline="Pivot Low", group=gr)
rightLenL = input.int(title="/", defval=5, minval=1, inline="Pivot Low",group=gr)
colorL = input(title="", defval=color.blue, inline="Pivot Low",group=gr)
pivotHigh(ll, rl) =>
maxLen = 1000
float ph = ta.pivothigh(ll, rl)
int offset = 0
while offset < maxLen
if not na(ph[offset])
break
offset := offset + 1
ph[offset]
pivotLow(ll, rl) =>
maxLen = 1000
float pl = ta.pivotlow(ll, rl)
int offset = 0
while offset < maxLen
if not na(pl[offset])
break
offset := offset + 1
pl[offset]
ph = request.security(syminfo.tickerid, tf, pivotHigh(leftLenH, rightLenH), barmerge.gaps_off, barmerge.lookahead_on)
pl = request.security(syminfo.tickerid, tf, pivotLow(leftLenL, rightLenL), barmerge.gaps_off, barmerge.lookahead_on)
drawLabel(_offset, _pivot, _style, _color) =>
if not na(_pivot)
label.new(bar_index[_offset], _pivot, str.tostring(_pivot, format.mintick), style=_style, color=_color, textcolor=#131722)
// TODO: Need to calculate offset for different choiced timeframe.
// Theres an issue with finding the correct high/low bar as the high may be in the middle of a bar (for example: daily bar has alot of 5min bars)
// Lower timeframes have maximum available bars and it wont work when using higher timeframes - daily, weekly, monthly on smaller 5min/Nmin charts
// For now will not draw labels if different timeframe is choiced.
if (timeframe.period == tf or tf == "")
drawLabel(rightLenH, ta.pivothigh(leftLenH, rightLenH), label.style_label_down, colorH)
drawLabel(rightLenL, ta.pivotlow(leftLenL, rightLenL), label.style_label_up, colorL)
plotshape(ph, "PH", style=shape.circle, location=location.absolute, color=colorH)
plotshape(pl, "PL", style=shape.circle, location=location.absolute, color=colorL)
alertcondition(ta.crossover(close, ph), "PH Crossover", "Price crossed over current pivot high")
alertcondition(ta.crossunder(close, ph), "PH Crossunder", "Price crossed under current pivot high")
alertcondition(ta.crossover(close, pl), "PL Crossover", "Price crossed over current pivot low")
alertcondition(ta.crossunder(close, pl), "PL Crossunder", "Price crossed under current pivot low")