답변완료
지표좀 수정 부탁 드립니다.(2건)
* 항상 많은 도움 고맙습니다.
* 지표 수정 좀 요청 드립니다
<요청1>
아래 수식에서 소리음 수정 좀 요청 드림니다. 소리가 안남니다.
## 강조
input : len(10),len2(10);
var : oo(0),cc(0),hh(0),ll(0);
var : haclose(0),haopen(0),hahigh(0),halow(0);
var : o2(0),c2(0),h2(0),l2(0);
oo=ema(open,len);
cc=ema(close,len);
hh=ema(high,len);
ll=ema(low,len);
haclose = (oo+hh+ll+cc)/4;
haopen = iff(IsNaN(haopen[1]) == true,(oo + cc)/2 , (haopen[1] + haclose[1]) / 2);
hahigh = max(h, max(haopen,haclose));
halow = min(l, min(haopen,haclose));
o2=ema(haopen, len2);
c2=ema(haclose, len2);
h2=ema(hahigh, len2);
l2=ema(halow, len2);
PlotPaintBar(h2,l2,c2,o2,"강조",IFf(C2>O2,Lime,Red));
{
PlotPaintBar(h2,l2,c2,o2,"강조",IFf(C2>O2,Rgb(255,0,0),Rgb(0,255,0)),Def,2);
if CountIf(var25 == var25[1],1) == 1 and var25 != var25[1] Then
PlaySound("C:KiwoomGlobalsoundsound1.wav");
}
여기에서 색상(Lime,Red)이 변경 될때
COUNDIF 로 1봉 까지만 소리음 나도록 수정좀 요청 드립니다.
<요청2> 수식 좀 부 탁 드림니다. (그림 첨부부분)
ㅇ 양봉박스 그리기
- 이전 200봉(변수) 기준
- 양봉의 긴몸통 봉 이 발생 하면(30틱이상(변수), 꼬리제외)(그림1)
- 긴몸통의 전봉 고점과 다음봉 저점을 박스로 표현(그림2)
→ 전봉과 다음봉은 음봉 양봉 관계 없음
→ 전봉과 다음봉이 겹칠수 있기에 전봉 고가 기준 기본 10틱 박스그리기 기본
- 박스길이는 다음가격이 박스권 하단 보다 작으면 박스 종료(사진2)
* 박스채우기 색상: RGB(255,255,0)
박스선 색상 : RGB(255,0,0)
박스선 굵기 : 2
ㅇ 음봉박스 그리기
- 이전 200봉(변수) 기준
- 음봉의 긴몸통 봉 이 발생 하면(30틱이상(변수), 꼬리제외)(그림1)
- 긴몸통의 전봉 고점과 다음봉 저점을 박스로 표현(그림2)
→ 전봉과 다음봉은 음봉 양봉 관계 없음
→ 전봉과 다음봉이 겹칠수 있기에 전봉 고가 기준 기본 10틱 박스그리기 기본
- 박스길이는 다음가격이 박스권 하단 보다 작으면 박스 종료(사진2)
* 박스채우기 색상: RGB(0,255,0)
박스선 색상 : RGB(255,0,0)
빅스선 굵기 : 2
* 항상 큰 도움에 고맙습니다. 수고하십시요.
2025-02-24
437
글번호 188451
지표
답변완료
수식 부탁드립니다.
항상 도움주셔서 감사합니다.
트레이딩뷰에 있는 선행예상지표입니다.
예스트레이더 지표수식과 종목검색 부탁드립니다.
// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/
// © LuxAlgo
//@version=5
indicator("Echo Forecast [LuxAlgo]","LuxAlgo - ECHO", overlay = true, max_bars_back = 1000, max_lines_count = 200)
//-----------------------------------------------------------------------------}
//Settings
//-----------------------------------------------------------------------------{
length = input.int(50, 'Evaluation Window', minval = 0, maxval = 200)
fcast = input.int(50, 'Forecast Window', minval = 1, maxval = 200)
fmode = input.string('Similarity', 'Forecast Mode', options = ['Similarity','Dissimilarity'])
cmode = input.string('Cumulative', 'Forecast Construction', options = ['Cumulative','Mean','Linreg'])
src = input(close)
//Style
fcastCss = input(#2157f3, 'Forecast Style', inline = 'fcast_style', group = 'Style')
fcastStyle = input.string('· · ·', '', options = ['──','- - -','· · ·'], inline = 'fcast_style', group = 'Style')
showArea = input(true,'Show Area', inline = 'areas', group = 'Style')
refArea = input(color.new(#ff5d00, 80), '', inline = 'areas', group = 'Style')
corrArea = input(color.new(#089981, 80), '', inline = 'areas', group = 'Style')
evalArea = input(color.new(color.gray, 80),'', inline = 'areas', group = 'Style')
//-----------------------------------------------------------------------------}
//Populate line arrays
//-----------------------------------------------------------------------------{
var lines = array.new_line(0)
if barstate.isfirst
for i = 0 to fcast-1
array.push(lines,line.new(na,na,na,na
, style = fcastStyle == '- - -' ? line.style_dashed : fcastStyle == '· · ·' ? line.style_dotted : line.style_solid
, color = fcastCss))
//-----------------------------------------------------------------------------}
//Calculations
//-----------------------------------------------------------------------------{
var eval_window = box.new(na,na,na,na,na, bgcolor = evalArea)
var ref_window = box.new(na,na,na,na,na, bgcolor = refArea)
var corr_window = box.new(na,na,na,na,na, bgcolor = corrArea)
n = bar_index
d = src - src[1]
//Get range maximum/minimum
top = ta.highest(src, length + fcast * 2)
btm = ta.lowest(src, length + fcast * 2)
//Set forecast
if barstate.islast
k = 0
float val = na
A = array.new_float(0) //Calculation window
X = array.new_int(0) //Linreg independant variable
//Populate calculation window
for i = 0 to fcast*2+length
A.push(src[i])
//Populate independant variable array
if cmode == 'Linreg'
X.push(n[i])
a = A.slice(0, fcast-1) //Reference window
//Find window to produce forecast
for i = 0 to length-1
b = A.slice(fcast + i, fcast * 2 + i - 1) //Evaluation window
r = a.covariance(b) / (a.stdev() * b.stdev()) //Correlation
//Maximization or minimization problem
if fmode == 'Similarity'
val := r >= nz(val, r) ? r : val
else
val := r <= nz(val, r) ? r : val
k := val == r ? i : k
//Set ECHO
prev = src
current = src
for i = 0 to fcast-1
e = d[fcast + k + (fcast-i-1)]
//Get forecast point
if cmode == 'Mean'
current := array.avg(a) + e
else if cmode == 'Linreg'
a = A.slice(0, fcast)
x = X.slice(0, fcast)
alpha = a.covariance(x) / x.variance()
beta = a.avg() - alpha * x.avg()
current := alpha * (n + i + 1) + beta + e
else
current += e
l = lines.get(i)
l.set_xy1(n+i, prev)
l.set_xy2(n+i+1, current)
prev := current
//Set areas
if showArea
//Evaluation window
eval_window.set_lefttop(n-length-fcast*2+1, top)
eval_window.set_rightbottom(n-fcast+1, btm)
//Reference window
ref_window.set_lefttop(n-fcast+1, top)
ref_window.set_rightbottom(n, btm)
//Correlation window
corr_window.set_lefttop(n-k-fcast*2+1, top)
corr_window.set_rightbottom(n-k-fcast, btm)
//-----------------------------------------------------------------------------}
부탁드립니다.
2025-02-22
471
글번호 188446
지표
답변완료
시스템 트레이딩 수식 변환 부탁드립니다
지난번에 문의를 드렸지만 제대로 구현이 되지 않아서 전략을 설명하는 이미지와 전략을 구현한 파인스크립트 소스를 첨부드립니다. 또한 덧붙인 추가적인 예외 상황까지 참고하시어 예스랭기지로 변환 부탁드리겠습니다.
①롱 진입 : 100일 이평선을 상향 돌파 마감한 캔들의 시초가를 기준점으로 설정, 다음 캔들부터 +100틱에서 롱 포지션 진입.(그림1)
②숏 진입 : 200일 이평선을 하향 돌파 마감한 캔들의 시초가를 기준점으로 설정, 다음 캔들부터 -100틱에서 숏 포지션 진입.(그림2)
③기존 포지션이 있을 경우, 진입 조건을 만족해도 추가로 진입하지 않음.
④익절과 손절은 각각 100틱
⑤나스닥 100 선물 1계약
[추가 상황] 기준 이평선 돌파 캔들(X)의 시가와 종가의 갭이 +-100틱을 넘어설 경우, X 캔들의 다음 캔들(X+1)부터 X 캔들의 시초가 +-100틱 지점을 지정가로 포지션 진입.
-롱 : A 캔들이 100일 이평 상향 돌파 마감. A캔들 시초가 10,000, 종가 10,100 가정했을 때, A+1 캔들부터 +100틱인 10,025에서 지정가로 포지션 진입(그림3)
-숏 : B 캔들이 200일 이평 하향 돌파 마감. B캔들 시초가 10,000, 종가 9,000 가정했을 때, B+1 캔들부터 -100틱인 9,975에서 지정가로 포지션 진입(그림4)
//@version=5
strategy("Auto Trading", overlay=true)
// 설정 변수
lengthLong = 100
lengthShort = 200
tickSize = syminfo.mintick
tickOffset = 100 * tickSize
tp_sl_ticks = 100 * tickSize
// 이동평균선 계산
ma100 = ta.sma(close, lengthLong)
ma200 = ta.sma(close, lengthShort)
// 캔들 정보
prevOpen = ta.valuewhen(close > ma100 and ta.crossover(close, ma100), open, 0)
shortPrevOpen = ta.valuewhen(close < ma200 and ta.crossunder(close, ma200), open, 0)
// 진입 가격 계산
longEntryPrice = prevOpen + tickOffset
shortEntryPrice = shortPrevOpen - tickOffset
// 포지션 보유 여부 확인
hasPosition = strategy.position_size != 0
// 롱 진입 조건 (기존 포지션 없고, 조건 충족 시)
longCondition = not hasPosition and ta.crossover(close, ma100)
if (longCondition)
strategy.entry("Long", strategy.long, qty=1, stop=longEntryPrice)
strategy.exit("Long TP/SL", from_entry="Long", limit=longEntryPrice + tp_sl_ticks, stop=longEntryPrice - tp_sl_ticks)
// 숏 진입 조건 (기존 포지션 없고, 조건 충족 시)
shortCondition = not hasPosition and ta.crossunder(close, ma200)
if (shortCondition)
strategy.entry("Short", strategy.short, qty=1, stop=shortEntryPrice)
strategy.exit("Short TP/SL", from_entry="Short", limit=shortEntryPrice - tp_sl_ticks, stop=shortEntryPrice + tp_sl_ticks)
2025-02-24
440
글번호 188443
시스템