커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
4343
글번호 230811
답변완료
시스템식 문의드립니다
안녕하세요
한국투자증권을 사용하는 시스템식 문의드립니다.
1. 16시~18시(16시보다 크거나 같고 18시보다 작음)사이의
고가와 저가선을 18시부터 02시까지 수평선을 긋습니다.
(단, 고가와 저가의 차이가 60틱 이상인 경우는 제외)
2. 18시 이후 고가선이나 저가선을 한틱이상 돌파하는 경우
진입
3. 반대신호 발생시 손절 및 반대로 진입
-고가(저가)선을 돌파하여 매수(매도) 진입하였는데
저가선(고가선) 돌파시 매수(매도)손절 및
매도(매수)진입)
-최초 진입시 1계약, 이후 진입 회수 증가시마다
계약수 1계약 증가
4. 02시에 청산
5. 02시전 누적손실이 80틱에 도달시 청산 및 매매종료
02시전 누적이익이 80틱에 도달시 청산 및 매매종료
(슬리피지 0.5틱, 수수료 1틱 적용)
감사합니다
2017-08-17
161
글번호 112062
뽀로오스 님에 의해서 삭제되었습니다.
2017-08-17
0
글번호 112061
답변완료
수식 문의 드립니다.
진입전략
data2 - data1 > 0.3% 이면 매수
data2 - data1 < -0.3% 이면 매도
청산전략
data2 - data1 < 0.1% 이면 매수청산
data2 - data1 > -0.1% 이면 매도청산
수식 부탁드립니다~
2017-08-17
152
글번호 112060
답변완료
수식작성 요청드립니다.
안녕하세요. 운영자님
요청드릴 전략식은
매수조건 : 20 이동평균선이 우상향(상승), 5 이동평균선과 20 이동평균선 정배열, 캔들이
5와 20 이동평균선의 사이에 위치(캔들의 고가와 저가모두)하며 음봉 후 첫 양봉일
때
매도조건 : 20 이동평균선이 우하향(하락), 5 이동평균선과 20 이동평균선 역배열, 캔들이
5와 20 이동평균선의 사이에 위치(캔들의 고가와 저가모두)하며 양봉 후 첫 음봉일
때
수고하세요
2017-08-17
167
글번호 112059
답변완료
가격지표 표현
차트속성 눈금선을 가로로 하면, 정수자리 가격선까지만 표현되는데요.
각 종목의 (틱)호가단위까지 가로선이 그어지게 하고 싶습니다.
수고하세요.
2017-08-17
205
글번호 112058
답변완료
피브나치요청
* 항상 많은 도움에 고맙습니다.
* 100일 피보선 그리고저 하는데 이게 아닌가요?
input : Per1(25.0),Per2(38.0),Per3(50.0),Per4(63.0),Per5(75);
var : HH(0),LL(0);
var1; ma(c,100) ;
HH = max(var1);
LL = min(var1);
var1 = 10^(LOG10(HH)-(LOG10(HH)-LOG10(LL))*(Per1/100));
var2 = 10^(LOG10(HH)-(LOG10(HH)-LOG10(LL))*(Per2/100));
var3 = 10^(LOG10(HH)-(LOG10(HH)-LOG10(LL))*(Per3/100));
var4 = 10^(LOG10(HH)-(LOG10(HH)-LOG10(LL))*(Per4/100));
var5 = 10^(LOG10(HH)-(LOG10(HH)-LOG10(LL))*(Per5/100));
* 고맙 습니다.
2017-08-16
195
글번호 112057
오토 님에 의해서 삭제되었습니다.
2017-08-16
6
글번호 112056
답변완료
ts 코드 예스 변환 관련
다음과 같은 ts 이지코드를 예스에 붙여넣으면 에러가 엄청 많이 발생하네요...
도와주세요
Variables:
m_typeEvalBase( 0.0 ),
m_dbEvalProfitLoss( 0.0 ),
m_nBarNumberBid( 0.0 ),
m_nBarNumberAsk( 0.0 ),
IntrabarPersist m_bValidEnvironment( false ),
IntrabarPersist m_dbTickUnit( 0.0 ),
m_dbTickPrice( 0.0 ),
IntrabarPersist m_bSetExitRateAlwaysLong( false ),
IntrabarPersist m_bSetExitRateAlwaysShort( false ),
m_bExitPartLongHappend( false ),
m_bExitPartShortHappend( false ),
IntrabarPersist m_nTotalOpen( 1 ),
IntrabarPersist m_nOpenVolume( 1 ),
IntrabarPersist m_nTradeVolume( 1 ),
IntrabarPersist m_nOpenAmount( 0 ),
IntrabarPersist m_nTotalVolumes( 0 ),
IntrabarPersist m_nTotalAmount( 0 ),
IntrabarPersist m_bOrderSignaled( False ),
tmpCount( 0 ),
tmpAgo( 0 ),
StochasticFast_Range( 14 ),
StochasticFast_FastK( 3 ),
StochasticFast_FastD( 3 ),
outFastK( 0 ),
outFastD( 0 ),
outSlowK( 0 ),
outSlowD( 0 ),
stcst_fast( 0 );
Arrays:
m_aryOpenVolume[1](0),
m_aryExitVolume[1](0),
m_aryOpenPrice[1](0),
m_aryExitPrice[1](0);
{ ===================================== Get Volume from Direct Amount ===========================}
Method double GetValidVolumeByDirectAmount(int amount)
Var:
double RetVolume;
Begin
if amount > Close Then
RetVolume = amount / Close
Else
RetVolume = 0;
Return RetVolume;
End;
{ ===============================================================================================}
{ ===================================== Get Volume from rate of Amount ==========================}
Method double GetValidVolumeByRateAmount(int amount, double rate)
Var:
double RetVolume;
Begin
if (amount * rate) > Close Then
RetVolume = (amount * rate) / Close
Else
RetVolume = 0;
Return RetVolume;
End;
{ ===============================================================================================}
{ ===================================== Get Direct Volume =======================================}
Method double GetValidVolumeByDirectVolume(int vol)
Var:
double RetVolume;
Begin
RetVolume = vol;
Return RetVolume;
End;
{ ===============================================================================================}
{ ====================================== Get Volume from rate of Volume =========================}
Method double GetValidVolumeByRateVolume(int vol, double rate)
Var:
double RetVolume;
Begin
RetVolume = vol * rate * 0.01;
Return RetVolume;
End;
{ ===============================================================================================}
{ ==================================== Long Trade ============================================}
{ --------------------------------------Open--------------------------------------------------}
Method void BuyEval_ThisClose(int open_count, int vol, double price)
Begin
Buy ("[E]매수진입(TC)") vol Shares this bar on Close;
If open_count <= CurrentEntries Then Begin
m_nBarNumberBid = CurrentBar;
m_aryOpenPrice[open_count] = close;
m_aryOpenVolume[open_count] = vol;
MessageLog("[", BarDateTime.ToString(), "] Buy Vol : ", vol, ", CurrentContracts : ", CurrentContracts);
End;
End;
{ --------------------------------------Open------------------------------------------------}
Method void BuyReal_ThisClose(int open_count, int vol, double price)
Begin
Buy ("[R]매수진입(TC)") vol Shares this bar on Close;
If open_count <= CurrentEntries Then Begin
m_nBarNumberBid = CurrentBar;
m_aryOpenPrice[open_count] = close;
m_aryOpenVolume[open_count] = vol;
MessageLog("[", BarDateTime.ToString(), "] Buy Vol : ", vol, ", CurrentContracts : ", CurrentContracts);
End;
End;
{ ===============================================================================================}
Method void BuyOrder_ThisClose(int open_count, int vol, double price, bool reverse)
Begin
If IsTodayBar(BarDateTime.ELDate) = true and IsOperatingTime() = true Then Begin
If reverse = false Then Begin
BuyReal_ThisClose(open_count, vol, price);
End;
End
Else Begin
If reverse = false Then Begin
BuyEval_ThisClose(open_count, vol, price);
End;
End;
End;
{ ===============================================================================================}
{ ==================================== Long Trade =============================================}
{ --------------------------------------Open---------------------------------------------------}
Method void BuyEval_NextOpen(int open_count, int vol, double price)
Begin
Buy ("[E]매수진입(NO)") vol Shares next bar at Open;
If open_count <= CurrentEntries Then Begin
m_nBarNumberBid = CurrentBar;
m_aryOpenPrice[open_count] = close;
m_aryOpenVolume[open_count] = vol;
MessageLog("[", BarDateTime.ToString(), "] Buy Vol : ", vol, ", CurrentContracts : ", CurrentContracts);
End;
End;
{ --------------------------------------Open--------------------------------------------------}
Method void BuyReal_NextOpen(int open_count, int vol, double price)
Begin
Buy ("[R]매수진입(NO)") vol Shares next bar at Open;
If open_count <= CurrentEntries Then Begin
m_nBarNumberBid = CurrentBar;
m_aryOpenPrice[open_count] = close;
m_aryOpenVolume[open_count] = vol;
MessageLog("[", BarDateTime.ToString(), "] Buy Vol : ", vol, ", CurrentContracts : ", CurrentContracts);
End;
End;
{ ===============================================================================================}
Method void BuyOrder_NextOpen(int open_count, int vol, double price, bool reverse)
Begin
If IsTodayBar(BarDateTime.ELDate) = true and IsOperatingTime() = true Then Begin
If reverse = false Then Begin
BuyReal_NextOpen(open_count, vol, price);
End;
End
Else Begin
If reverse = false Then Begin
BuyEval_NextOpen(open_count, vol, price);
End;
End;
End;
{ ===============================================================================================}
{ ==================================== Long Trade ============================================}
{ --------------------------------------Open--------------------------------------------------}
Method void BuyEval_NextMarket(int open_count, int vol, double price)
Begin
Buy ("[E]매수진입(NM)") vol Shares next bar at Market;
If open_count <= CurrentEntries Then Begin
m_nBarNumberBid = CurrentBar;
m_aryOpenPrice[open_count] = close;
m_aryOpenVolume[open_count] = vol;
MessageLog("[", BarDateTime.ToString(), "] Buy Vol : ", vol, ", CurrentContracts : ", CurrentContracts);
End;
End;
{ --------------------------------------Open------------------------------------------------}
Method void BuyReal_NextMarket(int open_count, int vol, double price)
Begin
Buy ("[R]매수진입(NM)") vol Shares next bar at Market;
If open_count <= CurrentEntries Then Begin
m_nBarNumberBid = CurrentBar;
m_aryOpenPrice[open_count] = close;
m_aryOpenVolume[open_count] = vol;
MessageLog("[", BarDateTime.ToString(), "] Buy Vol : ", vol, ", CurrentContracts : ", CurrentContracts);
End;
End;
{ ===============================================================================================}
Method void BuyOrder_NextMarket(int open_count, int vol, double price, bool reverse)
Begin
If IsTodayBar(BarDateTime.ELDate) = true and IsOperatingTime() = true Then
Begin
If reverse = false Then Begin
BuyReal_NextMarket(open_count, vol, price);
End;
End
Else Begin
If reverse = false Then Begin
BuyEval_NextMarket(open_count, vol, price);
End;
End;
End;
{ ===============================================================================================}
{ ==================================== Long Trade ==============================================}
{ --------------------------------------Open----------------------------------------------------}
Method void BuyEval_NextStop(int open_count, int vol, double price)
Begin
Buy ("[E]매수진입(NS)") vol Shares next bar at price Stop;
If open_count <= CurrentEntries Then Begin
m_nBarNumberBid = CurrentBar;
m_aryOpenPrice[open_count] = close;
m_aryOpenVolume[open_count] = vol;
MessageLog("[", BarDateTime.ToString(), "] Buy Vol : ", vol, ", CurrentContracts : ", CurrentContracts);
End;
End;
{ --------------------------------------Open---------------------------------------------------}
Method void BuyReal_NextStop(int open_count, int vol, double price)
Begin
Buy ("[R]매수진입(NS)") vol Shares next bar at price Stop;
If open_count <= CurrentEntries Then Begin
m_nBarNumberBid = CurrentBar;
m_aryOpenPrice[open_count] = close;
m_aryOpenVolume[open_count] = vol;
MessageLog("[", BarDateTime.ToString(), "] Buy Vol : ", vol, ", CurrentContracts : ", CurrentContracts);
End;
End;
{ ===============================================================================================}
Method void BuyOrder_NextStop(int open_count, int vol, double price, bool reverse)
Begin
If IsTodayBar(BarDateTime.ELDate) = true and IsOperatingTime() = true Then Begin
If reverse = false Then Begin
BuyReal_NextStop(open_count, vol, price);
End;
End
Else Begin
If reverse = false Then Begin
BuyEval_NextStop(open_count, vol, price);
End;
End;
End;
{ ===============================================================================================}
{ ==================================== Long Trade =============================================}
{ --------------------------------------Open---------------------------------------------------}
Method void BuyEval_NextLimit(int open_count, int vol, double price)
Begin
Buy ("[E]매수진입(NL)") vol Shares next bar at price Limit;
If open_count <= CurrentEntries Then Begin
m_nBarNumberBid = CurrentBar;
m_aryOpenPrice[open_count] = close;
m_aryOpenVolume[open_count] = vol;
MessageLog("[", BarDateTime.ToString(), "] Buy Vol : ", vol, ", CurrentContracts : ", CurrentContracts);
End;
End;
{ --------------------------------------Open--------------------------------------------------}
Method void BuyReal_NextLimit(int open_count, int vol, double price)
Begin
Buy ("[R]매수진입(NL)") vol Shares next bar at price Limit;
If open_count <= CurrentEntries Then Begin
m_nBarNumberBid = CurrentBar;
m_aryOpenPrice[open_count] = close;
m_aryOpenVolume[open_count] = vol;
MessageLog("[", BarDateTime.ToString(), "] Buy Vol : ", vol, ", CurrentContracts : ", CurrentContracts);
End;
End;
{ ===============================================================================================}
Method void BuyOrder_NextLimit(int open_count, int vol, double price, bool reverse)
Begin
If IsTodayBar(BarDateTime.ELDate) = true and IsOperatingTime() = true Then Begin
If reverse = false Then Begin
BuyReal_NextLimit(open_count, vol, price);
End;
End
Else Begin
If reverse = false Then Begin
BuyEval_NextLimit(open_count, vol, price);
End;
End;
End;
{ ===============================================================================================}
{ ==================================== Long Trade ============================================}
{ --------------------------------------Exit--------------------------------------------------}
Method void SellEval_ThisClose(int open_count, int vol, double price)
Begin
Sell ("[E]매수청산(TC)") vol Shares Total this bar on Close;
If open_count <= CurrentEntries Then Begin
m_nBarNumberBid = 0;
m_nBarNumberAsk = 0;
m_aryExitPrice[open_count] = close;
m_aryExitVolume[open_count] = vol;
MessageLog("[", BarDateTime.ToString(), "] Sell Vol : ", vol, ", CurrentContracts : ", CurrentContracts);
End;
End;
{ --------------------------------------Exit----------------------------------------------------}
Method void SellReal_ThisClose(int open_count, int vol, double price)
Begin
Sell ("[R]매수청산(TC)") vol Shares Total this bar on Close;
If open_count <= CurrentEntries Then Begin
m_nBarNumberBid = 0;
m_nBarNumberAsk = 0;
m_aryExitPrice[open_count] = close;
m_aryExitVolume[open_count] = vol;
MessageLog("[", BarDateTime.ToString(), "] Sell Vol : ", vol, ", CurrentContracts : ", CurrentContracts);
End;
End;
{ ===============================================================================================}
Method void SellOrder_ThisClose(int open_count, int vol, double price, bool reverse)
Begin
If IsTodayBar(BarDateTime.ELDate) = true and IsOperatingTime() = true Then Begin
If reverse = false Then Begin
SellReal_ThisClose(open_count, vol, price);
End;
End
Else Begin
If reverse = false Then Begin
SellEval_ThisClose(open_count, vol, price);
End;
End;
End;
{ ===============================================================================================}
{ ==================================== Long Trade ==============================================}
{ --------------------------------------Exit----------------------------------------------------}
Method void SellEval_NextOpen(int open_count, int vol, double price)
Begin
Sell ("[E]매수청산(NO)") vol Shares Total next bar at Open;
If open_count <= CurrentEntries Then Begin
m_nBarNumberBid = 0;
m_nBarNumberAsk = 0;
m_aryExitPrice[open_count] = close;
m_aryExitVolume[open_count] = vol;
MessageLog("[", BarDateTime.ToString(), "] Sell Vol : ", vol, ", CurrentContracts : ", CurrentContracts);
End;
End;
{ --------------------------------------Exit----------------------------------------------------}
Method void SellReal_NextOpen(int open_count, int vol, double price)
Begin
Sell ("[R]매수청산(NO)") vol Shares Total next bar at Open;
If open_count <= CurrentEntries Then Begin
m_nBarNumberBid = 0;
m_nBarNumberAsk = 0;
m_aryExitPrice[open_count] = close;
m_aryExitVolume[open_count] = vol;
MessageLog("[", BarDateTime.ToString(), "] Sell Vol : ", vol, ", CurrentContracts : ", CurrentContracts);
End;
End;
{ ===============================================================================================}
Method void SellOrder_NextOpen(int open_count, int vol, double price, bool reverse)
Begin
If IsTodayBar(BarDateTime.ELDate) = true and IsOperatingTime() = true Then Begin
If reverse = false Then Begin
SellReal_NextOpen(open_count, vol, price);
End;
End
Else Begin
If reverse = false Then Begin
SellEval_NextOpen(open_count, vol, price);
End;
End;
End;
{ ===============================================================================================}
{ ==================================== Long Trade ==============================================}
{ --------------------------------------Exit----------------------------------------------------}
Method void SellEval_NextMarket(int open_count, int vol, double price)
Begin
Sell ("[E]매수청산(NM)") vol Shares Total next bar at Market;
If open_count <= CurrentEntries Then Begin
m_nBarNumberBid = 0;
m_nBarNumberAsk = 0;
m_aryExitPrice[open_count] = close;
m_aryExitVolume[open_count] = vol;
MessageLog("[", BarDateTime.ToString(), "] Sell Vol : ", vol, ", CurrentContracts : ", CurrentContracts);
End;
End;
{ --------------------------------------Exit---------------------------------------------------}
Method void SellReal_NextMarket(int open_count, int vol, double price)
Begin
Sell ("[R]매수청산(NM)") vol Shares Total next bar at Market;
If open_count <= CurrentEntries Then Begin
m_nBarNumberBid = 0;
m_nBarNumberAsk = 0;
m_aryExitPrice[open_count] = close;
m_aryExitVolume[open_count] = vol;
MessageLog("[", BarDateTime.ToString(), "] Sell Vol : ", vol, ", CurrentContracts : ", CurrentContracts);
End;
End;
{ ===============================================================================================}
Method void SellOrder_NextMarket(int open_count, int vol, double price, bool reverse)
Begin
If IsTodayBar(BarDateTime.ELDate) = true and IsOperatingTime() = true Then Begin
If reverse = false Then Begin
SellReal_NextMarket(open_count, vol, price);
End;
End
Else Begin
If reverse = false Then Begin
SellEval_NextMarket(open_count, vol, price);
End;
End;
End;
{ ===============================================================================================}
{ ==================================== Long Trade ==============================================}
{ --------------------------------------Exit----------------------------------------------------}
Method void SellEval_NextStop(int open_count, int vol, double price)
Begin
Sell ("[E매수청산(NS)") vol Shares Total next bar at price Stop;
If open_count <= CurrentEntries Then Begin
m_nBarNumberBid = 0;
m_nBarNumberAsk = 0;
m_aryExitPrice[open_count] = close;
m_aryExitVolume[open_count] = vol;
MessageLog("[", BarDateTime.ToString(), "] Sell Vol : ", vol, ", CurrentContracts : ", CurrentContracts);
End;
End;
{ --------------------------------------Exit----------------------------------------------------}
Method void SellReal_NextStop(int open_count, int vol, double price)
Begin
Sell ("[R]매수청산(NS)") vol Shares Total next bar at price Stop;
If open_count <= CurrentEntries Then Begin
m_nBarNumberBid = 0;
m_nBarNumberAsk = 0;
m_aryExitPrice[open_count] = close;
m_aryExitVolume[open_count] = vol;
MessageLog("[", BarDateTime.ToString(), "] Sell Vol : ", vol, ", CurrentContracts : ", CurrentContracts);
End;
End;
{ ===============================================================================================}
Method void SellOrder_NextStop(int open_count, int vol, double price, bool reverse)
Begin
If IsTodayBar(BarDateTime.ELDate) = true and IsOperatingTime() = true Then Begin
If reverse = false Then Begin
SellReal_NextStop(open_count, vol, price);
End;
End
Else Begin
If reverse = false Then Begin
SellEval_NextStop(open_count, vol, price);
End;
End;
End;
{ ===============================================================================================}
{ ==================================== Long Trade ==============================================}
{ --------------------------------------Exit----------------------------------------------------}
Method void SellEval_NextLimit(int open_count, int vol, double price)
Begin
Sell ("[E]매수청산(NL)") vol Shares Total next bar at price Stop;
If open_count <= CurrentEntries Then Begin
m_nBarNumberBid = 0;
m_nBarNumberAsk = 0;
m_aryExitPrice[open_count] = close;
m_aryExitVolume[open_count] = vol;
MessageLog("[", BarDateTime.ToString(), "] Sell Vol : ", vol, ", CurrentContracts : ", CurrentContracts);
End;
End;
{ --------------------------------------Exit----------------------------------------------------}
Method void SellReal_NextLimit(int open_count, int vol, double price)
Begin
Sell ("[R]매수청산(NL)") vol Shares Total next bar at price Limit;
If open_count <= CurrentEntries Then Begin
m_nBarNumberBid = 0;
m_nBarNumberAsk = 0;
m_aryExitPrice[open_count] = close;
m_aryExitVolume[open_count] = vol;
MessageLog("[", BarDateTime.ToString(), "] Sell Vol : ", vol, ", CurrentContracts : ", CurrentContracts);
End;
End;
{ ===============================================================================================}
Method void SellOrder_NextLimit(int open_count, int vol, double price, bool reverse)
Begin
If IsTodayBar(BarDateTime.ELDate) = true and IsOperatingTime() = true Then Begin
If reverse = false Then Begin
SellReal_NextLimit(open_count, vol, price);
End;
End
Else Begin
If reverse = false Then Begin
SellEval_NextLimit(open_count, vol, price);
End;
End;
End;
{ ===============================================================================================}
Method double GetEvalTotalProfitLoss(int eval_type)
Var:
double eval_rate;
Begin
If MarketPosition = 1 Then Begin
switch (eval_type)
Begin
case 0:
eval_rate = (Close * CurrentShares) - (AvgEntryPrice * CurrentShares);
break;
case 1:
eval_rate = (Close - AvgEntryPrice) / AvgEntryPrice * 100.0;
break;
case 2:
eval_rate = (Close - AvgEntryPrice) / m_dbTickUnit;
break;
case 3:
eval_rate = Close - AvgEntryPrice;
break;
End;
End;
Return eval_rate;
End;
{ ===============================================================================================}
Method double GetEvalEntryProfitLoss(int eval_type, int ago_num)
Var:
double eval_rate;
Begin
eval_rate = 0.0;
If MarketPosition = 1 AND CurrentEntries > ago_num Then Begin
value1 = m_aryOpenPrice[CurrentEntries - 1 - ago_num];
If value1 <> 0 Then Begin
switch (eval_type)
Begin
case 0:
eval_rate = Close - value1;
break;
case 1:
eval_rate = (Close - value1) / value1 * 100.0;
break;
case 2:
eval_rate = (Close - value1) / m_dbTickUnit;
break;
case 3:
eval_rate = Close - value1;
break;
End;
End;
End;
Return eval_rate;
End;
{ ===============================================================================================}
Method bool IsOperatingTime()
Var:
bool ret_val;
Begin
ret_val = true;
Return ret_val;
End;
{ ===============================================================================================}
Method bool IsTodayBar(int bar_date)
Var:
bool ret_val;
Begin
ret_val = bar_date = CurrentDate;
Return ret_val;
End;
{ ===============================================================================================}
{ ====================================== Open Price Method ======= =========================}
Method double GetOpenPrice(int ago_num)
Var:
double RetPrice;
Begin
RetPrice = 0.0;
If CurrentEntries > ago_num Then Begin
RetPrice = m_aryOpenPrice[CurrentEntries - 1 - ago_num];
End;
Return RetPrice;
End;
{ ===============================================================================================}
{ ====================================== Exit Price Method =================================}
Method double GetExitPrice(int ago_num)
Var:
double RetPrice;
Begin
RetPrice = 0.0;
If CurrentEntries > ago_num Then Begin
RetPrice = m_aryExitPrice[CurrentEntries - 1 - ago_num];
End;
Return RetPrice;
End;
{ ===============================================================================================}
Method int GetEqualTopCount(int ago, int bar_range)
Var:
int RetCount;
Begin
RetCount = 0;
tmpCount = bar_range;
tmpAgo = ago;
Value1 = HighestFC(High[tmpAgo], tmpCount + 1);
For Value2 = 0 To tmpCount - 1 Begin
If Close[Value2 + tmpAgo] = Value1 Then
RetCount = RetCount + 1;
End;
Return RetCount;
End;
{ ===============================================================================================}
Method int GetEqualBottomCount(int ago, int bar_range)
Var:
int RetCount;
Begin
RetCount = 0;
tmpCount = bar_range;
tmpAgo = ago;
Value1 = LowestFC(Low[tmpAgo], tmpCount + 1);
For Value2 = 0 To tmpCount - 1 Begin
If Close[Value2 + tmpAgo] = Value1 Then
RetCount = RetCount + 1;
End;
Return RetCount;
End;
{ ===============================================================================================}
Once Begin
ClearPrintLog;
m_dbTickUnit = MinMove / PriceScale;
m_dbTickPrice = MinMove / PriceScale * BigPointValue;
m_bValidEnvironment = (GetAppInfo( aiApplicationType ) = cChart);
MessageLog("Tick 단위 : ", m_dbTickUnit);
MessageLog("Tick 가격 : ", m_dbTickPrice);
MessageLog("Big Point : ", BigPointValue);
MessageLog("진입수량 : ", m_nOpenVolume);
End;
{ ===============================================================================================}
{ ======================================< STRATEGY CODES >=======================================}
{ ===============================================================================================}
If m_bValidEnvironment = True Then
Begin
m_bOrderSignaled = false;
stcst_fast = Stochastic( High, Low, Close, StochasticFast_Range, StochasticFast_FastK, StochasticFast_FastD, 1, outFastK, outFastD, outSlowK, outSlowD );
If MarketPosition = 0 AND m_bOrderSignaled = false Then Begin
If outFastK Crosses Above outFastD Then Begin
m_nTradeVolume = m_nOpenVolume;
BuyOrder_ThisClose(CurrentEntries, m_nTradeVolume, CurrentAsk, false);
m_bOrderSignaled = true;
End;
End;
If MarketPosition = 1 AND m_bOrderSignaled = false Then Begin
If outFastK Crosses Below outFastD Then Begin
m_nTradeVolume = CurrentContracts;
SellOrder_ThisClose(CurrentEntries, m_nTradeVolume, CurrentBid, false);
m_bOrderSignaled = true;
End;
End;
End;
2017-08-16
254
글번호 112055
답변완료
ts 이지랭귀지 코드를 예스랭귀지 코드로 변환
전략들이 트레이드스테이션 이지랭귀지로 되어 있어서
이 전략들을 예스랭귀지로 바꾸어서 검증 후 사용하려고 하는데요.
ts 이지코드를 복사해서 예스에 붙여넣고 검증하면 오류가 많이 뜨는데,,
혹시 ts 코드의 예약어들에 매칭되는 예스 랭귀지 코드 자료집이나 가이드가 있는지 알려주세요~
예스로 써야 주문이 나가는데 어렵네요
2017-08-16
174
글번호 112054