커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1581
글번호 230811
답변완료
수식 문의
항상 친절한 답변 감사드립니다.
아래와 같은 수식을 구하고 싶습니다.
미리 요약 ::
- 시그널이 발생하면 상,하단선을 만든다.
- 상하단 레인지를 이용해 익절폭을 정한다.
- 레인지 안에서는 중복신호 안 낸다.
- 시그널 - 손,익절되면 레인지도 사라진다.
- 레인지를 거꾸로 벗어나면 스위칭을 낸다.
- 스위칭은 손/익절 전까지 중복 안 한다.
(다른 시그널과는 중복가능)
=========================
어떤 시그널 var1 var2 이 발생 했다고 했을 때,
(ex : var1 = rsi 30 crossup 매수
var2 = rsi 70 crossdn 매도
## 일단 레인지를 찾습니다.
지표 1 : 볼린저 밴드 상단/ 하단선
지표 2 : price channel 상단+n틱 / 하단선-n틱
var1 매수시그널 발생 캔들 기준 :
하단선 : 밴드하단선과 price channel 하단선-n틱 중 더 낮은 가격
상단선 : 밴드상단선과 price channel 상단+n틱 중 더 낮은 가격
var2 매도 시그널 발생 캔들 기준 :
상단선 : 밴드상단선과 price channel 상단+n틱 중 더 높은 가격
하단선 : 밴드하단선과 price channel 하단선-n틱 중 더 높은 가격
레인지값 :
상단선 - 하단선
===레인지의 활용 ====
a. var1 : (상단선) + (레인지값 * 0.5)에 도달 시 수익청산
b. var2 : (하단선) - (레인지값 * 0.5)에 도달 시 수익 청산
c. 추가 진입 금지 :
1. var1 또는 var2 포지션이 있고
2. 종가가 레인지 안에 있다면
3. 어떤 시그널도 추가로 발생시키지 않습니다.
d. 단, 포지션이 없다면 레인지도 사라지고 시그널은 다시 발생.
=== 손절과 스위칭 ===
e. var1 매수 시그널의 손절과 스위칭 :
(하단선)과 (현재가기준 볼린저밴드 하단선) 중 더 낮은 가격을 이탈하면
-> 매수는 손절하고 매도 스위칭.
-> var1 매수 포지션은 사라졌으므로 레인지도 사라짐.
-> (e. 스위칭 시그널)은 var1, var2 시그널이 아니므로 레인지 생성 안함.
-> 즉, var1 or var2는 중복 발생 가능
익절 : 진입가에서 (진입가봉+직전봉)의 최고최저가 진폭) 만큼 빠지면 청산.
손절 : 직전 var1 시그널 고가 돌파 시 손절
★ (e. 시그널) 은 손절되거나 익절되기 전까지 중복 생성 안함.
k. var2 시그널은 그 반대
-> var2 : 상단선 과 현재가 기준 볼린저밴드 상단선) 중 더 높은 가격을 돌파
-> var2매도는 손절하고 매수 진입.
-> var2 포지션 사라졌으므로 레인지도 사라짐.
-> (k. 스위칭 시그널)은 var1, var2 시그널이 아니므로 레인지 생성 안함.
-> 즉, var1 or var2는 중복 발생 가능
익절 : 진입가에서 (진입가봉+직전봉)의 최고최저가 진폭) 만큼 오르면 청산.
손절 : 직전 var2 시그널 저가 이탈 시 손절
★ (e. 시그널) 은 손절되거나 익절되기 전까지 중복 생성 안함.
--------------------------
도움이 되실지 모르겠는데
일전에 도움 주신 비슷한 수식을 첨부드립니다.
(그런데 작동은 안하더라고요)
Input : Vector(9), Period(14), 매수선(30), 매도선(70);
input : 저가봉(5),고가봉(5),저가폭(10),고가폭(10);
Input : shortPeriod(12), longPeriod(26);
Var : rsi_(0), rsi_signal(0) ;
var : ll(0),hh(0),eh(0),el(0),BuyEntry(False),SellEntry(False);
Var : MACDv(0), MACDsig(0), macdosc(0);
rsi_ = RSI(Period);
rsi_signal = MA(RSI(Period), Vector);
ll = lowest(l,저가봉);
hh = highest(h,고가봉);
if MarketPosition != 0 Then
{
if MarketPosition != MarketPosition[1] or CurrentContracts > CurrentContracts[1] Then
{
eh = hh;
el = ll;
}
}
/*
시그널 레인지를 만듬 :::
eh = @@ 매수 신호가 발생한 캔들을 기준으로 (저가봉) 기간 중 최저가를 찾아서 n틱을 빼줌.
el = @@ 매도 신호가 발생한 캔들을 기준으로 (고가봉) 기간 중 최고가를 찾아서 n1틱을 더해줌
*/
BuyEntry = true;
SellEntry = true;
if MarketPosition == 0 Then
{
if MarketPosition(1) == 1 and (C > ll[BarsSinceEntry(1)]-PriceScale*저가폭 and C < HH[BarsSinceEntry(1)]+PriceScale*고가폭) Then
BuyEntry = False;
if MarketPosition(1) == -1 and (C > ll[BarsSinceEntry(1)]-PriceScale*저가폭 and C < HH[BarsSinceEntry(1)]+PriceScale*고가폭) Then
SellEntry = False;
}
else
{
if MarketPosition == 1 and C > el-PriceScale*저가폭 and C < eh+PriceScale*고가폭 Then
BuyEntry = false;
if MarketPosition == -1 and C > el-PriceScale*저가폭 and C < eh+PriceScale*고가폭 Then
SellEntry = false;
}
/*
( eh + 고가폭) 보다 아래에 있으면서 (el + 저가폭 ) 위에 있는 신호는 걸러낸다.
시그널 레인지 안에서 발생한 시그널은 제외시킴 = (신호가 발생한 캔들 기준으로 N봉 기간) 의
최고가와 최저가에서 N틱을 더해서 레인지를 만들고,
그 레인지 안에 발생한 신호는 걸러낸다.
*/
if macdosc > 0 &&
#rsi_signal < 매수선 &&
rsi_ > 매수선 && rsi_[1] < 매수선 Then
{
if BuyEntry == true Then
Buy("B1");
}
if macdosc < 0 &&
#rsi_signal > 매도선 &&
rsi_ < 매도선 && rsi_[1] > 매도선 Then
{
if SellEntry == true Then
Sell("S1");
}
if MarketPosition == 1 Then
Sell("Bx",AtStop,ll[BarsSinceEntry]-PriceScale*저가폭);
if MarketPosition == -1 Then
BUY("Sx",AtStop,hh[BarsSinceEntry]+PriceScale*고가폭);
#시그널 레인지를 벗어나면 손절 하는 대신 즉시 반대신호를 냄.
#단, 손절대신 낸 신호는 같은 레인지 안에서 중복될 수 있음.
2023-02-10
711
글번호 166156
답변완료
수식 부탁드립니다.
예전에 문의로 작성해주신겁니다.
월물 만기주의 월화수목
그리고 만기전주의 금요일
5개 날짜를 표시해주는겁니다.
여기서 문제가 2/9일 9:00 에는 순간적으로 조건이 풀리는 상황이 있습니다.
(condiw=1 로 표기되지 않는 현상)
매월 만기일이 그렇습니다.
방법 있을지 궁금합니다.
감사합니다.
------------------------------------------------------------------------
var : entry(0,Data1);
var : month(0),nday(0),week(0),TL(0);
var : condiw(0);
month = int(date/100)-int(date/10000)*100;
nday = date - int(date/100)*100;
Week = DayOfWeek(date);
if sDate != sDate[1] Then
{ condiw = 0; }
if nday >= 8 and nday <= 14 and week == 4 and sTime >= 90000 and sTime[1] < 90100 Then condiw=1;
else if nday >= 7 and nday <= 13 and week == 3 Then condiw=1;
else if nday >= 6 and nday <= 12 and week == 2 Then condiw=1;
else if nday >= 5 and nday <= 11 and week == 1 Then condiw=1;
#else if nday >= 4 and nday <= 10 and week == 5 Then condiw=1;
else if nday >= 2 and nday <= 8 and week == 5 Then condiw=1;
Else condiw ==0;
Plot1(condiw);
2023-02-09
825
글번호 166155
답변완료
부탁드립니다^^
선물 당일 중심선수식 부탁드립니다 꾸벅~
2023-02-09
986
글번호 166136
답변완료
문의드립니다.
아래수식을 보아도 코딩 지식이 없어서 어떻게 매수 매도 되는
원리인지 해석을 할 수가 없네요.
식들이 어떤 의미로 매수가 되고 청산되며 다시
매도되고 청산되는 지를 알고 싶습니다.
그리고 제가 원하는 수식은
특정 날자와 시간과 특정 가격을 input 으로 하고요.
어떤 특정 가격 A 를 input 으로 임의로 정해주고
특정 날자와 시간 이후에 기다리고 있다가 아래나 위에 있던 현재가 상승 또는 하락하여 A 가격에 도달하면 비로서 매수 매도가 활성화 되어서
그 가격 A + PriceScale*5 을 현재가가 한번 위로 터치하면 매수하고 계속 위로 올라가면
놓아두고 다시 아래로 떨어져서 A - PriceScale*5 를 터치하면 매수청산과 더불어서 히방으로 1계약 매도합니다. 이런 식으로 계속 반복합니다.
현재가가 A + PriceScale*5 위로 도달시 매수 1게약
현재가가 A - PriceScale*5 아래로 도달시 매도 1게약
을 반복하는 것입니다.
아래 수식처럼 비슷하게 하면 ATSTOP 함수를 써서 가능할 것 같은데요.
아래 수식에서 ExitLong("bx",AtMarket); 이 왜 수식으로 게속 와야 하는 지 등를
모르겠어요.
제가 원하는 수식도 마저 부탁드립니다.
늘 수고하심에 감사드립니다.
if NextBarSdate != sDate Then
{
if NextBarOpen != C Then
{
Buy("b",AtStop,NextBarOpen+PriceScale*5);
}
}
ExitLong("bx",AtMarket);
if NextBarOpen != C Then
{
Buy("b1",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx1",AtMarket);
if NextBarOpen != C Then
{
Buy("b2",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx2",AtMarket);
if NextBarOpen != C Then
{
Buy("b3",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx3",AtMarket);
if NextBarOpen != C Then
{
Buy("b4",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx4",AtMarket);
if NextBarOpen != C Then
{
Buy("b5",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx5",AtMarket);
if NextBarOpen == C Then
{
Buy("b6",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx6",AtMarket);
if NextBarOpen == C Then
{
Buy("b7",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx7",AtMarket);
if NextBarOpen == C Then
{
Buy("b8",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx8",AtMarket);
if NextBarOpen == C Then
{
Buy("b9",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx9",AtMarket);
if NextBarOpen == C Then
{
Buy("b10",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx10",AtMarket);
if NextBarOpen == C Then
{
Buy("b11",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx11",AtMarket);
if NextBarSdate != sDate Then
{
if NextBarOpen != C Then
{
Sell("s",AtStop,NextBarOpen-PriceScale*5);
}
}
ExitShort("sx",AtMarket);
if NextBarOpen != C Then
{
Sell("s1",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx1",AtMarket);
if NextBarOpen != C Then
{
Sell("s2",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx2",AtMarket);
if NextBarOpen != C Then
{
Sell("s3",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx3",AtMarket);
if NextBarOpen != C Then
{
Sell("s4",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx4",AtMarket);
if NextBarOpen != C Then
{
Sell("s5",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx5",AtMarket);
if NextBarOpen == C Then
{
Sell("s6",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx6",AtMarket);
if NextBarOpen == C Then
{
Sell("s7",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx7",AtMarket);
if NextBarOpen == C Then
{
Sell("s8",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx8",AtMarket);
if NextBarOpen == C Then
{
Sell("s9",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx9",AtMarket);
if NextBarOpen == C Then
{
Sell("s10",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx10",AtMarket);
if NextBarOpen == C Then
{
Sell("s11",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx11",AtMarket);
if NextBarSdate != sDate Then
{
if NextBarOpen != C Then
{
Buy("b12",AtStop,NextBarOpen+PriceScale*5);
}
}
ExitLong("bx12",AtMarket);
if NextBarOpen != C Then
{
Buy("b13",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx13",AtMarket);
if NextBarOpen != C Then
{
Buy("b14",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx14",AtMarket);
if NextBarOpen != C Then
{
Buy("b15",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx15",AtMarket);
if NextBarOpen != C Then
{
Buy("b16",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx16",AtMarket);
if NextBarOpen != C Then
{
Buy("b17",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx17",AtMarket);
if NextBarOpen == C Then
{
Buy("b18",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx18",AtMarket);
if NextBarOpen == C Then
{
Buy("b19",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx19",AtMarket);
if NextBarOpen == C Then
{
Buy("b20",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx20",AtMarket);
if NextBarOpen == C Then
{
Buy("b21",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx21",AtMarket);
if NextBarOpen == C Then
{
Buy("b22",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx22",AtMarket);
if NextBarOpen == C Then
{
Buy("b23",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx23",AtMarket);
if NextBarSdate != sDate Then
{
if NextBarOpen != C Then
{
Sell("s12",AtStop,NextBarOpen-PriceScale*5);
}
}
ExitShort("sx12",AtMarket);
if NextBarOpen != C Then
{
Sell("s13",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx13",AtMarket);
if NextBarOpen != C Then
{
Sell("s14",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx14",AtMarket);
if NextBarOpen != C Then
{
Sell("s15",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx15",AtMarket);
if NextBarOpen != C Then
{
Sell("s16",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx16",AtMarket);
if NextBarOpen != C Then
{
Sell("s17",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx17",AtMarket);
if NextBarOpen == C Then
{
Sell("s18",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx18",AtMarket);
if NextBarOpen == C Then
{
Sell("s19",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx19",AtMarket);
if NextBarOpen == C Then
{
Sell("s20",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx20",AtMarket);
if NextBarOpen == C Then
{
Sell("s21",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx21",AtMarket);
if NextBarOpen == C Then
{
Sell("s22",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx22",AtMarket);
if NextBarOpen == C Then
{
Sell("s23",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx23",AtMarket);
if NextBarSdate != sDate Then
{
if NextBarOpen != C Then
{
Buy("b24",AtStop,NextBarOpen+PriceScale*5);
}
}
ExitLong("bx24",AtMarket);
if NextBarOpen != C Then
{
Buy("b25",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx25",AtMarket);
if NextBarOpen != C Then
{
Buy("b26",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx26",AtMarket);
if NextBarOpen != C Then
{
Buy("b27",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx27",AtMarket);
if NextBarOpen != C Then
{
Buy("b28",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx28",AtMarket);
if NextBarOpen != C Then
{
Buy("b29",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx29",AtMarket);
if NextBarOpen == C Then
{
Buy("b30",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx30",AtMarket);
if NextBarOpen == C Then
{
Buy("b31",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx31",AtMarket);
if NextBarOpen == C Then
{
Buy("b32",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx32",AtMarket);
if NextBarOpen == C Then
{
Buy("b33",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx33",AtMarket);
if NextBarOpen == C Then
{
Buy("b34",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx34",AtMarket);
if NextBarOpen == C Then
{
Buy("b35",AtStop,NextBarOpen+PriceScale*5);
}
ExitLong("bx35",AtMarket);
if NextBarSdate != sDate Then
{
if NextBarOpen != C Then
{
Sell("s24",AtStop,NextBarOpen-PriceScale*5);
}
}
ExitShort("sx24",AtMarket);
if NextBarOpen != C Then
{
Sell("s25",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx25",AtMarket);
if NextBarOpen != C Then
{
Sell("s26",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx26",AtMarket);
if NextBarOpen != C Then
{
Sell("s27",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx27",AtMarket);
if NextBarOpen != C Then
{
Sell("s28",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx28",AtMarket);
if NextBarOpen != C Then
{
Sell("s29",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx29",AtMarket);
if NextBarOpen == C Then
{
Sell("s30",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx30",AtMarket);
if NextBarOpen == C Then
{
Sell("s31",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx31",AtMarket);
if NextBarOpen == C Then
{
Sell("s32",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx32",AtMarket);
if NextBarOpen == C Then
{
Sell("s33",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx33",AtMarket);
if NextBarOpen == C Then
{
Sell("s34",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx34",AtMarket);
if NextBarOpen == C Then
{
Sell("s35",AtStop,NextBarOpen-PriceScale*5);
}
ExitShort("sx35",AtMarket);
2023-02-09
866
글번호 166135
답변완료
봉개수 세기
감사합니다.
툴바에 보면 "봉개수 세기"가 있습니다.
이것과 비슷하게
당일만 (현재봉 1봉전부터 당일 첫봉까지)
봉번호 숫자를 자동으로 표시하고 싶습니다.
예) 1분봉이고 현재 09시 04분이라면
09시 첫봉에 3, 09시1분에 2, 09시3분에 3이렇게 자동으로 표시
2023-02-09
919
글번호 166134
답변완료
분봉상 최고종가 돌파
당일 최고종가를 돌파하면서 20이평평돌파가 동시에 되는것을찾고싶어요
2023-02-09
727
글번호 166131
답변완료
수식 문의 드립니다.
안녕하세요.
아래 수식에서 익절 틱수를 시간에 따라 변경하고 싶은데 어떻게 하면 되나요?
08시~15시 익절 160틱
15시~익일 05시 익절 400틱
05시~07시 익절 160틱
이렇게 변경하고 싶습니다.
부탁 드립니다.
input : StartTime(080000),EndTime(070000);
input : 익절포인트수(400),손절포인트수(80);
input : 타주기분(60),P(5),Period(5);
var : S1(0),D1(0),TM(0),TF(0),cnt(0),entry(0),bbup(0),bbdn(0);
var : sum1(0),mav1(0),sum2(0),mav2(0),sum3(0),mav3(0),avgv(0),avgv1(0),Tcond(False);
Array : CC[100](0);
avgv = ma(c,Period);
avgv1 =ma(c,20);
bbup = BollBandUp(20,2);
bbdn = BollBandDown(20,2);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
entry = 0;
}
if D1 > 0 then
{
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%타주기분;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 타주기분 > 1 and TF < TF[1]) or
(Bdate == Bdate[1] and 타주기분 > 1 and TM >= TM[1]+타주기분) or
(Bdate == Bdate[1] and 타주기분 == 1 and TM > TM[1]) Then
{
for cnt = 1 to 99
{
CC[cnt] = CC[cnt-1][1];
}
}
CC[0] = C;
if CC[P+2] > 0 then
{
sum1 = 0;
sum2 = 0;
sum3 = 0;
for cnt = 0 to P-1
{
sum1 = sum1 + CC[cnt];
sum2 = sum2 + CC[cnt+1];
sum3 = sum3 + CC[cnt+2];
}
mav1 = sum1/P;
mav2 = sum2/P;
mav3 = sum3/P;
if MarketPosition <= 0
and mav1>mav2+10 Then
Buy("b",AtMarket);
if MarketPosition >= 0
and mav1<mav2-10 Then
Sell("s",AtMarket);
}
}
SetStopProfittarget(PriceScale*익절포인트수,PointStop);
SetStopLoss(PriceScale*손절포인트수,PointStop);
2023-02-09
738
글번호 166130
답변완료
함수요청
안녕하세요?
국내선물 분봉으로 일중거래를 하고자 합니다.
A조건에 2계약 매수
B조건에 1계약 매수청산
C조건에 1계약 매수청산
D조건에 2계약 매수청산
샘플 부탁드립니다.
2023-02-09
865
글번호 166129
답변완료
수식 문의 드립니다.
안녕하세요
지표식 하나 부탁드립니다.
1.1분봉에서 30분 단위로 (최고값+최저값)/2 의 값을 30분동안 옆으로 선을
긋고 30분 뒤에는 또다른 선을 긋고, 30분 뒤에는 또다른 선을 긋고 하는 지표식
을 부탁 드립니다.(30분마다 1개의 선이 30분 동안에 그어 집니다)
2.1분봉에서 (최고가+최저가)/2 의 값으로 선을 그을수 있게 만들어 주시면은 감사하겠
습니다.(30분단위나 1시간 단위가 아닌 하루동안에 1개의 선이 그어집니다)
항상 감사드립니다.
2023-02-09
933
글번호 166128