예스스탁
예스스탁 답변
2023-06-08 11:05:27
안녕하세요
예스스탁입니다.
수식의 barcolor가 봉의 색을 변경하는 내용입니다.
강조식으로 작성해 드립니다.
var : nr4(False),nr7(False);
var : tr(0),profit(False),loss(False);
var : tx1(0),tx2(0),tx3(0),tx4(0);
tr = TrueRange;
nr4 = (tr <= tr[1]) and (tr <= tr[2]) and (tr <= tr[3])
and (high<high[1] and low>low[1]);
nr7 = nr4 and (tr <= tr[4]) and (tr <= tr[5]) and (tr <= tr[6])
and (high<high[1] and low>low[1]);
profit = (nr4[1] or nr7[1] ) and ((high > high[1] and low>low[1] and close>high[1] ) or (high<high[1] and low < low[1] and close<low[1] ));
loss = (nr4[1] or nr7[1] ) and ( (high > high[1] and ( close<high[1] or low < low[1] )) or (low < low[1] and (close>low[1]or high > high[1]) ));
if nr4 Then
{
PlotPaintBar(H,L,"강조",Blue);
tx1 = Text_New(sDate,sTime,H,"NR4"+NewLine+"▼");
Text_SetStyle(tx1,2,1);
}
if nr7 Then
{
PlotPaintBar(H,L,"강조",Magenta);
tx2 = Text_New(sDate,sTime,L,"▲"+NewLine+"NR7");
Text_SetStyle(tx2,2,0);
}
if profit Then
{
tx3 = Text_New(sDate,sTime,H,"Profit"+NewLine+"▼");
Text_SetStyle(tx3,2,1);
}
if loss Then
{
tx4 = Text_New(sDate,sTime,L,"▲"+NewLine+"Loss");
Text_SetStyle(tx4,2,0);
}
즐거운 하루되세요
> 분노의물타기 님이 쓴 글입니다.
> 제목 : 자표 작성 부탁드립니다.
> 아래는 트레이딩뷰에 있는 지표 작성 코드인데요, 예스트레이더에서 사용할 수 있도록 변환해 주시면 감사하겠습니다. 늘 친절하고 성의 있는 답변에 많은 도움을 받고 있습니다. 진심으로 감사드려요~
* 만약 아래 코드처럼 문자로 시그널을 나타내는 것이 불가능하다면 서로 다른 색깔의 화살표나 점 등으로 표현되어도 괜찮습니다.
study(title = "NR4 / NR7 + Inside Bar", overlay = true)
nr4 = (tr <= tr[1]) and (tr <= tr[2]) and (tr <= tr[3])
and (high<high[1] and low>low[1])
nr7 = nr4 and (tr <= tr[4]) and (tr <= tr[5]) and (tr <= tr[6])
and (high<high[1] and low>low[1])
profit = (nr4[1] or nr7[1] ) and ((high > high[1] and low>low[1] and close>high[1] ) or (high<high[1] and low < low[1] and close<low[1] ))
loss = (nr4[1] or nr7[1] ) and ( (high > high[1] and ( close<high[1] or low < low[1] )) or (low < low[1] and (close>low[1]or high > high[1]) ))
barcolor( nr4 ? blue : na, offset = 0, editable = true, title = "NR4")
barcolor( nr7 ? fuchsia : na, offset = 0, editable = true, title = "NR7")
plotshape(nr4, title= "NR4", location=location.abovebar, color=white, style=shape.arrowdown, text="NR4")
plotshape(nr7, title= "NR7", location=location.belowbar, color=white, style=shape.arrowup, text="NR7")
plotshape(profit, title= "profit", location=location.abovebar, color=white, style=shape.arrowdown, text="profit")
plotshape(loss, title= "loss", location=location.belowbar, color=white, style=shape.arrowup, text="loss")