커뮤니티

예스랭귀지 Q&A

글쓰기
답변완료

강조식캔들 부탁드립니다.

안녕하세요. 캔들강조를 표현하고자합니다. 1. 종가가 중심가와 시가보다 높으면 RED 2. 종가가 중심가보다 낮고 시가보다 높으면 Magenta 3. 종가가 중심가와 시가보다 낮으면 Blue 4. 종가가 시가보다 낮고 중심가보다 높으면 Cyan 부탁드립니다. 감사드립니다.
프로필 이미지
포보스
2023-10-31
927
글번호 173565
강조
답변완료

수식 전환 부탁드립니다

안녕하세요 항상 감사합니다 트레이딩뷰 수식전환부탁드립니다 indicator('Nadaraya-Watson: Rational Quadratic Kernel (Non-Repainting)', overlay=true, timeframe="") // Settings src = input.source(close, 'Source') h = input.float(8., 'Lookback Window', minval=3., tooltip='The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars. Recommended range: 3-50') r = input.float(8., 'Relative Weighting', step=0.25, tooltip='Relative weighting of time frames. As this value approaches zero, the longer time frames will exert more influence on the estimation. As this value approaches infinity, the behavior of the Rational Quadratic Kernel will become identical to the Gaussian kernel. Recommended range: 0.25-25') x_0 = input.int(25, "Start Regression at Bar", tooltip='Bar index on which to start regression. The first bars of a chart are often highly volatile, and omission of these initial bars often leads to a better overall fit. Recommended range: 5-25') smoothColors = input.bool(false, "Smooth Colors", tooltip="Uses a crossover based mechanism to determine colors. This often results in less color transitions overall.", inline='1', group='Colors') lag = input.int(2, "Lag", tooltip="Lag for crossover detection. Lower values result in earlier crossovers. Recommended range: 1-2", inline='1', group='Colors') size = array.size(array.from(src)) // size of the data series // Further Reading: // The Kernel Cookbook: Advice on Covariance functions. David Duvenaud. Published June 2014. // Estimation of the bandwidth parameter in Nadaraya-Watson kernel non-parametric regression based on universal threshold level. Ali T, Heyam Abd Al-Majeed Hayawi, Botani I. Published February 26, 2021. kernel_regression(_src, _size, _h) => float _currentWeight = 0. float _cumulativeWeight = 0. for i = 0 to _size + x_0 y = _src[i] w = math.pow(1 + (math.pow(i, 2) / ((math.pow(_h, 2) * 2 * r))), -r) _currentWeight += y*w _cumulativeWeight += w _currentWeight / _cumulativeWeight // Estimations yhat1 = kernel_regression(src, size, h) yhat2 = kernel_regression(src, size, h-lag) // Rates of Change bool wasBearish = yhat1[2] > yhat1[1] bool wasBullish = yhat1[2] < yhat1[1] bool isBearish = yhat1[1] > yhat1 bool isBullish = yhat1[1] < yhat1 bool isBearishChange = isBearish and wasBullish bool isBullishChange = isBullish and wasBearish // Crossovers bool isBullishCross = ta.crossover(yhat2, yhat1) bool isBearishCross = ta.crossunder(yhat2, yhat1) bool isBullishSmooth = yhat2 > yhat1 bool isBearishSmooth = yhat2 < yhat1 // Colors color c_bullish = input.color(#3AFF17, 'Bullish Color', group='Colors') color c_bearish = input.color(#FD1707, 'Bearish Color', group='Colors') color colorByCross = isBullishSmooth ? c_bullish : c_bearish color colorByRate = isBullish ? c_bullish : c_bearish color plotColor = smoothColors ? colorByCross : colorByRate // Plot plot(yhat1, "Rational Quadratic Kernel Estimate", color=plotColor, linewidth=2) // Alert Variables bool alertBullish = smoothColors ? isBearishCross : isBearishChange bool alertBearish = smoothColors ? isBullishCross : isBullishChange // Alerts for Color Changes alertcondition(condition=alertBullish, title='Bearish Color Change', message='Nadaraya-Watson: {{ticker}} ({{interval}}) turned Bearish ▼') alertcondition(condition=alertBearish, title='Bullish Color Change', message='Nadaraya-Watson: {{ticker}} ({{interval}}) turned Bullish ▲') // Non-Displayed Plot Outputs (i.e., for use in other indicators) plot(alertBearish ? -1 : alertBullish ? 1 : 0, "Alert Stream", display=display.none)
프로필 이미지
seayun1
2023-10-31
1238
글번호 173563
지표
답변완료

참조데이타의 이전봉들과 비교식

수고 많으십니다. 선물 참조데이타를 외국인과 기관의 선물 순매수금액 기준으로 진입식을 하기와 같이 만들었는데 맞게 된건지 확인좀 부탁드립니다. 조건식설명: 1분봉기준 참조데이타2(외국인순매수금액)의 현재봉종가가 3봉전종가들의 평균가와의 차이 참조데이타3(기관계순매수금액)의 현재봉종가가 3봉전종가들의 평균가와의 차이 --> 참조데이타2의 차이 + 참조데이타3의 차이 합이 0보다 크면 매수진입. //데이타2참조 Var : B_2.0_value1(0); B_2.0_value1 = data2(C); Var : B_2.1_value1(0); B_2.1_value1 = data2(C[1]); Var : B_2.2_value1(0); B_2.2_value1 = data2(C[2]); Var : B_2.3_value1(0); B_2.3_value1 = data2(C[3]); //데이타3참조 Var : B_3.0_value1(0); B_3.0_value1 = data3(C); Var : B_3.1_value1(0); B_3.1_value1 = data3(C[1]); Var : B_3.2_value1(0); B_3.2_value1 = data3(C[2]); Var : B_3.3_value1(0); B_3.3_value1 = data3(C[3]); Var : B_A_CondResult(FALSE), B_A_TempResult(FALSE), B_A_Condition1(FALSE); B_A_Condition1 = (B_2.0_value1-((B_2.1_value1+B_2.2_value1+B_2.3_value1)/3))+(B_3.0_value1-((B_3.1_value1+B_3.2_value1+B_3.3_value1)/3)) > 0; B_A_TempResult = B_A_Condition1; B_A_CondResult = B_A_TempResult; if B_A_CondResult Then Buy("", AtMarket);
프로필 이미지
페리도트
2023-10-31
765
글번호 173562
시스템
답변완료

문의드립니다.

당일 발생되는 양봉중, 거래량이 1000 이상이면서, 당일 양봉거래량의 고점을 갱신할것. 동시에 고점 거래량봉은 1봉전 봉대비 2분 이내에 발생된 봉일것. 감사합니다.
프로필 이미지
zigzig
2023-10-31
836
글번호 173561
지표
답변완료

문의드립니다.

양봉의 거래량은 양수, 음봉의 거래량은 음수로 표시된다고 가정하고, 최근 20봉의 거래량 합이 음수에서 양수로 전환된 후 1000을 돌파할때, 돌파할때의 가장최근 음수에서 양수로 전환된 시점의 이전 10봉중 최저가격을 선으로 나타내고 싶습니다. 감사합니다.
프로필 이미지
zigzig
2023-10-31
884
글번호 173560
지표
답변완료

도움 요청합니다.

늘 감사드립니다. 입력변수(봉개수)에 따라 1. 각 봉의 고가를 연결하는 입력변수의 평균 Plot 2. 각 봉의 종가를 연결하는 입력변수의 평균 Plot 3. 각 봉의 저가를 연결하는 입력변수의 평균 Plot 부탁드립니다. 감사합니다.
프로필 이미지
포보스
2023-10-31
717
글번호 173559
지표
답변완료

문의드립니다

시초가대비 -3% 와 +3% 에 선을긋고싶습니다
프로필 이미지
처음처럼22
2023-10-31
942
글번호 173557
지표
답변완료

도움을 요청합니다.

안녕하세요? 다음 수식은 참조Data3만을 가지고 표현한건데요 참조Data3+참조Data4를 더한 값으로 수정해주시면 대단히 감사하겠습니다. 미리 감사드립니다. 꾸뻑 오늘도 좋은하루 되세요. =========================== var : C2(0,Data3),H2(0,Data3),L2(0,Data3),cnt(0,Data3); var : Sidx(0,Data3),Sidx1(0,Data3),Eidx(0,Data3),Eidx1(0,Data3),Pre1(0,Data3); C2 = Data3(c); if Data3(Bdate != Bdate[1]) Then { H2 = C2; L2 = C2; Sidx = data3(Index); Sidx1 = Sidx[1]; Eidx1 = Eidx[1]; } Eidx = data3(Index); if data3(Bdate != Bdate[1] or (Bdate == bdate[1] and C2 > h2)) Then h2 = C2; if data3(Bdate != Bdate[1] or (Bdate == Bdate[1] and C2 < l2)) Then l2 = C2; if Sidx1 > 0 Then { pre1 = 0; For cnt = data3(Index)-Eidx1 to data3(Index)-Sidx1 { if data3(sDate[cnt] < sDate and sTime[cnt] <= sTime) Then { pre1 = C2[cnt]; cnt = data3(Index-Sidx1+1); } } } if CurrentDate == sDate Then { if Data1(sDate) == Data3(sDate) Then { Plot1(C2,"참조",IFf(C2 >0,RGB(0,0,0),RGB(0,0,0))); Plot2(H2,"최고"); Plot3(L2,"최저"); Plot4(pre1,"전일"); PlotBaseLine1(0); } Else { NoPlot(1); NoPlot(2); NoPlot(3); NoPlot(4); } } if CurrentDate == sDate and Data1(sDate) == Data3(sDate) Then { Plot5(Data3(OpenD(0)),"D2당일시가"); Plot6(Data3(HighD(0)),"D2당일고가"); Plot7(Data3(LowD(0)),"D2당일저가"); Plot8(Data3(LowD(0)+(HighD(0)- LowD(0))*0.236),"23.6%"); Plot9(Data3(LowD(0)+(HighD(0)- LowD(0))*0.764),"76.4%"); Plot10(Data3(LowD(0)+(HighD(0)- LowD(0))*0.382),"38.2%"); Plot11(Data3(LowD(0)+(HighD(0)- LowD(0))*0.618),"61.8%"); Plot12(Data3(LowD(0)+(HighD(0)- LowD(0))*0.50),"50.0%"); }
프로필 이미지
포보스
2023-10-31
919
글번호 173556
지표
답변완료

재문의 드립니다.

var : TC(0),Pivot(0),BC(0); TC = (Pivot - BC) + Pivot; Pivot = (High + Low + Close)/3; BC = (High + Low)/2; Plot1(TC); Plot2(PIVOT); Plot3(BC); 위 수식으로 구글 검색에서 캡쳐해온 이미지처럼 나오길 기대했는데 올린 이미지처럼 나옵니다. 혹시 수정이 가능할까요?
프로필 이미지
신대륙발견
2023-10-31
944
글번호 173554
지표
답변완료

진짜 진짜 무식한 질문드립니다

지난 번 다음과 같은 너무 고마운 가르침을 주셨습니다. 정말 감사드립니다. <지난 번 답변: 이하 시작> 문의하신 내용은 참조데이터를 이용하는 전략으로 구현하셔야 합니다. 차트왼쪽 상단의 종목선택버튼 중 왼쪽버튼은 기본종목, 오른쪽버튼은 참조데이터를 추가하는 버튼입니다. 기본종목은 data1이고 참조데이터는 추가하는 순서로 data2,data3과 같은 데이터 번호가 부여되며 수식에서 이 데이터번호를 지정해서 값을 가져와 사용합니다. 시스템은 기본종목를 대상으로 신호와 주문이 가능하므로 옵션을 기본종목으로 차트를 열고 선물을 참조데이터 차트에 추가후에 전략구현하시면 됩니다. 아래는 간단히 이평크로스 전략을 data2를 기준으로 조건을 체크하고 신호는 기본종목(data1)에 발생하는 수식입니다. input : P1(5),P2(20); var : mav1(0,data2),mav2(0,Data2); mav1 = data2(ma(C,P1)); mav2 = data2(ma(C,P2)); if MarketPosition <= 0 and CrossUp(mav1,mav2) Then Buy(); if MarketPosition >= 0 and CrossDown(mav1,mav2) Then Sell(); <이상 끝> 그런데 제가 너무 무식해서 이걸로 아무리 고쳐도 도저히 해결이 되지 않습니다. ^^;; 솔직히 말씀드리면 그냥 이런게 필요합니다. 즉, 선물이 어떤 포인트(x)를 뚫으면 옵션이 그 선물 포인트(x)에서 n계약이 자동 매수가 되는 그런 프로그램입니다. 기껏 좋은 거 가르쳐 주셨는데 너무 무식해서 죄송합니다. 감사합니다.
프로필 이미지
hunter33
2023-10-31
826
글번호 173553
시스템