커뮤니티

문의드립니다

프로필 이미지
cjfdk
2026-01-21 23:06:30
81
글번호 229974
답변완료

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번 시스템



Inputs: XMALen(4), VolLen(8), MultFact(2);

Vars: TopBand(0), BotBand(0), XAvg(0), FastMA(0), MedMA(0), SlowMA(0),

BullTrend(false), BearTrend(false),Volatility(0);


#Volatility

If CurrentBar >= 1 AND VolLen <> 0 Then Begin

If CurrentBar == 1 Then

Volatility = TrueRange;

Else

Volatility = ((VolLen - 1) * Volatility + TrueRange) / VolLen;

End;



##{ Define initial Top and Bottom Band }

If CurrentBar == 1 then Begin

TopBand = Open + Volatility * MultFact;

BotBand = Open - Volatility * Multfact;

End;


#{ Define market mode with 3 line Moving averages }

XAvg = Ema( Close , XMALen );

FastMA = ma( Close, 4 );

MedMA = ma( Close, 9 );

SlowMA = ma( Close, 18 );


BullTrend = FastMA > MedMA AND MedMA > SlowMA;

BearTrend = FastMA < MedMA AND MedMA < SlowMA;


#{ Place long entry orders }

If XAvg > TopBand AND BullTrend then begin

buy("b",OnClose);

BotBand = TopBand;

TopBand = TopBand + Volatility * MultFact;

End;


#{ Place short entry orders }

If XAvg < BotBand AND BearTrend then begin

sell("s",OnClose);

TopBand = BotBand;

BotBand = BotBand - Volatility * MultFact;

End;


수고많으십니다

문의드릴 내용은 위 수식에서

1번 시스템이 매수면 1점 매도면 -1점

2번 시스템이 매수면 1점 매도면 -1점

각각 점수를 주어

두 시스템의 합이 2점이면 매수진입 매도청산

두 시스템의 합이 -2점이면 매도진입 매수청산

이런 수식을 부탁드립니다

감사합니다

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

예스스탁 예스스탁 답변

2026-01-22 14:03:25

안녕하세요 예스스탁입니다. 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 : pst1(0),pst2(0),pst(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 pst1 <= 0 and Trend == 1 and Trend[1] == -1 Then pst1 = 1; if pst1 >= 0 and Trend == -1 and Trend[1] == 1 Then pst1 = -1; Inputs: XMALen(4), VolLen(8), MultFact(2); Vars: TopBand(0), BotBand(0), XAvg(0), FastMA(0), MedMA(0), SlowMA(0), BullTrend(false), BearTrend(false),Volatility(0); #Volatility If CurrentBar >= 1 AND VolLen <> 0 Then Begin If CurrentBar == 1 Then Volatility = TrueRange; Else Volatility = ((VolLen - 1) * Volatility + TrueRange) / VolLen; End; ##{ Define initial Top and Bottom Band } If CurrentBar == 1 then Begin TopBand = Open + Volatility * MultFact; BotBand = Open - Volatility * Multfact; End; #{ Define market mode with 3 line Moving averages } XAvg = Ema( Close , XMALen ); FastMA = ma( Close, 4 ); MedMA = ma( Close, 9 ); SlowMA = ma( Close, 18 ); BullTrend = FastMA > MedMA AND MedMA > SlowMA; BearTrend = FastMA < MedMA AND MedMA < SlowMA; #{ Place long entry orders } If pst2 <= 0 and XAvg > TopBand AND BullTrend then begin pst2 = 1; BotBand = TopBand; TopBand = TopBand + Volatility * MultFact; End; #{ Place short entry orders } If pst2 >= 0 and XAvg < BotBand AND BearTrend then begin pst2 = -1; TopBand = BotBand; BotBand = BotBand - Volatility * MultFact; End; pst = pst1+pst2; if pst != pst[1] and pst == 2 Then Buy("b"); if pst != pst[1] and pst == -2 Then Sell("s"); 즐거운 하루되세요