답변완료
문의드립니다
input : 크기(10);
var : box(0),tx(0);
if Bdate != Bdate[1] Then
{
var1 = O;
box = Box_New(sDate,sTime,var1,NextBarSdate,NextBarStime,var1);
Box_SetFill(box,true);
}
Else
{
Box_SetEnd(box,sDate,Stime,C);
if C >= var1+크기 or C <= var1-크기 Then
{
var1 = C;
box = Box_New(sDate,sTime,var1,NextBarSdate,NextBarStime,var1);
Box_SetFill(box,true);
}
}
Box_SetColor(box,IFf(C > var1,Red,IFf(C<var1,Blue,Green)));
--------------------
당일용이 아닌것으로 하나 더 부탁드립니다
만들어봤는데 안되네요
감사합니다
2025-05-08
301
글번호 190656
지표
답변완료
지표전환 요청
안녕하세요
파인스크립트 지표입니다 예스랭귀지로 바꿔주시면 감사하겠습니다
부탁드립니다
study("Divergences v2.1 [LTB]", overlay=true)
calcmacd = input(true, title="MACD")
calcmacda = input(true, title="MACD Histogram")
calcrsi = input(true, title="RSI")
calcstoc = input(true, title="Stochastic")
calccci = input(true, title="CCI")
calcmom = input(true, title="Momentum")
calcobv = input(true, title="OBV")
calcdi = input(true, title="Diosc")
calcvwmacd = input(true, title="VWmacd")
calccmf = input(true, title="Chaikin Money Flow")
showhidden = input(false, title="Show Hidden Divergences")
htime = period == '1' ? '5' :
period == '3' ? '15' :
period == '5' ? '15' :
period == '15' ? '60' :
period == '30' ? '60' :
period == '45' ? '60' :
period == '60' ? '240' :
period == '120' ? '240' :
period == '180' ? '240' :
period == '240' ? 'D' :
period == 'D' ? 'W' :
'W'
_highestbars(ind) =>
highest = high
hb = 0
for i = 1 to ind
if highest < high[i]
highest := high[i]
hb := i
hb
_lowestbars(ind) =>
lowest = low
lb = 0
for i = 1 to ind
if lowest > low[i]
lowest := low[i]
lb := i
lb
TopsBots(tb) =>
tUp = close >= open
tDown = close <= open
dir = tUp[1] and tDown ? -1 : tDown[1] and tUp ? 1 : nz(dir[1])
TopsBots = tb == 1 ? tUp[1] and tDown and dir[1] != -1 ? highest(2) : na : tDown[1] and tUp and dir[1] != 1 ? lowest(2) : na
bb = nz(bb[1]) + 1
bb := change(time(htime)) != 0 ? 1 : bb
maxb = bb > nz(maxb[1]) ? bb : nz(maxb[1])
tops = bb==maxb ? security(tickerid, htime, TopsBots(1)) : na
bots = bb==maxb ? security(tickerid, htime, TopsBots(-1)) : na
// RSI
rsi = rsi(close, 14)
// MACD
fastMA = ema(close, 8)
slowMA = ema(close, 16)
macd = fastMA - slowMA
signal = sma(macd, 11)
deltamacd = macd - signal
// Momentum
moment = mom(close, 10)
// CCI
cci = cci(close, 10)
// OBV
obv = cum(change(close) > 0 ? volume : change(close) < 0 ? -volume : 0 * volume)
// Stoch
stk = sma(stoch(close, high, low, 14), 3)
// DIOSC
DI = change(high) - (-change(low))
trur = rma(tr, 14)
diosc = fixnan(100 * rma(DI, 14) / trur)
// volume weighted macd
maFast = vwma(close, 12)
maSlow = vwma(close, 26)
vwmacd = maFast - maSlow
// Chaikin money flow
Cmfm = ((close-low) - (high-close)) / (high - low)
Cmfv = Cmfm * volume
cmf = sma(Cmfv, 21) / sma(volume,21)
hib = _highestbars(maxb*2 - 1)
t2 = nz(t2[1]) + 1
divt = white
divth = white
if (not na(tops) or (na(tops) and _highestbars(t2+1) == 0))
t1 = na(tops) ? 0 : hib
divt := (calcrsi ? ((rsi[t1] < rsi[t2] and high[t1] >= high[t2]) ? red : divt) : divt)
divt := (calcmacd ? ((macd[t1] < macd[t2] and high[t1] >= high[t2]) ? red : divt) : divt)
divt := (calcmacda ? ((deltamacd[t1] < deltamacd[t2] and high[t1] >= high[t2]) ? red : divt) : divt)
divt := (calcmom ? ((moment[t1] < moment[t2] and high[t1] >= high[t2]) ? red : divt) : divt)
divt := (calccci ? ((cci[t1] < cci[t2] and high[t1] >= high[t2]) ? red : divt) : divt)
divt := (calcobv ? ((obv[t1] < obv[t2] and high[t1] >= high[t2]) ? red : divt) : divt)
divt := (calcstoc ? ((stk[t1] < stk[t2] and high[t1] >= high[t2]) ? red : divt) : divt)
divt := (calcdi ? ((diosc[t1] < diosc[t2] and high[t1] >= high[t2]) ? red : divt) : divt)
divt := (calcvwmacd ? ((vwmacd[t1] < vwmacd[t2] and high[t1] >= high[t2]) ? red : divt) : divt)
divt := (calccmf ? ((cmf[t1] < cmf[t2] and high[t1] >= high[t2]) ? red : divt) : divt)
//hidden
divth := (calcrsi ? ((rsi[t1] > rsi[t2] and high[t1] < high[t2]) ? gray : divth) : divth)
divth := (calcmacd ? ((macd[t1] > macd[t2] and high[t1] < high[t2]) ? gray : divth) : divth)
divth := (calcmacda ? ((deltamacd[t1] > deltamacd[t2] and high[t1] < high[t2]) ? gray : divth) : divth)
divth := (calcmom ? ((moment[t1] > moment[t2] and high[t1] < high[t2]) ? gray : divth) : divth)
divth := (calccci ? ((cci[t1] > cci[t2] and high[t1] < high[t2]) ? gray : divth) : divth)
divth := (calcobv ? ((obv[t1] > obv[t2] and high[t1] < high[t2]) ? gray : divth) : divth)
divth := (calcstoc ? ((stk[t1] > stk[t2] and high[t1] < high[t2]) ? gray : divth) : divth)
divth := (calcdi ? ((diosc[t1] > diosc[t2] and high[t1] < high[t2]) ? gray : divth) : divth)
divth := (calcvwmacd ? ((vwmacd[t1] > vwmacd[t2] and high[t1] < high[t2]) ? gray : divth) : divth)
divth := (calccmf ? ((cmf[t1] > cmf[t2] and high[t1] < high[t2]) ? gray : divth) : divth)
if (not na(tops))
t2 := hib
lob = _lowestbars(maxb*2 - 1)
b2 = nz(b2[1]) + 1
b1 = 0
divb = white
divbh = white
if (not na(bots) or (na(bots) and _lowestbars(b2+1) == 0))
b1 := na(bots) ? 0 : lob
divb := (calcrsi ? ((rsi[b1] > rsi[b2] and low[b1] <= low[b2]) ? lime : divb) : divb)
divb := (calcmacd ? ((macd[b1] > macd[b2] and low[b1] <= low[b2]) ? lime : divb) : divb)
divb := (calcmacda ? ((deltamacd[b1] > deltamacd[b2] and low[b1] <= low[b2]) ? lime : divb) : divb)
divb := (calcmom ? ((moment[b1] > moment[b2] and low[b1] <= low[b2]) ? lime : divb) : divb)
divb := (calccci ? ((cci[b1] > cci[b2] and low[b1] <= low[b2]) ? lime : divb) : divb)
divb := (calcobv ? ((obv[b1] > obv[b2] and low[b1] <= low[b2]) ? lime : divb) : divb)
divb := (calcstoc ? ((stk[b1] > stk[b2] and low[b1] <= low[b2]) ? lime : divb) : divb)
divb := (calcdi ? ((diosc[b1] > diosc[b2] and low[b1] <= low[b2]) ? lime : divb) : divb)
divb := (calcvwmacd ? ((vwmacd[b1] > vwmacd[b2] and low[b1] <= low[b2]) ? lime : divb) : divb)
divb := (calccmf ? ((cmf[b1] > cmf[b2] and low[b1] <= low[b2]) ? lime : divb) : divb)
//hidden
divbh := (calcrsi ? ((rsi[b1] < rsi[b2] and low[b1] > low[b2]) ? gray : divbh) : divbh)
divbh := (calcmacd ? ((macd[b1] < macd[b2] and low[b1] > low[b2]) ? gray : divbh) : divbh)
divbh := (calcmacda ? ((deltamacd[b1] < deltamacd[b2] and low[b1] > low[b2]) ? gray : divbh) : divbh)
divbh := (calcmom ? ((moment[b1] < moment[b2] and low[b1] > low[b2]) ? gray : divbh) : divbh)
divbh := (calccci ? ((cci[b1] < cci[b2] and low[b1] > low[b2]) ? gray : divbh) : divbh)
divbh := (calcobv ? ((obv[b1] < obv[b2] and low[b1] > low[b2]) ? gray : divbh) : divbh)
divbh := (calcstoc ? ((stk[b1] < stk[b2] and low[b1] > low[b2]) ? gray : divbh) : divbh)
divbh := (calcdi ? ((diosc[b1] < diosc[b2] and low[b1] > low[b2]) ? gray : divbh) : divbh)
divbh := (calcvwmacd ? ((vwmacd[b1] < vwmacd[b2] and low[b1] > low[b2]) ? gray : divbh) : divbh)
divbh := (calccmf ? ((cmf[b1] < cmf[b2] and low[b1] > low[b2]) ? gray : divbh) : divbh)
if (not na(bots))
b2 := lob
plot(tops, color = divt != white ? divt : na, linewidth = 3, offset = -3)
plot(tops, color = divth != white and showhidden ? divth : na, linewidth = 1, offset = -3)
plotshape(na(tops) and divt==red, style=shape.labeldown, color=red, location=location.abovebar, transp=20)
plot(bots, color = divb != white ? divb : na, linewidth = 3, offset = -3)
plot(bots, color = divbh != white and showhidden ? divbh : na, linewidth = 1, offset = -3)
plotshape(na(bots) and divb==lime, style=shape.labelup, color=lime, location=location.belowbar, transp=20)
buy = (divb == lime)
sell = (divt == red)
alertcondition(buy, title='Buy', message='Positive Divergence. Buy Signal')
alertcondition(sell, title='Sell', message='Negative Divergence. Sell Signal')
2025-05-08
351
글번호 190643
지표
답변완료
문의드립니다.
아래의 트레이딩뷰수식을 변환부탁드립니다.
1
================
nATRPeriod = input(5)
nATRMultip = input(3.5)
xATR = atr(nATRPeriod)
nLoss = nATRMultip * xATR
xATRTrailingStop = iff(close > nz(xATRTrailingStop[1], 0) and close[1] > nz(xATRTrailingStop[1], 0), max(nz(xATRTrailingStop[1]), close - nLoss),
iff(close < nz(xATRTrailingStop[1], 0) and close[1] < nz(xATRTrailingStop[1], 0), min(nz(xATRTrailingStop[1]), close + nLoss),
iff(close > nz(xATRTrailingStop[1], 0), close - nLoss, close + nLoss)))
pos = iff(close[1] < nz(xATRTrailingStop[1], 0) and close > nz(xATRTrailingStop[1], 0), 1,
iff(close[1] > nz(xATRTrailingStop[1], 0) and close < nz(xATRTrailingStop[1], 0), -1, nz(pos[1], 0)))
color = pos == -1 ? red: pos == 1 ? green : blue
plot(xATRTrailingStop, color=color, title="ATR Trailing Stop")
==================
2.
=================
ractalPeriods = input(title="Fractal Periods", defval=2, minval=1, type=integer)
bullFractal = pivothigh(fractalPeriods, fractalPeriods)
bearFractal = pivotlow(fractalPeriods, fractalPeriods)
plotchar(bullFractal?true:na, title="Bull Fractal", location=location.abovebar, offset=-fractalPeriods, color=green, transp=0, size=size.tiny, char='⮝')
plotchar(bearFractal?true:na, title="Bear Fractal", location=location.belowbar, offset=-fractalPeriods, color=red, transp=0, size=size.tiny, char="⮟")
======================
감사합니다. 수고하세요!!!
2025-05-08
289
글번호 190634
지표
답변완료
문의 드립니다!
안녕하세요!
아래 수식은 며칠전 92556번 질문에 대해 주신 답변수식입니다
이 수식을 적용해보니 상승세로선은 연장선까지도 잘 발생이되나 하락세로선이 연장선이 발생되지않고 있습니다
수고스러우시겠지만 한번더 검토 부탁드립니다
감사합니다
---------------------------------------------------------------------------------
Input : short(12), long(26), signal(9),굵기(5);
input : 텍스트출력(0),선굵기(5),상승세로선색(cyan),하락세로선색(green),세로선굵기(4);
Var : MACDV(0) , MACDS(0),T(0),vtl(0);
var : HIV(0),HID(0),HIT(0),HIV1(0),HID1(0),HIT1(0);
var : HPV(0),HPD(0),HPT(0),HPV1(0),HPD1(0),HPT1(0);
var : LIV(0),LID(0),LIT(0),LIV1(0),LID1(0),LIT1(0);
var : LPV(0),LPD(0),LPT(0),LPV1(0),LPD1(0),LPT1(0);
var : TL1(0),TL2(0);
MACDV = MACD(short, long);
MACDS = ema(MACDV,signal);
if crossup(MACDV,MACDS) Then
{
T = 1;
HIV = MACDV;
HID = sdate;
HIT = stime;
HIV1 = HIV[1];
HID1 = HID[1];
HIT1 = HIT[1];
HPV = L;
HPD = sdate;
HPT = stime;
HPV1 = HPV[1];
HPD1 = HPD[1];
HPT1 = HPT[1];
Condition1 = false;
}
if CrossDown(MACDV,MACDS) Then
{
T = -1;
LIV = MACDV;
LID = sdate;
LIT = stime;
LIV1 = LIV[1];
LID1 = LID[1];
LIT1 = LIT[1];
LPV = L;
LPD = sdate;
LPT = stime;
LPV1 = LPV[1];
LPD1 = LPD[1];
LPT1 = LPT[1];
Condition2 = false;
}
if T == 1 Then
{
if MACDV > HIV Then
{
HIV = MACDV;
HID = sdate;
HIT = stime;
}
if H > HPV Then
{
HPV = H;
HPD = sdate;
HPT = stime;
}
if Condition1 == false and HPV1 > 0 and HPV > HPV1 and HIV < HIV1 Then
{
TL1 = TL_New(HPD1,HPT1,HPV1,HPD,HPT,HPV);
TL2 = TL_New_Self(HID1,HIT1,HIV1,HID,HIT,HIV);
TL_SetColor(TL1,blue);
TL_SetColor(TL2,red);
TL_SetSize(TL1,굵기);
TL_SetSize(TL2,굵기);
Condition1 = true;
PlaySound("C:₩예스트레이더(X64)₩data₩Sound₩.wav");
vtl = TL_New(sDate,sTime,0,sdate,sTime,999999999);
TL_SetColor(vtl,하락세로선색);
TL_SetSize(vtl,세로선굵기);
}
if Condition1 == true then
{
if HPV > HPV1 and HIV < HIV1 then
{
TL_SetEnd(TL1,HPD,HPT,HPV);
TL_SetEnd(TL2,HID,HIT,HIV);
TL_SetBegin(vtl,LPD,LPT,0);
TL_SetEnd(vtl,LPD,LPT,999999999);
PlaySound("C:₩예스트레이더(X64)₩data₩Sound₩.wav");
}
Else
{
TL_Delete(TL1);
TL_Delete(TL2);
TL_Delete(Vtl);
}
}
}
if T == -1 Then
{
if MACDV < LIV Then
{
LIV = MACDV;
LID = sdate;
LIT = stime;
}
if L < LPV Then
{
LPV = L;
LPD = sdate;
LPT = stime;
}
if Condition2 == false and LPV1 > 0 and LPV < LPV1 and LIV > LIV1 Then
{
TL1 = TL_New(LPD1,LPT1,LPV1,LPD,LPT,LPV);
TL2 = TL_New_Self(LID1,LIT1,LIV1,LID,LIT,LIV);
TL_SetColor(TL1,red);
TL_SetColor(TL2,blue);
TL_SetSize(TL1,굵기);
TL_SetSize(TL2,굵기);
PlaySound("C:₩예스트레이더(X64)₩data₩Sound₩.wav");
vtl = TL_New(sDate,sTime,0,sdate,sTime,999999999);
TL_SetColor(vtl,상승세로선색);
TL_SetSize(vtl,세로선굵기);
Condition2 = true;
}
if Condition2 == true then
{
if LPV < LPV1 and LIV > LIV1 then
{
TL_SetEnd(TL1,LPD,LPT,LPV);
TL_SetEnd(TL2,LID,LIT,LIV);
TL_SetBegin(vtl,LPD,LPT,0);
TL_SetEnd(vtl,LPD,LPT,999999999);
PlaySound("C:₩예스트레이더(X64)₩data₩Sound₩.wav");
}
Else
{
TL_Delete(TL1);
TL_Delete(TL2);
TL_Delete(Vtl);
}
}
}
plot1(MACDV);
plot2(MACDS);
2025-05-07
261
글번호 190631
지표
답변완료
92588 답글좀 봐주세요
안녕하세요.
답변주셔서 감사합니다. 하지만 작성해주신 수식이 첨부한 그림처럼 나타납니다.
첨부한 그림1의 동그라미 친부분처럼 박스가 출력되길 원하는데
첨부한 그림2처럼 출력됩니다. 수정부탁드립니다.
바쁘신데 감사드립니다.
진입가부분의 표기와 박스생성을 2가지 색상으로 진입가 ~ TP영역, 진입가 ~ SL영역
으로 표기될수있도록 수정해주세요
추가로 하향 돌파했을때도 나타날수 있게 해주세요
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 박스출력 수식작성 부탁드려요
>
안녕하세요
예스스탁입니다.
input : P(20);
var : mav(0),hm(0),hh(0),lm(0),ll(0);
var : EP(0),TP(0),SL(0),TL1(0),TL2(0),TX1(0),TX2(0);
mav = ma(c,P);
#당일 이평 최고/최저일때 고가/저가
if Bdate != Bdate[1] Then
{
hm = mav;
hh = h;
lm = mav;
ll = l;
}
Else
{
if mav > hm Then
{
hm = mav;
hh = h;
}
if mav < lm Then
{
lm = mav;
ll = l;
}
}
Plot1(mav);
#상향돌파
if CrossUp(c,mav) Then
{
TL_Delete(TL1);
TL_Delete(TL2);
#진입가
EP = C;
#돌파시 당일20이평 최고값
TP = hh;
#돌파시 당일20이평 최저값
SL = ll;
TL1 = TL_New(sDate,sTime,TP,NextBarSdate,NextBarStime,TP);
TL2 = TL_New(sDate,sTime,SL,NextBarSdate,NextBarStime,SL);
TL_SetExtRight(TL1,true);
TL_SetExtRight(TL2,true);
TL_SetSize(TL1,1);
TL_SetSize(TL2,1);
Text_Delete(TX1);
Text_Delete(TX2);
TX1 = Text_New(NextBarSdate,NextBarStime,TP,"TP:"+NumToStr(TP,2)+" ("+NumToStr((TP-EP)/EP*100,1)+"%)");
TX2 = Text_New(NextBarSdate,NextBarStime,SL,"SL:"+NumToStr(SL,2)+" ("+NumToStr((SL-EP)/EP*100,1)+"%)");
Text_SetStyle(TX1,1,1);
Text_SetStyle(TX2,1,0);
}
즐거운 하루되세요
> oni 님이 쓴 글입니다.
> 제목 : 박스출력 수식작성 부탁드려요
> 안녕하세요
첨부한 사진처럼
TP와 SL을 표기하고 싶습니다.
그림과 상관없이 조건은 20이평 돌파시 당일20이평이 최고일때의 고가를 tp로 표기하고
sl은 당일20이평이 최저일때의 처가로 sl을 표기하고 싶습니다.
첨부한 그림처럼 텍스트로 sl값이 얼마인지 몇%의 손절인지 그리고 tp인 익절값이 얼마인지
진입가 대비 몇%인지를 표기할 수 있도록 부탁드립니다.
진입가는 20이평 돌파시의 종가로 해주시면 될것 같습니다.
사진처럼 박스의 컬러가 2가지로 표현되도록 부탁드립니다.
2025-05-08
294
글번호 190630
지표