커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
3255
글번호 230811
답변완료
수식 문의드립니다.
안녕하세요,
2023년 01월 25일 부터 주식시장 호가단위가 다음과 같이 변경된다고 하는데요.
2000 미만 : 1원
2000~5000 : 5원
5000~20000 : 10원
20000~50000 : 50원
50000~200000 : 100원
200000~500000 : 500원
500000 이상 : 1000원
(거래소/코스닥 동일)
위 사항을 적용하려면 이전에 알려주신 상한가 수식을 어떻게 변경해야 할까요?
--------------------------------------------------------------------
var : 상한가(0), UpLimit(0);
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0),Up7(0);
if date >= 19981207 then {
if date < 20050328 && CodeCategory() == 2 then
UpLimit = (BP[0] * 1.12);
Else if date >= 20050328 and date < 20150615 Then
UpLimit = (BP[0] * 1.15);
Else
UpLimit = (BP[0] * 1.30);
if CodeCategory() == 2 then
{
if date >= 20030721 then
{
up1 = int(UpLimit/100+0.00001)*100;
up2 = int(UpLimit/100+0.00001)*100;
up3 = int(UpLimit/100+0.00001)*100;
up4 = int(UpLimit/50+0.00001)*50;
up5 = int(UpLimit/10+0.00001)*10;
up6 = int(UpLimit/5+0.00001)*5;
up7 = int(UpLimit/1+0.00001)*1;
}
else
{
up1 = int(UpLimit/1000+0.00001)*1000;
up2 = int(UpLimit/500+0.00001)*500;
up3 = int(UpLimit/100+0.00001)*100;
up4 = int(UpLimit/50+0.00001)*50;
up5 = int(UpLimit/10+0.00001)*10;
up6 = int(UpLimit/10+0.00001)*10;
up7 = int(UpLimit/1+0.00001)*1;
}
}
Else
{
up1 = int(UpLimit/1000+0.00001)*1000;
up2 = int(UpLimit/500+0.00001)*500;
up3 = int(UpLimit/100+0.00001)*100;
up4 = int(UpLimit/50+0.00001)*50;
up5 = int(UpLimit/10+0.00001)*10;
up6 = int(UpLimit/5+0.00001)*5;
up7 = int(UpLimit/1+0.00001)*1;
}
if CodeCategory() == 1 || CodeCategory() == 2 then
{
if sdate < 20101004 Then
{
If BP >= 500000 Then
상한가 = up1;
Else If BP >= 100000 Then
상한가 = iff(up2>=500000, up1, up2);
Else If BP >= 50000 Then
상한가 = iff(up3>=100000, up2, up3);
Else If BP >= 10000 Then
상한가 = iff(up4>=50000, up3, up4);
Else If BP >= 5000 Then
상한가 = iff(up5>=10000, up4, up5);
Else If BP >= 1000 Then
상한가 = iff(up5>=5000, up5, up6);
Else
상한가 = iff(up6>=1000, up6, up6);
}
Else
{
If BP >= 500000 Then
상한가 = up1;
Else If BP >= 100000 Then
상한가 = iff(up2>=500000, up1, up2);
Else If BP >= 50000 Then
상한가 = iff(up3>=100000, up2, up3);
Else If BP >= 10000 Then
상한가 = iff(up4>=50000, up3, up4);
Else If BP >= 5000 Then
상한가 = iff(up5>=10000, up4, up5);
Else If BP >= 1000 Then
상한가 = iff(up5>=5000, up5, up6);
Else
상한가 = iff(up6>=1000, up6, up7);
}
}
else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF
상한가 = up6;
}
}
--------------------------------------------------------------------
답변 부탁드립니다.
감사합니다.
2023-01-19
969
글번호 165554
답변완료
Nadaraya-Watson Envelope
MT4 지표인데 예스로 변환 부탁드립니다.
//+------------------------------------------------------------------+
//| nd.mq5 |
//| Copyright 2022, MetaQuotes Ltd. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2022, Grasco."
#property version "1.00"
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_plots 2
#property indicator_type1 DRAW_LINE
#property indicator_type2 DRAW_LINE
#property indicator_width1 2
#property indicator_width2 2
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_applied_price PRICE_WEIGHTED
//--- input parameters
input int Length=500; // Bars Count
input int Bandwidth=17; // Bandwidth
input double Multiplayer=1.5;
// n = get the bar index
//--- indicator buffers
double ExtUpBuffer[];
double ExtDownBuffer[];
double ExtCABuffer[];
double y[]; // for calculation
int ExtBarsHandle;
int k = 2;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit(){
//--- indicator buffers mapping
SetIndexBuffer(0,ExtUpBuffer);
SetIndexBuffer(1,ExtDownBuffer);
SetIndexBuffer(2,y,INDICATOR_CALCULATIONS);
//---
IndicatorSetInteger(INDICATOR_DIGITS,_Digits+1);
//--- sets first bar from what index will be drawn
PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,0);
PlotIndexGetInteger(1,PLOT_DRAW_BEGIN,0);
PlotIndexSetDouble(0, PLOT_EMPTY_VALUE, 0.0);
PlotIndexSetDouble(1, PLOT_EMPTY_VALUE, 0.0);
//--- name for DataWindow
string short_name=StringFormat("Nadraya",Length);
IndicatorSetString(INDICATOR_SHORTNAME,short_name);
PlotIndexSetString(0,PLOT_LABEL,short_name+" Upper");
PlotIndexSetString(1,PLOT_LABEL,short_name+" Lower");
ExtBarsHandle = iMA(_Symbol,_Period,Length,0,MODE_EMA,PRICE_WEIGHTED);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const int begin,
const double &price[])
{
//---
if(IsStopped()) return 0;
int calculated=BarsCalculated(ExtBarsHandle);
if(rates_total<calculated) return(0);
if(rates_total<Length)
return(0);
int copyBars = 0;
if (prev_calculated>rates_total || prev_calculated<=0){
copyBars = rates_total;
}
else{
copyBars = rates_total-prev_calculated;
if(prev_calculated>0) copyBars++;
}
int start=prev_calculated-1;
if(start<Length)
start=Length;
double sum_e = 0.0;
for(int i=rates_total-Length; i<rates_total && !IsStopped(); i++){
double sum = 0.0;
double sumw= 0.0;
for(int j = rates_total-Length;j<rates_total-1;j++){
double w = MathExp(-(MathPow(i-j,2)/(Bandwidth*Bandwidth*2)));
sum += price[j]*w;
sumw += w;
}
double y2 = sum/sumw;
sum_e += (MathAbs(price[i]-y2));
y[i] = y2;
}
double mae = sum_e/Length*Multiplayer;
for(int i=rates_total-Length+1; i<rates_total && !IsStopped(); i++){
double y2 = y[i];
double y1 = y[i-1];
ExtUpBuffer[i]=y2+mae;
ExtDownBuffer[i]=y2-mae;
//Print(mae);
//Print(y[i]);
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
2023-01-19
1377
글번호 165552
답변완료
시스템식 문의
해외선물 분봉차트사용하면서
당일 첫 시초가가 최근 10일 일봉기준 첫시초가이동평균(당일시초가 포함)
값 보다 20포인트 낮게 시작할 경우
시초가에 매도하는 시스템매매식이 가능할까요
부탁드립니다
2023-01-19
694
글번호 165549
답변완료
수식부탁합니다
1파 2파 3파.....
파동을 처리하는 과정입니다
1.참고할 만한 수식이 있을지요?
2. 특히 파동이 겹치는 부분인데요
"1파와 3파가 겹치면 1파로 한다"
수식이나 ..
형식이나..
쓰일만한 함수라도....(검색해 보겠숩니다)
감사합니다!
2023-01-19
556
글번호 165548
답변완료
지표와 시스템 매수타점 차이
안녕하세요.
당일 오전 고점과 당일 저점을 피보나치 비율로 분할 매수하는 수식을 작성하였으나, 매수 매도 타점이 지표상 타점과 상이하여 원인이 무엇인지 문의드립니다.
1) 지표와 시스템식의 주요 피보나치식은 동일하나, 첫 매매 이후 다른 타점에서 거래가 되는데 원인이 무엇인지 알려주시면 감사하겠습니다.
2) 추가적으로 피보나치 비율에 따라 물타기 후 반등하여 상단 피보나치 도달 시 전량 매도 혹은 손절하는 수식 작성하였는데, 맞게 작성했는지 검토해주시면 감사하겠습니다.
1. 지표식--------------------------------
input :Per1(76.4),Per2(61.8),Per3(50.0),Per4(38.2),Per5(23.6);
var : HH(0),LL(0),DD(0),TT(0);
Input: GrowthRate(0.15);
var: cnt(0),AvgDH(0),AvgDL(0),n(0),AL_Avg(0),AH(0);
LL= DayLow;
If H == DayHigh and sTime < 130000 Then
{
HH = H;
}
var1 = HH-(HH-LL)*(Per5/100);
var2 = HH-(HH-LL)*(Per4/100);
var3 = HH-(HH-LL)*(Per3/100);
var4 = HH-(HH-LL)*(Per2/100);
var5 = HH-(HH-LL)*(Per1/100);
plot1(HH,"최고");
plot2(var1,"76.4");
plot3(var2,"61.8");
plot4(var3,"50.0");
plot5(var4,"38.2");
plot6(var5,"23.6");
plot7(LL,"최저");
------------------------------------------
2. 시스템 식-------------------------------
#수수료율: 0.004%
#거래세: (매도시) 0.25%
input :Per1(76.4),Per2(61.8),Per3(50.0),Per4(38.2),Per5(23.6),Deposit(1000000),Rate(20);
var : HH(0),LL(0),DD(0),TT(0);
LL= DayLow;
If H == DayHigh and sTime < 130000 Then
{
HH = H;
}
var1 = HH-(HH-LL)*(Per5/100);
var2 = HH-(HH-LL)*(Per4/100);
var3 = HH-(HH-LL)*(Per3/100);
var4 = HH-(HH-LL)*(Per2/100);
var5 = HH-(HH-LL)*(Per1/100);
if MarketPosition == 0 and DayHigh >=DayClose(1)*(1+(rate/100)) Then
{
Buy("b1",AtLimit,var1,round((Deposit/var1)/6*1,0));
}
Else
if MarketPosition == 1 and LatestEntryName == "b1" Then
{
Buy("b2",AtLimit,var2,round((Deposit/var2)/6*2,0));
ExitLong("S1",Atlimit,var1*1.03);
}
Else
if MarketPosition == 1 and latestEntryName == "b2" Then
{
Buy("b3",AtLimit,Var3,round((Deposit/var3)/6*3,0));
ExitLong("S2",AtLimit,var1);
}
Else
if MarketPosition == 1 and latestEntryName == "b3"
Then
{
ExitLong("S3",AtLimit,AvgEntryPrice);
SetStopLoss(3,PercentStop);
}
2023-01-18
665
글번호 165547
아침 님에 의해서 삭제되었습니다.
2023-01-18
81
글번호 165546
아침 님에 의해서 삭제되었습니다.
2023-01-18
79
글번호 165545
답변완료
부탁드립니다.
1. 국내 옵션에서 종가가 마디 2.5 위에 있으면 빨강색으로, 아래에 있으면 파란색으로 구현해 주세요
2. 콜옵션 현재가가 풋옵션 저가 이하로 내려가면 파란색으로 저가 이상으로 올라가면 빨강색으로 구현해 주세요
고맙습니다.
2023-01-18
443
글번호 165544
답변완료
문의드립니다
수고가 많으십니다.
예스랭귀지 초보인지라 몇가지 문의를 드리고자 합니다.
1-1. 차트에 "수익 틱수" 표시
해외/국내선물 "틱"봉 기준 차트에서,
매수 또는 매도 신호가 발생된 종가를 기준으로,
다음 신호가 나올때까지
(예를들어 이번 신호가 "매수"신호일 경우 그 다음 매도 신호 발생때까지..
또는 "매도"신호 발생 후 그 다음 "매수신호발생때까지..)
캔들의 종가를 기준으로 10틱 단위로 "oo틱 수익" 이 나오게 하고 싶습니다.
단, 장의 흐름에 따라서,
봉의 길이가 짧은 경우에는.. 10틱 수익 → 20틱 수익 → 30틱 수익.. 등등 으로 표기 될수 있지만..
만일 장의 급등락 발생될 경우(장대 양봉/음봉이 발생될 경우)에는..
10틱 수익 → 30틱 수익 → 70틱 수익 이런식으로 유도리 있게 표기 될 수 있도록..
수식 작성이 가능할까요?
상기 "틱"봉 기준 차트에서의 수식 작성이 가능하다면..
"분"봉 기준 차트도 같은 수식을 사용해도 되는건가요?
1-2. "1-1"에서 캔들의 종가말고, 캔들이 만들어지는 과정에서,
매수의 경우에는 캔들의 고가, 매도의 경우에는 캔들의 저가를 표시할 수도 있는건가요?
가능하다면 수식 좀 부탁드리겠습니다.
2-1. "수익 틱수" 표기 위치 조정
"틱" 차트 또는 "분" 차트에서 나오는,
"oo틱 수익"의 글자위치(=발생위치)도 임의로 조절이 가능한건지요?
예를들면,
(1) "매수" 신호로 발생되는 "oo틱 수익"의 텍스트 위치는.. 캔들(봉) 위에
(2) "매도" 신호로 발생되는 "oo틱 수익"의 텍스트 위치는.. 캔들(봉) 아래에 표시
3. 홍콩 항셍지수의 경우, 새벽 03시 50분에 장마감이 되고,
오전 10시 15분에 개장이 되는데,
장 마감의 연속성을 단절하고, 오전 개장시간에 맞춰서 첫번째 (매수/매도) 신호를 내보내고자 합니다.
이러한 경우에는 수식을 어떻게 표현해야 되는건가요?
2-2. 아울러 항셍지수의 경우, 당일 시가는 전일 저녁장을 기준으로 자동으로 책정이 되는건지요?
당일 오전 10시 14분 시초가를 당일 시가로 표현하는 것도 가능한건가요?
2023-01-19
581
글번호 165543