커뮤니티

문의드립니다

프로필 이미지
cjfdk
2026-02-22 19:26:35
62
글번호 230683
답변완료

수고 많으십니다

3가지를 조합한 전략을 부탁드립니다

1번

input : SwingPeriod(20), AtrPeriod(10), ATrMult(30);

var : PH(0), PL(0), lastpp(0), center(0), alPHa(0), source(0), ATrV(0);

var : UpCh(0), DnCh(0), Trend(0), TuP(0), Tdown(0), TrailingSL(0);


# 스윙하이와 스윙로우를 이용하여 중심선 계산

PH = swingHigh(1,H,SwingPeriod,SwingPeriod,SwingPeriod*2+1);

PL = swingLow(1,L,SwingPeriod,SwingPeriod,SwingPeriod*2+1);

if PH <> -1 Then lastpp = PH;

if PL <> -1 Then lastpp = PL;

if PH <> -1 or PL <> -1 Then center = (center*2 + lastpp)/3;


# ATR계산(True Range를 RMA로 평균)

if CurrentBar > 0 Then {

alPHa = 1 / AtrPeriod ;

source = max(H - L, abs(H - C[1]), abs(L - C[1]));

ATrV = alPHa * source + (1 - alPHa) * ATrV[1];

}


# 상하단 채널과 추세에 따른 추세채널

UpCh = center - (ATrMult * ATrV);

DnCh = center + (ATrMult * ATrV);

Tup = IFf(C[1] > TUp[1],max(UpCh, TUp[1]),UpCh );

Tdown = IFf(C[1] < TDown[1],min(DnCh, TDown[1]),DnCh );

if C > TDown[1] Then Trend = 1;

if C < TuP[1] Then Trend = -1;

Trailingsl = IFf(Trend == 1, Tup, Tdown);


if Trend == 1 and Trend[1] == -1 Then

Buy();

if Trend == -1 and Trend[1] == 1 Then

Sell();



2번


input : short1(12),long1(26),sig1(9);

input : short2(18),long2(39),sig2(9);

input : short3(24),long3(52),sig3(9);

var : macdv1(0),macds1(0);

var : macdv2(0),macds2(0);

var : macdv3(0),macds3(0);


macdv1 = macd(short1,long1);

macds1 = ema(macdv1,sig1);

macdv2 = macd(short2,long2);

macds2 = ema(macdv2,sig2);

macdv3 = macd(short3,long3);

macds3 = ema(macdv3,sig3);


if macdv1 > 0 and CrossUp(macdv1,macds1) and

macdv2 > 0 and CrossUp(macdv2,macds2) and

macdv3 > 0 and CrossUp(macdv3,macds3) Then

Buy();



if macdv1 < 0 and CrossDown(macdv1,macds1) and

macdv2 < 0 and CrossDown(macdv2,macds2) and

macdv3 < 0 and CrossDown(macdv3,macds3) Then

Sell();


3번

input : Period(20),dv(2);

input : 하단아래(3),하단위(4),상단위(3),상단아래(4);

var : BBup(0),BBmd(0),BBdn(0);

var : T(0),i1(0),i2(0),i3(0),i4(0);


BBup = BollBandUp(Period,dv);

BBmd = ma(c,Period);

BBdn = BollBandDown(Period,dv);



if CrossDown(C,BBdn) Then

{

T = -1;

i1 = 0;

}


if CrossUp(C,BBdn) Then

{

T = 1;

i2 = 0;

}


if CrossUp(C,BBup) Then

{

T = 2;

i3 = 0;

}


if CrossDown(C,BBup) Then

{

T = -2;

i4 = 0;

}


if T == -1 Then

i1 = i1+1;


if T == 1 Then

i2 = i2+1;


if T == 2 Then

i3 = i3+1;


if T == -2 Then

i4 = i4+1;


if MarketPosition <= 0 and T == 1 and i2 == 하단위 and i1 >= 하단아래 Then

Buy();



if MarketPosition >= 0 and T == -2 and i4 == 상단아래 and i3 >= 상단위 Then

Sell();


위 3가지 시스템에 각각에 점수를 주어

1번이 매수면 1점 매도면 -1점

2번이 매수면 1점 매도면 -1점

3번이 매수면 1점 매도면 -1점

이렇게 각 전략마다 점수를 주어

3가지 전략의 합이 3점 이면 매수

3가지 전략의 합이 1점 이면 매수 청산

3가지 전략의 합이 -3점 이면 매도

3가지 전략의 합이 -1점 이면 매도 청산

이런 시스템을 부탁드립니다

감사합니다

시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2026-02-23 12:49:21

안녕하세요 예스스탁입니다. input : SwingPeriod(20), AtrPeriod(10), ATrMult(30); var : PH(0), PL(0), lastpp(0), center(0), alPHa(0), source(0), ATrV(0); var : UpCh(0), DnCh(0), Trend(0), TuP(0), Tdown(0), TrailingSL(0); var : S1(0),S2(0),S3(0); # 스윙하이와 스윙로우를 이용하여 중심선 계산 PH = swingHigh(1,H,SwingPeriod,SwingPeriod,SwingPeriod*2+1); PL = swingLow(1,L,SwingPeriod,SwingPeriod,SwingPeriod*2+1); if PH <> -1 Then lastpp = PH; if PL <> -1 Then lastpp = PL; if PH <> -1 or PL <> -1 Then center = (center*2 + lastpp)/3; # ATR계산(True Range를 RMA로 평균) if CurrentBar > 0 Then { alPHa = 1 / AtrPeriod ; source = max(H - L, abs(H - C[1]), abs(L - C[1])); ATrV = alPHa * source + (1 - alPHa) * ATrV[1]; } # 상하단 채널과 추세에 따른 추세채널 UpCh = center - (ATrMult * ATrV); DnCh = center + (ATrMult * ATrV); Tup = IFf(C[1] > TUp[1],max(UpCh, TUp[1]),UpCh ); Tdown = IFf(C[1] < TDown[1],min(DnCh, TDown[1]),DnCh ); if C > TDown[1] Then Trend = 1; if C < TuP[1] Then Trend = -1; Trailingsl = IFf(Trend == 1, Tup, Tdown); if S1 <= 0 and Trend == 1 and Trend[1] == -1 Then S1 = 1; if S1 >= 0 and Trend == -1 and Trend[1] == 1 Then S1 = -1; input : short1(12),long1(26),sig1(9); input : short2(18),long2(39),sig2(9); input : short3(24),long3(52),sig3(9); var : macdv1(0),macds1(0); var : macdv2(0),macds2(0); var : macdv3(0),macds3(0); macdv1 = macd(short1,long1); macds1 = ema(macdv1,sig1); macdv2 = macd(short2,long2); macds2 = ema(macdv2,sig2); macdv3 = macd(short3,long3); macds3 = ema(macdv3,sig3); if S2 <= 0 and macdv1 > 0 and CrossUp(macdv1,macds1) and macdv2 > 0 and CrossUp(macdv2,macds2) and macdv3 > 0 and CrossUp(macdv3,macds3) Then S2 = 1; if S2 >= 0 and macdv1 < 0 and CrossDown(macdv1,macds1) and macdv2 < 0 and CrossDown(macdv2,macds2) and macdv3 < 0 and CrossDown(macdv3,macds3) Then S2 = -1; input : Period(20),dv(2); input : 하단아래(3),하단위(4),상단위(3),상단아래(4); var : BBup(0),BBmd(0),BBdn(0); var : T(0),i1(0),i2(0),i3(0),i4(0); BBup = BollBandUp(Period,dv); BBmd = ma(c,Period); BBdn = BollBandDown(Period,dv); if CrossDown(C,BBdn) Then { T = -1; i1 = 0; } if CrossUp(C,BBdn) Then { T = 1; i2 = 0; } if CrossUp(C,BBup) Then { T = 2; i3 = 0; } if CrossDown(C,BBup) Then { T = -2; i4 = 0; } if T == -1 Then i1 = i1+1; if T == 1 Then i2 = i2+1; if T == 2 Then i3 = i3+1; if T == -2 Then i4 = i4+1; if S3 <= 0 and T == 1 and i2 == 하단위 and i1 >= 하단아래 Then S3 = 1; if S3 >= 0 and T == -2 and i4 == 상단아래 and i3 >= 상단위 Then S3 = -1; if S1+S2+S3 == 3 Then Buy(); if S1+S2+S3 <= 1 Then ExitLong(); if S1+S2+S3 == -3 Then Sell(); if S1+S2+S3 >= -1 Then ExitShort(); 즐거운 하루되세요