커뮤니티

예스랭귀지 Q&A

글쓰기
답변완료

[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내

안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
프로필 이미지
예스스탁
2026-02-27
7293
글번호 230811
지표
답변완료

다른 분봉 표현을 어떻게 하는지요?

안녕하세요 수고많습니다. 다른분들 질문을 찾다가 못찾아서 질문드립니다. 1. 제가 만들려고 하는 해외선물차트에서 기본은 2분봉에서 이평값과 10분봉에서 이평값, 20분에서 이평값을 참고하려면 어떻게 하면 될까요? 2분봉에서 이평값, 10분봉에서 이평값 20분에서 이평값을 각각 가져올 수 있나요? 2. 1번이 어렵다면 2분봉에서 5개,10개씩 합쳐서 평균값을 변수A = 5개 평균, 변수b=10개평균 이렇게 저장하면 이전값에 대하여 변수A[1],변수A[2].변수A[3]이런 식으로 가능한가요? 변수A에 대한 과거값은 출력해보니 10개 정도 가능한 것 같은데 과거값이 10개정도는 표현이 가능한가요? 2분봉에서 10분봉 추정할 수 있을까요? 단순이동평균이라면 var1 = (c + c[1] + c[2] + c[3] + c[4]) /5 var2 = ma(var1,5); 10분봉과 비슷한 흐름이 나올까요? 상승과 하락추세만 맞으면 될 듯합니다. 정확히 안맞아도 가능하면 됩니다. ### 질문을 올리고 테스트를 해보았는데 결과가 맞는지 헛갈립니다. 2분봉에서 5개씩 합쳐서 평균값을 내었을때 5분봉에 1개와 맞는지 모르겠습니다. 지표로 테스트하였습니다. Input : Period1(5), Period2(20); var : Sma1(0),Sma2(0),Ema1(0),Ema2(0),sma3(0),sma4(0),sma5(0),sma6(0); var : hap5(0), hap10(0); hap5 = (c+c[1]+c[2]+c[3]+c[4])/5; hap10 = (c+c[1]+c[2]+c[3]+c[4]+c[5]+c[6]+c[7]+c[8]+c[9])/10; Sma1 = ma(C,Period1); Sma2 = ma(C,Period2); Ema1 = Ema(C,Period1); Ema2 = Ema(C,Period2); sma3 = ma(hap5,Period1); sma4 = ma(hap5,Period2); sma5 = ma(hap10,Period1); sma6 = ma(hap10,Period2); ##sma3 = (sma1+sma1[1]+sma1[2]+sma1[3]+sma1[4])/5; ##sma4 = (sma1+sma1[1]+sma1[2]+sma1[3]+sma1[4]+sma1[5]+sma1[6]+sma1[7]+sma1[8]+sma1[9])/10; Plot1(Sma1, "이동평균1"); Plot2(Sma2, "이동평균2"); Plot3(Ema1, "지수이동평균1"); Plot4(Ema2, "지수이동평균2"); Plot5(sma3, "5이동평균1"); Plot6(sma4, "5이동평균2"); Plot7(sma5, "10이동평균1"); Plot8(sma6, "10이동평균2");
프로필 이미지
청주잡초
2017-11-02
227
글번호 113838
시스템
답변완료

수식 부탁 드립니다

Var : 전환선(0); 전환선 = (highest(H,9)+lowest(L,9))/2; Plot1(전환선, "전환선"); 위 전환선을 위로 2틱 돌파하면 매수 신호을 아래로 2틱 깨면 매도 신호을 나오게 부탁 드립니다 그리고 국선과 해선 모두 신호 후 수익 5틱단위로 표기 부탁 드립니다
프로필 이미지
아이아띠
2017-11-02
191
글번호 113837
시스템
답변완료

타주기 지표 문의드립니다.

문의드립니다. 타주기로 30분봉과 60틱차트로 놓고 시스템을 작성하려 합니다. 기준점을 이평선 지표로 주려고 하는데요 본래차트에서는 Y축을 가격으로 지정할수가있는데 타주기 차트에서는 Y축에 가격이 안되고 화면, 전체만 지정이 가능하네요 방법이 없는건가요?? 봉 갯수가 차이나서 그런걸까요?? 답변부탁드려요
프로필 이미지
하늘이여o
2017-11-01
242
글번호 113836
지표

하늘이여o 님에 의해서 삭제되었습니다.

프로필 이미지
하늘이여o
2017-11-01
0
글번호 113835
지표
답변완료

kalman filter 지표를 예스트렝이더로 구현 가능한가요?

static void matrix_multiply(float* A, float* B, int m, int p, int n, float* C) // Matrix Multiplication Routine { // A = input matrix (m x p) // B = input matrix (p x n) // m = number of rows in A // p = number of columns in A = number of rows in B // n = number of columns in B // C = output matrix = A*B (m x n) int i, j, k; for (i=0;i<m;i++) for(j=0;j<n;j++) { C[n*i+j]=0; for (k=0;k<p;k++) C[n*i+j]= C[n*i+j]+A[p*i+k]*B[n*k+j]; } } static void matrix_addition(float* A, float* B, int m, int n, float* C) // Matrix Addition Routine { // A = input matrix (m x n) // B = input matrix (m x n) // m = number of rows in A = number of rows in B // n = number of columns in A = number of columns in B // C = output matrix = A+B (m x n) int i, j; for (i=0;i<m;i++) for(j=0;j<n;j++) C[n*i+j]=A[n*i+j]+B[n*i+j]; } static void matrix_subtraction(float* A, float* B, int m, int n, float* C) // Matrix Subtraction Routine { // A = input matrix (m x n) // B = input matrix (m x n) // m = number of rows in A = number of rows in B // n = number of columns in A = number of columns in B // C = output matrix = A-B (m x n) int i, j; for (i=0;i<m;i++) for(j=0;j<n;j++) C[n*i+j]=A[n*i+j]-B[n*i+j]; } static void matrix_transpose(float* A, int m, int n, float* C) // Matrix Transpose Routine { // A = input matrix (m x n) // m = number of rows in A // n = number of columns in A // C = output matrix = the transpose of A (n x m) int i, j; for (i=0;i<m;i++) for(j=0;j<n;j++) C[m*j+i]=A[n*i+j]; } static int matrix_inversion(float* A, int n, float* AInverse) // Matrix Inversion Routine { // A = input matrix (n x n) // n = dimension of A // AInverse = inverted matrix (n x n) // This function inverts a matrix based on the Gauss Jordan method. // The function returns 1 on success, 0 on failure. int i, j, iPass, imx, icol, irow; float det, temp, pivot, factor; float* ac = (float*)calloc(n*n, sizeof(float)); det = 1; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { AInverse[n*i+j] = 0; ac[n*i+j] = A[n*i+j]; } AInverse[n*i+i] = 1; } // The current pivot row is iPass. // For each pass, first find the maximum element in the pivot column. for (iPass = 0; iPass < n; iPass++) { imx = iPass; for (irow = iPass; irow < n; irow++) { if (fabs(A[n*irow+iPass]) > fabs(A[n*imx+iPass])) imx = irow; } // Interchange the elements of row iPass and row imx in both A and AInverse. if (imx != iPass) { for (icol = 0; icol < n; icol++) { temp = AInverse[n*iPass+icol]; AInverse[n*iPass+icol] = AInverse[n*imx+icol]; AInverse[n*imx+icol] = temp; if (icol >= iPass) { temp = A[n*iPass+icol]; A[n*iPass+icol] = A[n*imx+icol]; A[n*imx+icol] = temp; } } } // The current pivot is now A[iPass][iPass]. // The determinant is the product of the pivot elements. pivot = A[n*iPass+iPass]; det = det * pivot; if (det == 0) { free(ac); return 0; } for (icol = 0; icol < n; icol++) { // Normalize the pivot row by dividing by the pivot element. AInverse[n*iPass+icol] = AInverse[n*iPass+icol] / pivot; if (icol >= iPass) A[n*iPass+icol] = A[n*iPass+icol] / pivot; } for (irow = 0; irow < n; irow++) { // Add a multiple of the pivot row to each row. The multiple factor // is chosen so that the element of A on the pivot column is 0. if (irow != iPass) factor = A[n*irow+iPass]; for (icol = 0; icol < n; icol++) { if (irow != iPass) { AInverse[n*irow+icol] -= factor * AInverse[n*iPass+icol]; A[n*irow+icol] -= factor * A[n*iPass+icol]; } } } } free(ac); return 1; } static void matrix_print(float* A, int m, int n) // Matrix print. { // A = input matrix (m x n) // m = number of rows in A // n = number of columns in A int i, j; for (i=0;i<m;i++) { printf("| "); for(j=0;j<n;j++) { printf("%7.3f ", A[n*i+j]); } printf("|₩n"); } } // n states // m inputs // r outputs #define n 2 #define m 1 #define r 1 float kalman_updat_(float gyroscope_rate, float accelerometer_angle) { // A is an n by n matrix // B is an n by m matrix // C is an r by n matrix // Sz is an r by r matrix // Sw is an n by n matrix // xhat is an n by 1 vector // P is an n by n matrix // y is an r by 1 vector // u is an m by 1 vector // Constants. static float A[n][n] = {{1.0, -0.019968}, {0.0, 1.0}}; static float B[n][m] = {{0.019968}, {0.0}}; static float C[r][n] = {{1.0, 0.0}}; static float Sz[r][r] = {{17.2}}; static float Sw[n][n] = {{0.005, 0.005}, {0.005, 0.005}}; // Persistant states. static float xhat[n][1] = {{0.0}, {0.0}}; static float P[n][n] = {{0.005, 0.005}, {0.005, 0.005}}; // Inputs. float u[m][m]; // Gyroscope rate. float y[m][m]; // Accelerometer angle. // Temp values. float AP[n][n]; // This is the matrix A*P float CT[n][r]; // This is the matrix C' float APCT[n][r]; // This is the matrix A*P*C' float CP[r][n]; // This is the matrix C*P float CPCT[r][r]; // This is the matrix C*P*C' float CPCTSz[r][r]; // This is the matrix C*P*C'+Sz float CPCTSzInv[r][r]; // This is the matrix inv(C*P*C'+Sz) float K[n][r]; // This is the Kalman gain. float Cxhat[r][1]; // This is the vector C*xhat float yCxhat[r][1]; // This is the vector y-C*xhat float KyCxhat[n][1]; // This is the vector K*(y-C*xhat) float Axhat[n][1]; // This is the vector A*xhat float Bu[n][1]; // This is the vector B*u float AxhatBu[n][1]; // This is the vector A*xhat+B*u float AT[n][n]; // This is the matrix A' float APAT[n][n]; // This is the matrix A*P*A' float APATSw[n][n]; // This is the matrix A*P*A'+Sw float KC[n][n]; // This is the matrix K*C float KCP[n][n]; // This is the matrix K*C*P float KCPAT[n][n]; // This is the matrix K*C*P*A' // Fill in inputs. u[0][0] = gyroscope_rate; y[0][0] = accelerometer_angle; #if 0 // Print various matrices. printf("u =₩n"); matrix_print((float*) u, m, m); printf("y =₩n"); matrix_print((float*) y, m, m); printf("A =₩n"); matrix_print((float*) A, n, n); printf("B =₩n"); matrix_print((float*) B, n, m); printf("State =₩n"); matrix_print((float*) xhat, n, 1); #endif // Updat the state estimate by extrapolating estimate with gyroscope input. // xhat_est = A * xhat + B * u matrix_multiply((float*) A, (float*) xhat, n, n, 1, (float*) Axhat); matrix_multiply((float*) B, (float*) u, n, r, 1, (float*) Bu); matrix_addition((float*) Axhat, (float*) Bu, n, 1, (float*) AxhatBu); #if 0 printf("State Estimate =₩n"); matrix_print((float*) AxhatBu, n, 1); #endif // Compute the innovation. // Inn = y - c * xhat; matrix_multiply((float*) C, (float*) xhat, r, n, 1, (float*) Cxhat); matrix_subtraction((float*) y, (float*) Cxhat, r, 1, (float*) yCxhat); #if 0 printf("Innovation =₩n"); matrix_print((float*) yCxhat, r, 1); #endif // Compute the covariance of the innovation. // s = C * P * C' + Sz matrix_transpose((float*) C, r, n, (float*) CT); matrix_multiply((float*) C, (float*) P, r, n, n, (float*) CP); matrix_multiply((float*) CP, (float*) CT, r, n, r, (float*) CPCT); matrix_addition((float*) CPCT, (float*) Sz, r, r, (float*) CPCTSz); // Compute the kalman gain matrix. // K = A * P * C' * inv(s) matrix_multiply((float*) A, (float*) P, n, n, n, (float*) AP); matrix_multiply((float*) AP, (float*) CT, n, n, r, (float*) APCT); matrix_inversion((float*) CPCTSz, r, (float*) CPCTSzInv); matrix_multiply((float*) APCT, (float*) CPCTSzInv, n, r, r, (float*) K); // Updat he state estimate. // xhat = xhat_est + K * Inn; matrix_multiply((float*) K, (float*) yCxhat, n, r, 1, (float*) KyCxhat); matrix_addition((float*) AxhatBu, (float*) KyCxhat, n, 1, (float*) xhat); // Compute the new covariance of the estimation error. // P = A * P * A' - K * C * P * A' + Sw matrix_transpose((float*) A, n, n, (float*) AT); matrix_multiply((float*) AP, (float*) AT, n, n, n, (float*) APAT); matrix_addition((float*) APAT, (float*) Sw, n, n, (float*) APATSw); matrix_multiply((float*) K, (float*) C, n, r, n, (float*) KC); matrix_multiply((float*) KC, (float*) P, n, n, n, (float*) KCP); matrix_multiply((float*) KCP, (float*) AT, n, n, n, (float*) KCPAT); matrix_subtraction((float*) APATSw, (float*) KCPAT, n, n, (float*) P); // Return the estimate. return xhat[0][0]; } int main(int argc, char **argv) { int i; float gyro_input; float accel_input; float kalman_output; for (i = 0; i < SAMPLE_COUNT; ++i) { // Get the gyro and accelerometer input. gyro_input = sample_data[i][0]; accel_input = sample_data[i][1]; // Updat the Kalman filter and get the output. kalman_output = kalman_updat(gyro_input, accel_input); // Print out input data and the kalman output. printf("%d gyro=%7.3f deg/sec accel=%7.3f degrees kalman_output=%5.1f degrees₩n", i, gyro_input, accel_input, kalman_output); } return 0; }
프로필 이미지
영원한자유
2017-11-01
672
글번호 113834
지표
답변완료

문의요~

if MarketPosition == 1 Then ExitLong("항롱손절",AtStop,EntryPrice-PriceScale*40); if MarketPosition == -1 Then ExitShort("항숏손절",AtStop,EntryPrice+PriceScale*40); } 1. 손절식이거든요~ 조건만족시에 즉시 주문이 나가게 할려고 하는데 봉이 완성되고나서 주문이 나가는거 같아서요~ 맞게 작성이 된건지 문의드립니다. 2. 당일 손실200틱이상이면 해당종목에서 더이상 진입신호 안나오는 식도 부탁드립니다. 3. 최근100개봉 중에서 양봉의개수가 60개이상이거나 음봉의개수가60개이상일때만 진입신호가 나오게 부탁드립니다. 4.그리고 하나더 추가해서 최근100봉중에서 봉의 평균절대값이4틱이상이다도 부탁드릴게요~
프로필 이미지
겐지
2017-11-02
192
글번호 113833
시스템
답변완료

수식 수정부탁드립니다

안녕하세요? 최근고점과 직전고점위 10틱 위에 원(또는 점)으로 고점이 출력되도록 표시되고.... 최근저점과 직전저점아래 10틱 아래에 원(또는 점) 으로 저점이 출력되도록 부탁드립니다. 54927번 식은 아래와 같습니다..... input : Left(3),Right(3); var : SHV1(0),SHV2(0),SHL1(0),SHL2(0); var : SLV1(0),SLV2(0),SLH1(0),SLH2(0); var : AA(0),BB(0),CC(0); if SwingHigh(1,h,Left,right,left+right+1) != -1 Then{ SHV1 = H[Right]; //최근고점 SHV2 = SHV1[1]; //직전고점 SHL1 = L; //최근 고점이후 최저가 저장할 변수 초기값 SHL2 = SHL1[1]; //직전고점과 최근고점 사이 최저가 } #최근 고점 발생 후 최저가 갱신 If SHV1 > 0 and L < SHL1 Then SHL1 = L; #종가가 최근 고점보다 클때 if SHV2 > 0 and C > SHV1 Then{ AA = SHL2; BB = SHV1; CC = SHL1; } if SwingLow(1,L,Left,right,left+right+1) != -1 Then{ SLV1 = L[Right]; //최근저점 SLV2 = SLV1[1]; //직전저점 SLH1 = H; //최근 저점이후 최고가 저장할 변수 초기값 SLH2 = SLH1[1]; //직전저점과 최근저점 사이 최고가 } #최근 저점 발생 후 최고가 갱신 If SLV1 > 0 and H > SLH1 Then SLH1 = H; #종가가 최근 저점보다 작을때 if C < SLV1 and SLV2 > 0 Then{ AA = SLH2; BB = SLV1; CC = SLH1; }
프로필 이미지
추세승리
2017-11-01
232
글번호 113830
지표
답변완료

문의드립니다

안녕하세요? 아래수식에서 신호발생후 한개봉이후에 다시조건이만족하면 신호가발생하게해주세요 제가원하는것은 양봉3개 또는 음봉3개가 나올때마다 발생하는sound를 듣기위함입니다 항시집중할수가없어서 입니다 아래수식이가지고있는 저에게 한가지문제점은 포지션을 보유하고있는경우에는 양봉3개나 음봉3개가 다시발생해도 이미보유하고있는포지션으로 인해 보유포지션의 신호가 청산이되기전가지는 양봉3개 또는 음봉3개가 나와도 또발생하지않는점입니다 if CountIF(C>O,3)==3 Then buy(); if CountIF(C<O,3)==3 Then Sell(); 감사합니다
프로필 이미지
매일
2017-11-01
246
글번호 113827
시스템
답변완료

수식 문의 드립니다.

수고하십니다. 아래 수식을 기본으로 변경가능한 일정한 기간(P)내에 Condition1의 조건을 1회이상 만족하고 그 기간동안에 만족한 회수를 합산한 검색결과값으로 나타내는 종목검색식으로 변경 해주시면 고맙겠습니다. input : P(10); Condition1 = V >= V[1]*1.5 and C > O and H-max(C,O) >= abs(C-O)*0.5; if countif(Condition1==true,P) >= 2 Then find(1);
프로필 이미지
자아준
2017-11-01
220
글번호 113826
종목검색