답변완료
문의 드립니다.
안녕하세요 ~
현재 가격이 아래의 강도파동 선을 돌파하는 검색식 부탁 드립니다.
// 누적 거래량 계산
cumulative_buying = eavg(if(C>O, (((H-L)-(if(C>O,H-C,H-O)+if(C>O,O-L,C-L)))/(H-L) + ((if(C>O,H-C,H-O)+if(C>O,O-L,C-L))/2)/(H-L))*V, (((if(C>O,H-C,H-O)+if(C>O,O-L,C-L))/2)/(H-L))*V), cumulation_length);
cumulative_selling = eavg(if(C<O, (((H-L)-(if(C>O,H-C,H-O)+if(C>O,O-L,C-L)))/(H-L) + ((if(C>O,H-C,H-O)+if(C>O,O-L,C-L))/2)/(H-L))*V, (((if(C>O,H-C,H-O)+if(C>O,O-L,C-L))/2)/(H-L))*V), cumulation_length);
// 거래량 강도 파동의 EMA
volume_strength = if(cumulative_buying > cumulative_selling, cumulative_buying, cumulative_selling);
eavg(volume_strength, cumulation_length)
지표조건
cumulation_length 14
감사합니다.
2025-07-21
125
글번호 192613
검색
답변완료
문의 드립니다.
아래 내용을 전환 가능한가요?
답변 감사합니다.
src = close
keyvalue = input(3, title = "Key Vaule. 'This changes the sensitivity'", step = .5)
atrperiod = input(10, title="ATR Period")
xATR = atr(atrperiod)
nLoss = keyvalue * xATR
xATRTrailingStop = 0.0
xATRTrailingStop := iff(src > nz(xATRTrailingStop[1], 0) and src[1] > nz(xATRTrailingStop[1], 0), max(nz(xATRTrailingStop[1]), src - nLoss),
iff(src < nz(xATRTrailingStop[1], 0) and src[1] < nz(xATRTrailingStop[1], 0), min(nz(xATRTrailingStop[1]), src + nLoss),
iff(src > nz(xATRTrailingStop[1], 0), src - nLoss, src + nLoss)))
pos = 0
pos := iff(src[1] < nz(xATRTrailingStop[1], 0) and src > nz(xATRTrailingStop[1], 0), 1,
iff(src[1] > nz(xATRTrailingStop[1], 0) and src < nz(xATRTrailingStop[1], 0), -1, nz(pos[1], 0)))
xcolor = pos == -1 ? color.red: pos == 1 ? color.green : color.blue
plot(xATRTrailingStop, color = xcolor, title = "Trailing Stop")
2025-07-21
153
글번호 192610
지표
답변완료
수식 부탁드립니다
지표식 부탁 드립니다.
//@version=5
indicator("Cumulative Volume Delta", "CVD", format=format.volume)
anchorInput = input.timeframe("1D", "Anchor period")
lowerTimeframeTooltip = "The indicator scans lower timeframe data to approximate up and down volume used in the delta calculation. By default, the timeframe is chosen automatically. These inputs override this with a custom timeframe.₩n₩nHigher timeframes provide more historical data, but the data will be less precise."
useCustomTimeframeInput = input.bool(false, "Use custom timeframe", tooltip = lowerTimeframeTooltip)
lowerTimeframeInput = input.timeframe("1", "Timeframe")
autoSwitchInput = input.bool(true, "Auto Switch Feature", tooltip="Turn on to automatically control visibility based on timeframe.")
upAndDownVolume() =>
posVol = 0.0
negVol = 0.0
var isBuyVolume = true
switch
close > open => isBuyVolume := true
close < open => isBuyVolume := false
close > close[1] => isBuyVolume := true
close < close[1] => isBuyVolume := false
if isBuyVolume
posVol += volume
else
negVol -= volume
posVol + negVol
var lowerTimeframe = switch
useCustomTimeframeInput => lowerTimeframeInput
timeframe.isseconds => "1S"
timeframe.isintraday => "1"
timeframe.isdaily => "5"
=> "60"
diffVolArray = request.security_lower_tf(syminfo.tickerid, lowerTimeframe, upAndDownVolume())
getHighLow(arr) =>
float cumVolume = na
float maxVolume = na
float minVolume = na
for item in arr
cumVolume := nz(cumVolume) + item
maxVolume := math.max(nz(maxVolume), cumVolume)
minVolume := math.min(nz(minVolume), cumVolume)
[maxVolume, minVolume, cumVolume]
[maxVolume, minVolume, lastVolume] = getHighLow(diffVolArray)
var cumulLastVolume = 0.0
anchorChange = timeframe.change(anchorInput) or (not na(lastVolume) and na(lastVolume[1]))
cumulOpenVolume = anchorChange ? 0.0 : cumulLastVolume[1]
cumulMaxVolume = cumulOpenVolume + maxVolume
cumulMinVolume = cumulOpenVolume + minVolume
cumulLastVolume := cumulOpenVolume + lastVolume
var float cumVolLine = na
cumVolLine := cumulLastVolume
// Determine if the current timeframe is intraday or daily and above
is_intraday = timeframe.isintraday
// Determine what to plot based on auto switch setting
plotCVD = autoSwitchInput ? is_intraday : true
// Plotting with color change based on value
plot(plotCVD ? cumVolLine : na, title="Cumulative Volume Delta", color=cumVolLine >= 0 ? color.green : color.red, linewidth=2)
hline(0, "Zero Line", color=color.gray, linestyle=hline.style_dotted)
2025-07-21
176
글번호 192609
지표
답변완료
안녕하세요. 슈퍼트렌드 시스템트레이딩 부탁드립니다.
/*최근 가장 인기 있는 지표 중 하나인 SuperTrend 지표를 이용한 전략으로
종가가 SuperTrend 상단 채널을 상향돌파하면 매수하고,
종가가 SuperTrend 하단 채널을 하향이탈하면 매도하는 전략입니다.
추세추종형 전략으로 큰 추세가 잘 나오는 전략에 유용합니다.*/
input : 투자금액(1000000);
input : factor(3), AtrPeriod(10);
Var : 누적자산(0), 수량(0);
var : src(0), AtrV(0),upperBand(0),lowerBand(0), prevLowerBand(0), prevUpperBand(0);
var : prevSuperTrend(0), superTrend(C), direction(0),alpha(0),source(0);
누적자산 = 투자금액 + netprofit;
수량 = int(투자금액/Close);
if CurrentBar > 1 Then {
src = (H+L)/2;
alpha = 1 / AtrPeriod ;
source = max(high - low, abs(high - close[1]), abs(low - close[1]));
ATrV = alpha * source + (1 - alpha) * ATrV[1]; //지수가중이평방식
upperBand = src + factor * AtrV;
lowerBand = src - factor * AtrV;
prevLowerBand = lowerBand[1];
prevUpperBand = upperBand[1];
if lowerBand > prevLowerBand or close[1] < prevLowerBand Then
lowerBand = lowerBand;
Else
lowerBand = prevLowerBand;
if upperBand < prevUpperBand or close[1] > prevUpperBand Then
upperBand = upperBand;
Else
upperBand = prevUpperBand;
if C > UpperBand Then
direction = 1;
if C < LowerBand Then
direction = -1;
if direction == 1 Then
supertrend = lowerband;
Else
supertrend = upperband;
}
# 매수
if CrossUp(C, upperBand) Then
Buy("Buy", OnClose, Def, 수량);
# 매수청산
if CrossDown(C, lowerBand) Then
ExitLong("EL");
안녕하세요. 예스스탁 대표님께서 만들어주신 슈퍼트렌드 시스템 트레이딩 코딩인데 여기서 투자금액이랑 수량은 빼고
선물에 적용하고싶어 매수,매도 다 되는 코딩으로 만들어주시면 감사하겠습니다!
2025-07-20
171
글번호 192608
시스템
답변완료
월봉의 최근캔들(고점까지) 추세선 고점높이까지 안돼는데 수정부탁드립니다
차트 그림에서와 같이 월봉최근캔들(추세선이 고점까지 되게끔)에서 추세선이 고점까지 안되는데 수정부탁드립니다
==============================================
input : Period(35),선두께(2);
Var:상승색(Turquoise), 하락색(Turquoise);
Var:j(0),T(0);
Var: date11(0),date12(0),time11(0),time12(0),TL1(0),TL(0),tl9(0),
date21(0),date22(0),time21(0),time22(0),diff(0),diffr(0),
date31(0),date32(0),time31(0),time32(0),tx(0),tx1(0),tl4(0),box(0);
Array:HiVal[20](0),LoVal[20](0),HiBar[20](0),LoBar[20](0);
Array:r[7](0),fr[7](0),TL2[7](0),TL3[7](0),TX2[7](0),TX3[7](0);
For j = 0 To 19
{
HiBar[j] = HiBar[j] + 1;
LoBar[j] = LoBar[j] + 1;
}
if monthhigh(0)[1] < monthhigh(0) Then
T = 1;
if monthlow(0)[1] > monthlow(0) Then
T = -1;
If T == -1 Then
{
If T[1] != -1 Then
{
For j = 18 DownTo 0
{
LoVal[j+1] = LoVal[j];
LoBar[j+1] = LoBar[j];
}
LoVal[0] = L;
LoBar[0] = 0;
date11 = date[HiBar[0]];
time11 = stime[HiBar[0]];
Value11 = HiVal[0];
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
TL_Delete(tl);
TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen);
TL1 = TL_New(date11,time11,Value11,date12,time12,Value12);
TL_SetColor(TL1,하락색);
box = Box_New(date11,time11,Value11,date12,time12,Value12);
Box_SetColor(box,Blue);
Box_SetFill(box,true,100,true);
date21 = date[HiBar[0]];
time21 = stime[HiBar[0]];
date22 = date[0];
time22 = stime[0];
for j = 0 to 6
{
fr[j] = LoVal[1] + ((HiVal[0] - LoVal[1]) * r[j]);
}
var1 = Index;
Var2 = var1[1];
if var2 > 0 Then
{
diff = value12;
diffr = (value12-value11)/value11*100;
TX = Text_New(sDate,sTime,value12,NumToStr(diffr,2)+"%");
Text_SetStyle(tx,1,0);
Text_SetColor(tx,Blue);
Text_SetSize(tx,12);
}
}
If LoVal[0] > L Then
{
LoVal[0] = L;
LoBar[0] = 0;
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
TL_SetEnd(TL1, date12,time12,Value12);
date22 = date[0];
time22 = stime[0];
diff = value12;
diffr = (value12-value11)/value11*100;
TL_Delete(tl);
TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen);
var1 = Index;
if var2 > 0 Then
Box_SetEnd(box,date12,time12,Value12);
{
Text_SetLocation(tx,sDate,sTime,value12);
Text_SetString(tx,NumToStr(diffr,2)+"%");
}
}
}
If T == 1 Then
{
If T[1] != 1 Then
{
For j = 18 DownTo 0
{
HiVal[j+1] = HiVal[j];
HiBar[j+1] = HiBar[j];
}
HiVal[0] = H;
HiBar[0] = 0;
date11 = date[LoBar[0]];
time11 = stime[LoBar[0]];
Value11 = LoVal[0];
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
TL_Delete(tl);
TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen);
TL1 = TL_New(date11,time11,Value11,date12,time12,Value12);
TL_SetColor(TL1,상승색);
box = Box_New(date11,time11,Value11,date12,time12,Value12);
Box_SetColor(box,Red);
Box_SetFill(box,true,100,true);
date31 = date[LoBar[0]];
time31 = stime[LoBar[0]];
date32 = date[0];
time32 = stime[0];
for j = 0 to 5
{
fr[j] = LoVal[0] + ((HiVal[1] - LoVal[0]) * r[j]);
}
var1 = Index;
Var2 = var1[1];
if var2 > 0 Then
{
diff = value12;
diffr = (value12-value11)/value11*100;
TX = Text_New(sDate,sTime,value12,NumToStr(diffr,2)+"%");
Text_SetStyle(tx,2,1);
Text_SetColor(tx,Red);
Text_SetSize(tx,12);
}
}
If HiVal[0] < H Then
{
HiVal[0] = H;
HiBar[0] = 0;
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
TL_SetEnd(TL1, date12,time12,Value12);
date32 = date[0];
time32 = stime[0];
diff = value12;
diffr = (value12-value11)/value11*100;
TL_Delete(tl);
TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen);
var1 = Index;
if var2 > 0 Then
Box_SetEnd(box,date12,time12,Value12);
{
Text_SetLocation(tx,sDate,sTime,value12);
Text_SetString(tx,NumToStr(diffr,2)+"%");
Text_SetStyle(tx,1,1);
}
}
}
TL_SetSize(TL1,선두께);
TL_SetDrawMode(TL1,0);
Text_SetSize(tx,15);
2025-07-21
168
글번호 192607
지표
답변완료
수식 부탁드립니다.
아래는 이전질문코드에 답을 주신건데
1분봉이나 5분봉에서
length값을 240으로 늘리면 값이 0으로 나오는데 length값을 늘렸을 경우에도
값이 제대로 나오게 할 수 있는 방법이 있을까요?
Inputs: length(55);
var : x(0),y(0),halfLength(0),sqrtLength(0),ii(0);
var : sum(0),Csum(0),sum1(0),csum1(0),sum2(0),csum2(0);
var : WMA1(0),WMA2(0),diff1(0),hma1(0);
var : sum5(0),Csum5(0),sum51(0),csum51(0),sum52(0),csum52(0);
var : WMA51(0),WMA52(0),diff5(0),hma2(0);
var : prev_hma1(0),prev_hma2(0),vol_sum(0),level(0),shift_col(0);
var : reversal_dn_signal(0),reversal_up_signal(0);;
halfLength = IntPortion(length / 2);
sqrtLength = IntPortion(Sqrt(length));
if Bdate != Bdate[1] Then
{
prev_hma1 = hma1[1];
prev_hma2 = hma2[1];
}
Sum = 0;
CSum = 0;
Sum5 = 0;
CSum5 = 0;
For x = 0 to sqrtLength-1
{
Sum1 = 0;
CSum1 = 0;
Sum2 = 0;
CSum2 = 0;
Sum51 = 0;
CSum51 = 0;
Sum52 = 0;
CSum52 = 0;
ii = 0;
For y = x+0 to x+length-1
{
if ii < halfLength Then
{
Sum1= Sum1 + DayClose(y) * (halfLength - ii);
CSum1 = CSum1 + halfLength - ii;
Sum51 = Sum51 + DayClose(y+5) * (halfLength - ii);
CSum51 = CSum51 + halfLength - ii;
}
if ii < Length Then
{
Sum2= Sum2 + DayClose(y) * (Length - ii);
CSum2 = CSum2 + Length - ii;
Sum52 = Sum52 + DayClose(y+5) * (Length - ii);
CSum52 = CSum52 + Length - ii;
}
ii = ii+1;
}
WMA1 = Sum1 / CSum1;
WMA2 = Sum2 / CSum2;
diff1 = 2 * wma1 - wma2;
Sum = Sum + diff1 * (sqrtLength - x);
CSum = CSum + sqrtLength - x;
WMA51 = Sum51 / CSum51;
WMA52 = Sum52 / CSum52;
diff5 = 2 * wma51 - wma52;
Sum5 = Sum5 + diff5 * (sqrtLength - x);
CSum5 = CSum5 + sqrtLength - x;
}
hma1 = sum/Csum;
hma2 = sum5/Csum5;
vol_sum = DayVolume(2) + dayVolume(0) + DayVolume(0);
IF NextBarBdate != Bdate Then
{
if (prev_hma1 <= prev_hma2) and (hma1 > hma2) then
begin
level = DayLow;
end
else if (prev_hma1 >= prev_hma2) and (hma1 < hma2) then
begin
level = DayHigh;
end
else
begin
level = level[1];
end;
// 바 색상 숫자 (1=Up, 0=Down)
if DayClose < level then
begin
shift_col = 0;
end
else
begin
shift_col = 1;
end;
// 반전 신호 조건
reversal_dn_signal = 0;
reversal_up_signal = 0;
if (dayHigh(2) < level) and (DayHigh < level) and (DayHigh(1) > level) then
reversal_dn_signal = 1;
if (dayLow(2) > level) and (dayLow(1) < level) and (DayLow > level) then
reversal_up_signal = 1;
}
// 결과 플롯
Plot1(level, "Market Level");
2025-07-20
169
글번호 192604
지표