답변완료
지표 수식 부탁드립니다.
2060고점
M20 = ma(C, 20, 삼각);
M60 = ma(C, 60, 삼각);
HH = HighestSince(1, CrossUp(M20, M60), M20);
Valuewhen(1, M20 != HH && M20>M60, HH)
2060저점
M20 = ma(C, 20, 삼각);
M60 = ma(C, 60, 삼각);
LL = LowestSince(1, CrossDown(M20, M60), M20);
Valuewhen(1, M20 !=LL && M20<M60, LL)
2023-07-04
1106
글번호 170329
지표
답변완료
차트상의 가로선 오른쪽 끝에 값표시 방법 문의
아래는 예전에 드렸던 질문내용입니다. 근데 그 값들을 차트상에서 오른쪽 끝에 각 선들 위에 표시가 되게 하려면 어떻게 하나요?
텍스트 출력함수 text_new를 활용하는것 같은데.. 못하겠습니당 ㅠㅠ 도와주세요
------------------
input : 시작값(300),끝값(350),간격(1),색상(GRAY);
var : cnt(0);
if Index == 1 Then
{
For cnt = 시작값 to 끝값 step 간격
{
var1 = TL_New(sDate,sTime,cnt,NextBarSdate,NextBarStime,cnt);
MessageLog("%.2f %.2f",cnt,var1);
TL_SetExtRight(var1,true);
TL_SetColor(var1,색상);
}
}
즐거운 하루되세요
> afflatus 님이 쓴 글입니다.
> 제목 : 지표 문의 드립니다.
> 선물차트에 일정 단위로 가로 선을 긋고 싶습니다.
예를들어 300포인트 부터 1포인트 단위로 350 포인트까지 50 개 가로 선을 긋고 싶으면 어떻게 수식을 작성하면 될까요?
변수를 총 3개로 위의 예시로 말씀드리면, 시작 포인트(예:300 포인트)와 특정 폭(예:1포인트)과 줄 갯수(예:50개)로 하고 싶습니다.
for문과 plot으로 작성해야하는데.. 잘 못하겠습니다. 부탁드립니다
2023-07-04
1361
글번호 170326
지표
답변완료
부탁드립니다.
매번 도움 주셔서 진심 감사 드립니다.
변형 부탁 드립니다.
1.
1. 트레이팅뷰에서
if mav == 'VAR'
ma := VAR
ma
부분을
if mav == 6 then
_ma = VAR;
으로 변형시켜 주셨는데 "var"부분에서 [문법에러,잘못된 토큰:"var"] 로 에러가 발생합니다.
2.
indicator('HIGH AND LOW Optimized Trend Tracker', 'HL OTT', overlay=true)
length = input.int(2, 'OTT Period', minval=1)
percent = input.float(0.6, 'OTT Optimization Coeff', step=0.1, minval=0)
hllength = input.int(10, 'Highest and Lowest Length', minval=1)
src = ta.highest(high, hllength)
srcl = ta.lowest(low, hllength)
highlighting = input(title='Highlighter On/Off ?', defval=true)
mav = input.string(title='Moving Average Type', defval='VAR', options=['SMA', 'EMA', 'WMA', 'DEMA', 'TMA', 'VAR', 'WWMA', 'ZLEMA', 'TSF', 'HULL'])
Var_Func(src, length) =>
MAvg = getMA(src, length)
fark = MAvg * percent * 0.01
longStop = MAvg - fark
longStopPrev = nz(longStop[1], longStop)
longStop := MAvg > longStopPrev ? math.max(longStop, longStopPrev) : longStop
shortStop = MAvg + fark
shortStopPrev = nz(shortStop[1], shortStop)
shortStop := MAvg < shortStopPrev ? math.min(shortStop, shortStopPrev) : shortStop
dir = 1
dir := nz(dir[1], dir)
dir := dir == -1 and MAvg > shortStopPrev ? 1 : dir == 1 and MAvg < longStopPrev ? -1 : dir
MT = dir == 1 ? longStop : shortStop
HOTT = MAvg > MT ? MT * (200 + percent) / 200 : MT * (200 - percent) / 200
HOTTC = color.blue
MAvgl = getMAl(srcl, length)
farkl = MAvgl * percent * 0.01
longStopl = MAvgl - farkl
longStopPrevl = nz(longStopl[1], longStopl)
longStopl := MAvgl > longStopPrevl ? math.max(longStopl, longStopPrevl) : longStopl
shortStopl = MAvgl + farkl
shortStopPrevl = nz(shortStopl[1], shortStopl)
shortStopl := MAvgl < shortStopPrevl ? math.min(shortStopl, shortStopPrevl) : shortStopl
dirl = 1
dirl := nz(dirl[1], dirl)
dirl := dirl == -1 and MAvgl > shortStopPrevl ? 1 : dirl == 1 and MAvgl < longStopPrevl ? -1 : dirl
MTl = dirl == 1 ? longStopl : shortStopl
LOTT = MAvgl > MTl ? MTl * (200 + percent) / 200 : MTl * (200 - percent) / 200
LOTTC = color.red
HOTTLine = plot(nz(HOTT[2]), title='HOTT', color=color.new(HOTTC, 0), linewidth=2, style=plot.style_line)
LOTTLine = plot(nz(LOTT[2]), title='LOTT', color=color.new(LOTTC, 0), linewidth=2, style=plot.style_line)
FillColor = highlighting ? color.new(#9915FF, 80) : na
fill(HOTTLine, LOTTLine, title='Highligter', color=FillColor)
color1 = close > HOTT[2] ? #00FFFF : close < LOTT[2] ? #FF00FF : na
barcolor(color1)
alertcondition(ta.crossover(close, HOTT[2]), title='Price Crossover Alarm', message='PRICE OVER HOTT - BUY SIGNAL!')
alertcondition(ta.crossunder(close, LOTT[2]), title='Price Crossunder Alarm', message='PRICE UNDER LOTT - SELL SIGNAL!')
2023-07-04
1844
글번호 170325
지표
답변완료
전환추세 쓰리바닥
Input : 전환(0.25),pt(0.15);
Var:j(0),jj(0),HH(0),LL(0),hiBar(0),loBar(0),최종꼭지점(""),처리구분(""),TX(0);
Array:고[10,4](0),저[10,4](0);
HH = H;
LL = L;
If Index == 0 Then
{
고[1,1] = HH;
고[1,2] = 0;
고[1,3] = sDate;
고[1,4] = sTime;
저[1,1] = LL;
저[1,2] = 0;
저[1,3] = sDate;
저[1,4] = sTime;
}
If Index > 0 Then
{
hiBar = hiBar + 1;
loBar = loBar + 1;
}
If HH[hiBar] < HH Then hiBar = 0;
If LL[loBar] > LL Then loBar = 0;
Condition1 = 저[1,1]+전환 <= HH and hiBar == 0;
Condition2 = 고[1,1]-전환 >= LL and loBar == 0;
처리구분 = "";
If Condition1 and Condition2 Then
{
If 최종꼭지점 == "저점" Then
{
If 저[1,1] > LL Then 처리구분 = "저점처리";
Else 처리구분 = "고점처리";
}
Else If 최종꼭지점 == "고점" Then
{
If 고[1,1] < HH Then 처리구분 = "고점처리";
Else 처리구분 = "저점처리";
}
}
Else If Condition1 Then 처리구분 = "고점처리";
Else If Condition2 Then 처리구분 = "저점처리";
If 처리구분 == "고점처리" Then
{
If 최종꼭지점 == "저점" Then
{
text_Delete(tx);
For j = 10 DownTo 2
{
For jj = 1 To 4
{
고[j,jj] = 고[j-1,jj];
}
}
고[1,1] = HH[hiBar];
고[1,2] = Index - hiBar;
고[1,3] = sDate[hiBar];
고[1,4] = sTime[hiBar];
hiBar = -1;
loBar = -1;
}
If 고[1,1] < HH[hiBar] Then
{
고[1,1] = HH[hiBar];
고[1,2] = Index - hiBar;
고[1,3] = sDate[hiBar];
고[1,4] = sTime[hiBar];
hiBar = -1;
loBar = -1;
}
최종꼭지점 = "고점";
Plot1(고[1,1]);
NoPlot(2);
}
If 처리구분 == "저점처리" Then
{
If 최종꼭지점 == "고점" Then
{
For j = 10 DownTo 2
{
For jj = 1 To 4
{
저[j,jj] = 저[j-1,jj];
}
}
저[1,1] = LL[loBar];
저[1,2] = Index - loBar;
저[1,3] = sDate[loBar];
저[1,4] = sTime[loBar];
hiBar = -1;
loBar = -1;
Condition99 = False;
if max(저[2,1],저[3,1]) <= min(저[2,1],저[3,1])+ pt Then
{
tx = text_new(저[1,3],저[1,4],저[1,1]+0.8,"●");
Text_SetColor(tx,Black);
Text_SetSize(tx,35);
Text_SetStyle(tx,2,2);
Condition99 = true;
}
}
If 저[1,1] > LL[loBar] Then
{
저[1,1] = LL[loBar];
저[1,2] = Index - loBar;
저[1,3] = sDate[loBar];
저[1,4] = sTime[loBar];
hiBar = -1;
loBar = -1;
if Condition99 == true and 저[1,1] < max(저[2,1],저[3,1])- pt Then
{
Condition99 = False;
Text_Delete(tx);
}
}
최종꼭지점 = "저점";
Plot2(저[1,1]);
NoPlot(1);
}
전저점과 전전저점의 차이가 0.15P 이내일 때 새로운 하락추세선이 생기면 즉시 동그라미 표시되는 부분을, 음전환시 즉시가 아니고, 이후에 세 저점의 차이가 0.15P 이내로 현저점이 하락했을 때(양전환시 쓰리바닥 시점) 동그라미 표시로 수정.
양전환되거나, 세저점이 0.15P 보다 커지면 삭제하는 부분은 동일합니다. 감사합니다.
2023-07-05
1396
글번호 170322
지표