커뮤니티
시스템식 및 종목 검색식 3가지 질문 드립니다.
2025-10-24 23:41:18
467
글번호 227292
안녕하세요
항상 빠른 답변 감사 드립니다
3가지 질문을 드립니다.
1번
아래 식을 피라미딩 입력값에 따라 진입이 가능하게 요청 드립니다.
퍼센트 간격은 0.5, 1, 2 ,4, 8 ,16 ~~
투입 금액도 1, 2, 4, 8 ~~
진입식 퍼센트 , 금액은 무한 증분 이지만
피라미딩 입력 횟수값(2회~5회)으로 사용하려고 합니다.
간격 및 증분에 대한 질문에 오류가 있다면 구현 가능한 선에서 지도 편달 요청 드립니다.
// 진입
input : threshold_percent(0.5);
input : additional_long__percent(0.5);
input : additional_short_rise_percent(0.5);
var : threshold(0),addLong(0),addShortRise(0);
var : longCondition(False),shortCondition(False);
var : longAddCondition(False),shortAddCondition(False);
var : hasLongPosition(False),hasShortPosition(False);
threshold = threshold_percent / 100.0;
addLong = additional_long__percent / 100.0;
addShortRise = additional_short_rise_percent / 100.0;
longCondition = DHL2 >= low and (CrossUp(low, var1) or CrossUp(low, var2) or CrossUp(low, var5)) and low <= DHL2 * (1 - threshold);
shortCondition = DHL2 < low and (CrossDown(high, var1) or CrossDown(high, var2) or CrossDown(high, var5)) and low > DHL2 * (1 + threshold);
// 추가 롱 조건: 롱 포지션 중 진입가 대비 추가 하락 시 및 롱 신호
longAddCondition = (MarketPosition > 0) and (close <= entryPrice * (1 - addLong)) and longCondition;
// 추가 숏 조건: 숏 포지션 중 진입가 대비 추가 상승 시 및 숏 신호
shortAddCondition = (MarketPosition < 0) and (close >= entryPrice * (1 + addShortRise)) and shortCondition;
hasLongPosition = MarketPosition > 0;
hasShortPosition = MarketPosition < 0;
// 포지션 없을 때만 기존 롱/숏 Condition으로 진입
if (hasLongPosition == False and longCondition) Then
Buy("Long");
if (hasShortPosition == False and shortCondition) Then
Sell("Short");
// 롱 포지션 보유 시 추가 롱 진입 조건만 실행
if (MarketPosition > 0 and MaxEntries == 1) Then
{
if (longAddCondition) then
{
Buy("물Long");
}
}
if (MarketPosition < 0 and MaxEntries == 1) Then
{
if (shortAddCondition) Then
{
Sell("불Short");
}
}
2번
시스템식 시험적용시 날짜 및 시간을 입력하여 적용 날짜 및 시간을 적용 하고자 합니다.
관련 식을 요청 드립니다.
3번
종목 검색에서 아래와 같이 년봉 기준으로 검색을 하고자 합니다.
년저[2] > 년저[1] < 년저
Ps. 수식 작성 예제 링크 오류 수정 요청 드립니다. https://www.yesstock.com/YesTrader/YesLanguage/YesLanguage_help.html
그럼 좋은 하루 되세요
답변 2
예스스탁 예스스탁 답변
2025-10-27 10:44:17
안녕하세요
예스스탁입니다.
전화주시기 바랍니다.
02-3453-1060
즐거운 하루되세요
예스스탁 예스스탁 답변
2025-10-27 11:24:59
안녕하세요
예스스탁입니다.
1
input : threshold_percent(0.5);
input : additional_long__percent(0.5);
input : additional_short_rise_percent(0.5);
input : 최대진입횟수(3),첫진입수량(1);
var : threshold(0),addLong(0),addShortRise(0);
var : longCondition(False),shortCondition(False);
var : longAddCondition(False),shortAddCondition(False);
var : hasLongPosition(False),hasShortPosition(False);
var : vv(0);
threshold = threshold_percent / 100.0;
longCondition = DHL2 >= low and (CrossUp(low, var1) or CrossUp(low, var2) or CrossUp(low, var5)) and low <= DHL2 * (1 - threshold);
shortCondition = DHL2 < low and (CrossDown(high, var1) or CrossDown(high, var2) or CrossDown(high, var5)) and low > DHL2 * (1 + threshold);
hasLongPosition = MarketPosition > 0;
hasShortPosition = MarketPosition < 0;
// 포지션 없을 때만 기존 롱/숏 Condition으로 진입
if (hasLongPosition == False and longCondition) Then
{
vv = 첫진입수량;
addLong = additional_long__percent;
Buy("Long",OnClose,Def,vv);
}
if (hasShortPosition == False and shortCondition) Then
{
vv = 첫진입수량;
addShortRise = additional_short_rise_percent;
Sell("Short",OnClose,Def,vv);
}
// 롱 포지션 보유 시 추가 롱 진입 조건만 실행
if (MarketPosition > 0 and MaxEntries < 최대진입횟수) Then
{
// 추가 롱 조건: 롱 포지션 중 진입가 대비 추가 하락 시 및 롱 신호
longAddCondition = (close <= entryPrice * (1 - addLong)) and longCondition;
if (longAddCondition) then
{
vv = vv*2;
addLong = addLong*2;
Buy("물Long",OnClose,Def,vv);
}
}
if (MarketPosition < 0 and MaxEntries < 최대진입횟수) Then
{
// 추가 숏 조건: 숏 포지션 중 진입가 대비 추가 상승 시 및 숏 신호
shortAddCondition = (close >= entryPrice * (1 + addShortRise)) and shortCondition;
if (shortAddCondition) Then
{
vv = vv*2;
addLong = addLong*2;
Sell("불Short",OnClose,Def,vv);
}
}
2
input : 시작일(20251020),시작시간(80000);
var : Start(False);
if sDate >= 시작일 and sTime >= 시작시간 Then
start = true;
if start == true Then
{
진입수식
}
3
종목검색에 년주기는 제공되지 않아
월봉에서 검색하셔야 합니다.
var : cnt(0);
Array : YL[10](0);
if sDate > sDate[1]+1000 Then
{
For cnt = 9 DownTo 1
{
YL[cnt] = YL[cnt-1];
}
YL[0] = L;
}
if YL[0] > 0 and L < YL[0] Then
YL[0] = L;
if YL[2] > 0 and YL[2] > YL[1] and YL[1] > YL[0] Then
Find(1);
즐거운 하루되세요
다음글
이전글