커뮤니티

예스랭귀지 Q&A

글쓰기
답변완료

질문 부탁드립니다

답변 감사드립니다 고가를 구하는 식을 작성을 해봤는데요 이전의 고가를 참조해서 다음 봉에서 계속 비교를 하려고 하는데요 3번째 까지만 수행을 하고 var1에는 첫번째 고가 ( 가장 먼저 나온) var2 에는 세번째 고가를 저장하려고 합니다 식이 맞는건지 궁금합니다 그리고 3번째 까지만 수행을 하고 비교를 종료하게 할 수도 있을까요? 아니면 프로그래밍 구조상 if h>l*1.10 이 나오기전까지 계속 작동을 해야하나요?? 감사합니다 if h>l*1.10 then { ... ah=0; count=0; } else { if h>ah and h*1.15>aa[0] and l<aa[0] then { ah=h; count=count+1; if count==1 then var1=h; if count==3 then var2=h; } }
프로필 이미지
yamu
2025-06-17
170
글번호 191783
지표

yamu 님에 의해서 삭제되었습니다.

프로필 이미지
yamu
2025-06-16
0
글번호 191782
지표
답변완료

변환부탁드려요.

안녕하세요? 파인스크립트를 예스랭귀지로 변환해 보았는데, 에러는 안납니다. 그런데, 너무 부하가 걸리는지 죽어버립니다. 파인스크립트에 맞게 최대한 수정바라겠습니다. == My 변환 == // ▒▒▒▒ 외부 입력 변수 ▒▒▒▒ Input : lengthAlma(8), smooth(1), offset(0.85), sigmaAlma(7), lengthRsi(14), lengthChande(9), glength(9), sigmaGama(1.8), ls_length(20), signalGap(5), level3Color(RGB(56,56,56)), level3Width(1), level7Color(RGB(56,56,56)), level7Width(1); // ▒▒▒▒ 배열 선언 ▒▒▒▒ Array : level[11](0); // 레벨 0~10 구간 가격 Array : tlID[11](0) ; // 레벨별 수평선 오브젝트ID // ▒▒▒▒ 내부 변수 선언 ▒▒▒▒ Var : avpchange(0.0), rsi(0.0), rsiL(false), rsiS(false); Var : chandeMO(0.0), cL(false), cS(false); Var : gma(0.0), sumOfWeights(0.0), weight(0.0), value(0.0); Var : lastSignalBar(0), curBar(0), uptrend(false), dntrend(false); Var : momm(0.0), m1(0.0), m2(0.0), sm1(0.0), sm2(0.0); Var : strength(0), clamped_strength(0); Var : lower_band(0.0), upper_band(0.0), levelStep(0.0), price(0.0); Var : i(0); // ▒▒▒▒ lastSignalBar: na 대체 패턴(최초 바에서 -9999로 초기화) ▒▒▒▒ If BarIndex == 0 Then { lastSignalBar = -9999; } If C != 0 Then { avpchange = Avg((C - C[smooth]) / C * 100, lengthAlma); } rsi = RSI(lengthRsi); If rsi > rsi[1] Then { rsiL = True; } Else { rsiL = False; } If rsi < rsi[1] Then { rsiS = True; } Else { rsiS = False; } momm = C - C[1]; If momm >= 0 Then { m1 = momm; } Else { m1 = 0; } If momm < 0 Then { m2 = -momm; } Else { m2 = 0; } sm1 = 0; sm2 = 0; For i = 0 To lengthChande - 1 { If (C[i] - C[i+1]) >= 0 Then { sm1 = sm1 + (C[i] - C[i+1]); } Else { sm2 = sm2 + (C[i+1] - C[i]); } } If (sm1 + sm2) != 0 Then { chandeMO = 100 * (sm1 - sm2) / (sm1 + sm2); } Else { chandeMO = 0; } If chandeMO > chandeMO[1] Then { cL = True; } Else { cL = False; } If chandeMO < chandeMO[1] Then { cS = True; } Else { cS = False; } gma = 0; sumOfWeights = 0; For i = 0 To glength - 1 { weight = Exp(-Power(((i - (glength - 1)) / (2 * sigmaGama)), 2) / 2); value = Highest(avpchange, i+1) + Lowest(avpchange, i+1); gma = gma + (value * weight); sumOfWeights = sumOfWeights + weight; } If sumOfWeights != 0 Then { gma = (gma / sumOfWeights) / 2; } gma = EMA(gma, 7); If C > Avg(C, 50) Then { uptrend = True; } Else { uptrend = False; } If C < Avg(C, 50) Then { dntrend = True; } Else { dntrend = False; } lower_band = Lowest(L, ls_length); upper_band = Highest(H, ls_length); levelStep = (upper_band - lower_band) / 10; For i = 0 To 10 { level[i] = lower_band + levelStep * i; } strength = 0; For i = 0 To 10 { If CrossUp(C, level[i]) Then { strength = strength + 1; } If CrossDown(C, level[i])Then { strength = strength - 1; } } If strength < 0 Then { clamped_strength = 0; } Else If strength > 10 Then { clamped_strength = 10; } Else { clamped_strength = strength; } price = level[clamped_strength]; curBar = BarIndex; If CrossUp(avpchange, gma) and rsiL and cL and uptrend and (lastSignalBar < 0 or curBar - lastSignalBar > signalGap) Then { text_new(sDate, sTime, L - 2*PriceScale, "Long ▲"); lastSignalBar = curBar; } If CrossDown(avpchange, gma) and rsiS and cS and dntrend and (lastSignalBar < 0 or curBar - lastSignalBar > signalGap) Then { text_new(sDate, sTime, H + 2*PriceScale, "Short ▼"); lastSignalBar = curBar; } For i = 0 To 10 { If tlID[i] != 0 Then { TL_Delete(tlID[i]); } tlID[i] = TL_New(sDate[1], sTime[1], level[i], sDate, sTime, level[i]); If i = 3 Then { TL_SetColor(tlID[i], level3Color); TL_SetSize(tlID[i], level3Width); } Else If i = 7 Then { TL_SetColor(tlID[i], level7Color); TL_SetSize(tlID[i], level7Width); } Else { TL_SetColor(tlID[i], RGB(200,200,200)); TL_SetSize(tlID[i], 1); } } == 파인스크립트 원본 == indicator("전략", overlay=true, max_lines_count=500, max_labels_count=500) // === 3, 7 levels highlightColor3 = input.color(color.rgb(56, 56, 56), "Level 3 강조 색상") highlightWidth3 = input.int(1, "Level 3 선 두께", minval=1, maxval=5) highlightTransp3 = input.int(0, "Level 3 투명도", minval=0, maxval=100) highlightColor7 = input.color(color.rgb(56, 56, 56), "Level 7 강조 색상") highlightWidth7 = input.int(1, "Level 7 선 두께", minval=1, maxval=5) highlightTransp7 = input.int(0, "Level 7 투명도", minval=0, maxval=100) // === ALMA Smoothing src = input(close, title='Source', group = "ALMA Smoothing") smooth = input.int(1, title='Smoothing', minval=1, group = "ALMA Smoothing") length1 = input.int(8, title='Lookback', minval=1, group = "ALMA Smoothing") offset = 0.85 sigma1 = 7 pchange = ta.change(src, smooth) / src * 100 avpchange = ta.alma(pchange, length1, offset, sigma1) // === RSI & Chande rsi = ta.rsi(close, 14) rsiL = rsi > rsi[1] rsiS = rsi < rsi[1] length11 = 9 momm = ta.change(close) m1 = momm >= 0 ? momm : 0 m2 = momm < 0 ? -momm : 0 sm1 = math.sum(m1, length11) sm2 = math.sum(m2, length11) chandeMO = 100 * (sm1 - sm2) / (sm1 + sm2) cL = chandeMO > chandeMO[1] cS = chandeMO < chandeMO[1] // === GAMA glength = input.int(9, minval=1, title="GAMA Length", group = "Gaussian Adaptive Moving Average") sigma = input.float(1.8, minval=0.1, title="Standard Deviation", group = "Gaussian Adaptive Moving Average") var float gma = na var float sumOfWeights = na gma := 0.0 sumOfWeights := 0.0 for i = 0 to glength - 1 weight = math.exp(-math.pow(((i - (glength - 1)) / (2 * sigma)), 2) / 2) value = ta.highest(avpchange, i + 1) + ta.lowest(avpchange, i + 1) gma += (value * weight) sumOfWeights += weight gma := ta.ema((gma / sumOfWeights) / 2, 7) // === Color Theme colorTheme = input.string("Navy-Copper", title="Color Theme", options=["Cyan-Magenta", "Blue-Gold", "Indigo-Champagne", "Teal-Ruby", "Navy-Copper", "Teal-Gold"]) up_color = colorTheme == "Cyan-Magenta" ? color.rgb(10, 216, 182) : colorTheme == "Blue-Gold" ? color.rgb(30, 144, 255) : colorTheme == "Indigo-Champagne" ? color.rgb(128, 0, 128) : colorTheme == "Teal-Ruby" ? color.rgb(0, 160, 150) : colorTheme == "Navy-Copper" ? color.rgb(15, 76, 129) : colorTheme == "Teal-Gold" ? color.rgb(93, 158, 154) : color.rgb(255, 255, 255) // fallback dn_color = colorTheme == "Cyan-Magenta" ? color.rgb(212, 41, 184) : colorTheme == "Blue-Gold" ? color.rgb(255, 140, 0) : colorTheme == "Indigo-Champagne" ? color.rgb(218, 165, 32) : colorTheme == "Teal-Ruby" ? color.rgb(190, 30, 60) : colorTheme == "Navy-Copper" ? color.rgb(140, 74, 47) : colorTheme == "Teal-Gold" ? color.rgb(166, 124, 82) : color.rgb(255, 255, 255) // fallback // === Signal Labels var int lastSignalBar = na signalGap = 5 inUptrend = close > ta.sma(close, 50) inDntrend = close < ta.sma(close, 50) if ta.crossover(avpchange, gma) and rsiL and cL and inUptrend and (na(lastSignalBar) or bar_index - lastSignalBar > signalGap) label.new(bar_index, low, text="Long ▲", style=label.style_label_up, color=color.rgb(0, 161, 5), textcolor=color.white, size=size.normal) lastSignalBar := bar_index if ta.crossunder(avpchange, gma) and rsiS and cS and inDntrend and (na(lastSignalBar) or bar_index - lastSignalBar > signalGap) label.new(bar_index, high, text="Short ▼", style=label.style_label_down, color=color.rgb(215, 0, 0), textcolor=color.white, size=size.normal) lastSignalBar := bar_index alertcondition(ta.crossover(avpchange, gma) and rsiL and cL and inUptrend, title="Buy Signal", message="Go Long! {{exchange}}:{{ticker}}") alertcondition(ta.crossunder(avpchange, gma) and rsiS and cS and inDntrend, title="Sell Signal", message="Go Short! {{exchange}}:{{ticker}}") // === LEVELS STRENGTH INDEX int ls_length = input.int(20, 'Levels Length') int transp = input.int(5, 'Levels Transparency', minval = 2, maxval = 10) var float[] level = array.new_float(11, 0.0) var int strength = 0 float lower_band = ta.lowest(ls_length) float upper_band = ta.highest(ls_length) float step = (upper_band - lower_band) / 10 for i = 0 to 10 array.set(level, i, lower_band + step * i) float lvl = array.get(level, i) if ta.crossover(close, lvl) strength := strength + 1 if ta.crossunder(close, lvl) strength := strength - 1 clamped_strength = strength < 0 ? 0 : strength > 10 ? 10 : strength float price = barstate.islast ? array.get(level, clamped_strength) : close color[] colors = array.new_color(11) for i = 0 to 10 float lvl = array.get(level, i) color c = close > lvl ? color.new(up_color, 100 - transp * (i + 1)) : color.new(dn_color, 100 - transp * (11 - i)) array.set(colors, i, c) // === Plot Levels plot0 = plot(array.get(level, 0), color=array.get(colors, 0), display=display.all, title="Level 0") plot1 = plot(array.get(level, 1), color=array.get(colors, 1), display=display.all, title="Level 1") plot2 = plot(array.get(level, 2), color=array.get(colors, 2), display=display.all, title="Level 2") plot3 = plot(array.get(level, 3), color=array.get(colors, 3), display=display.all, title="Level 3") plot4 = plot(array.get(level, 4), color=array.get(colors, 4), display=display.all, title="Level 4") plot5 = plot(array.get(level, 5), color=array.get(colors, 5), display=display.all, title="Level 5") plot6 = plot(array.get(level, 6), color=array.get(colors, 6), display=display.all, title="Level 6") plot7 = plot(array.get(level, 7), color=array.get(colors, 7), display=display.all, title="Level 7") plot8 = plot(array.get(level, 8), color=array.get(colors, 8), display=display.all, title="Level 8") plot9 = plot(array.get(level, 9), color=array.get(colors, 9), display=display.all, title="Level 9") plot10 = plot(array.get(level, 10), color=array.get(colors, 10), display=display.all, title="Level 10") // === Intense plot(array.get(level, 3), title="Level 3 Highlight", color=color.new(highlightColor3, highlightTransp3), linewidth=highlightWidth3) plot(array.get(level, 7), title="Level 7 Highlight", color=color.new(highlightColor7, highlightTransp7), linewidth=highlightWidth7) // === Fill fill(plot0, plot1, color=array.get(colors, 1)) fill(plot1, plot2, color=array.get(colors, 1)) fill(plot2, plot3, color=array.get(colors, 2)) fill(plot3, plot4, color=array.get(colors, 3)) fill(plot4, plot5, color=array.get(colors, 4)) fill(plot5, plot6, color=array.get(colors, 5)) fill(plot6, plot7, color=array.get(colors, 6)) fill(plot7, plot8, color=array.get(colors, 7)) fill(plot8, plot9, color=array.get(colors, 8)) fill(plot9, plot10, color=array.get(colors, 9))
프로필 이미지
주식남
2025-06-16
324
글번호 191775
지표
답변완료

부탁드립니다

수고하십니다 아래수식을 예스로 부탁드립니다 1. 수식1 조건up = L>H(2)*(1+ratio/100)&& L<H(1) && L(1)<H(2); 조건dn = L(2)>H *(1+ratio/100)&& L(2)<H(1) && L(1)<H; 라인 = if(조건dn,L(2),if(조건up, L,0)); ValueWhen(1, 조건up or 조건dn,라인); 수식2 조건up = L>H(2)*(1+ratio/100)&& L<H(1) && L(1)<H(2); 조건dn = L(2)>H *(1+ratio/100)&& L(2)<H(1) && L(1)<H; 라인 = if(조건dn, H ,if(조건up, H(2),0)); ValueWhen(1, 조건up or 조건dn,라인); 지표설정 ratio 5 2. 수식1 조건up = L>H(2)*(1+ratio/100)&& L<H(1) && L(1)<H(2); ValueWhen(1,조건up,L); 수식2 조건up = L>H(2)*(1+ratio/100)&& L<H(1) && L(1)<H(2); ValueWhen(1,조건up,H(2)); FVG(일목균형표)2/2 수식3 조건dn = L(2)>H *(1+ratio/100)&& L(2)<H(1) && L(1)<H; ValueWhen(1,조건dn,L(2)); 수식4 조건dn = L(2)>H *(1+ratio/100)&& L(2)<H(1) && L(1)<H; ValueWhen(1,조건dn, H); 지표설정 ratio 5
프로필 이미지
파생돌이
2025-06-16
231
글번호 191768
지표
답변완료

수식 부탁드립니다.

input: 기간1(100); var : a1(0),최고v(0); a1=highest(v,기간1); if v==a1 Then 최고v=(h+l)/2; plot1(최고v, "최고거래량"); 위 수식을 차트겹치기에 적용하면 앞부분에 0값이 나와서 현재 차트가 잘안보이는데 최소값이 0이 안나오게 예를들어 max, min +- 30%이내로 설정하게 부탁드립니다.
프로필 이미지
허밍스타
2025-06-16
186
글번호 191766
지표
답변완료

문의

코스피 선물 5분봉 주간 데이트레이딩 기준입니다. 진입을 3번 하는 진입식이 있다고 할 때 거래 진입명칭은 b1,b2,b2 이렇게 나옵니다. b1 이름으로 첫번째 진입 b2 이름으로 두번째,세번째 진입합니다. 청산식은 진입명으로 매칭하여 아래식을 사용해왔습니다. 요청사항) 진입명이 아니고 진입순서에 따른 청산식을 아래처럼 적용하고 싶습니다. if MarketPosition== 1 Then { 첫번째 진입 경우 Then { SetStopLoss(1,PointStop); SetStopTrailing(2,0,PointStop); SetStopProfittarget(3,PointStop); } 두번째 진입 경우 Then { SetStopLoss(1.5,PointStop); SetStopTrailing(2.5,0,PointStop); SetStopProfittarget(3.5,PointStop); } 세번째 진입 경우 Then { SetStopLoss(2,PointStop); SetStopTrailing(3,0,PointStop); SetStopProfittarget(4,PointStop); } Else { SetStopLoss(0); SetStopTrailing(0,0); SetStopProfittarget(0); } } 수식 완성 부탁드립니다. 항상 고맙습니다. ********************************************************************************** if MarketPosition== 1 Then { if IsEntryName("b1") == true Then { SetStopLoss(1,PointStop); SetStopTrailing(2,0,PointStop); SetStopProfittarget(3,PointStop); } Else if IsEntryName("b2") == true Then { SetStopLoss(2,PointStop); SetStopTrailing(3,0,PointStop); SetStopProfittarget(4,PointStop); } Else { SetStopLoss(0); SetStopTrailing(0,0); SetStopProfittarget(0); } }
프로필 이미지
목마와숙녀
2025-06-16
178
글번호 191764
시스템
답변완료

종목검색식 부탁드림니다.

항상 노고에 감사드림니다. 아래의 수식을 종목검색식으로 부탁드림니다. M=((고가+저가)/2)*거래량/1000000001; 등락률=종가/종가(1)-1; X=IF(등락률<0,-M,M); Y=IF(등락률==0, 0,X); cc=합계(Y,기간); crossup(cc,0) 지표변수 기간 10
프로필 이미지
존슨비치
2025-06-16
226
글번호 191759
종목검색

고성 님에 의해서 삭제되었습니다.

프로필 이미지
고성
2025-06-16
57
글번호 191758
지표
답변완료

문의드립니다,

수고하십니다. 아래수식을 data2를 macd말고 이동평균선으로 변경부탁드립니다. input : short1(12),long1(26),sig1(9); input : short2(12),long2(26),sig2(9); input : Per(30); var : MACDO1(0,Data1),MACDO2(0,Data2); MACDO1 = Data1(MACD_OSC(short1,long1,sig1)); MACDO2 = Data2(MACD_OSC(short2,long2,sig2)); if MarketPosition == 0 and Data2(CrossUp(MACDO2,0)) Then Buy(); if MarketPosition == 1 Then { if data1(CrossDown(MACDO1,0)) Then ExitLong("bx1",OnClose,Def,"",Ceiling(MaxContracts*(Per/100)/10)*10,2); if data2(CrossDown(MACDO2,0)) Then ExitLong("bx2"); } 감사합니다
프로필 이미지
2685up
2025-06-16
193
글번호 191756
시스템

와우리 님에 의해서 삭제되었습니다.

프로필 이미지
와우리
2025-06-16
39
글번호 191748
시스템