커뮤니티

아래의 식을 예스 랭귀지로 변환 좀 부탁드립니다.

프로필 이미지
산수유
2025-10-31 11:43:52
158
글번호 227531
답변완료

✅ 현실형 추세추종 + ADX + 변동성 필터 전략 (예스랭귀지)

# ==========================================================
# 📊 현실형 나스닥 60분봉 자동매매 전략
#     - 추세장만 진입 (ADX 필터)
#     - 저변동 횡보장 회피 (이평 간격 필터)
#     - 익절/손절 구간 현실 조정 (당일 평균폭 기준)
# ==========================================================

input : maShort(20), maLong(60), adxPeriod(14);
input : adxThreshold(25), maGapLimit(0.5);
input : StopLossP(150), TakeProfitP(280);   # ✅ 현실적 익절·손절 설정 (150~300p)
input : tradeSize(1);

var : adxVal(0), maS(0), maL(0), maGap(0);
var : buyCond(False), sellCond(False), trend(0);

# ---- 지표 계산 ----
maS = Average(Close, maShort);
maL = Average(Close, maLong);
adxVal = ADX(adxPeriod);
maGap = Abs(maS - maL) / maL * 100;

# ---- 추세 판단 ----
if maS > maL then trend = 1;
if maS < maL then trend = -1;

# ---- 매수 조건 ----
if trend = 1 and adxVal > adxThreshold and maGap > maGapLimit and Close > maS then
    buyCond = True;
else
    buyCond = False;

# ---- 매도 조건 ----
if trend = -1 and adxVal > adxThreshold and maGap > maGapLimit and Close < maS then
    sellCond = True;
else
    sellCond = False;

# ---- 진입 로직 ----
if MarketPosition = 0 and buyCond then
    Buy("L-Entry") next bar at market;
if MarketPosition = 0 and sellCond then
    SellShort("S-Entry") next bar at market;

# ---- 청산 조건 ----
SetStopLoss(StopLossP);
SetProfitTarget(TakeProfitP);

# ---- 추가조건: 반전 시 즉시 청산 ----
if MarketPosition = 1 and trend = -1 then
    ExitLong("TrendRevL") next bar at market;
if MarketPosition = -1 and trend = 1 then
    ExitShort("TrendRevS") next bar at market;



📈 이 설정의 핵심 포인트

항목

설명

익절 목표

280p

하루 변동폭 평균의 70~80% 수준

손절폭

150p

1:2 손익비 유지

ADX 필터

25 이상만 거래

횡보장 거래 회피

이평간격 제한

0.5 이상

단기/장기 이평이 붙어있으면 진입X

추세 반전 시 강제 청산

있음

속임수 반전(역배열 돌파 등) 차단

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

예스스탁 예스스탁 답변

2025-10-31 12:57:35

안녕하세요 예스스탁입니다. input : maShort(20), maLong(60), adxPeriod(14); input : adxThreshold(25), maGapLimit(0.5); input : StopLossP(150), TakeProfitP(280); # ? 현실적 익절·손절 설정 (150~300p) input : tradeSize(1); var : adxVal(0), maS(0), maL(0), maGap(0); var : buyCond(False), sellCond(False), trend(0); # ---- 지표 계산 ---- maS = ma(Close, maShort); maL = ma(Close, maLong); adxVal = ADX(adxPeriod); maGap = Abs(maS - maL) / maL * 100; # ---- 추세 판단 ---- if maS > maL then trend = 1; if maS < maL then trend = -1; # ---- 매수 조건 ---- if trend == 1 and adxVal > adxThreshold and maGap > maGapLimit and Close > maS then buyCond = True; else buyCond = False; # ---- 매도 조건 ---- if trend == -1 and adxVal > adxThreshold and maGap > maGapLimit and Close < maS then sellCond = True; else sellCond = False; # ---- 진입 로직 ---- if MarketPosition == 0 and buyCond then Buy("L-Entry",AtMarket); if MarketPosition == 0 and sellCond then Sell("S-Entry",AtMarket); # ---- 청산 조건 ---- SetStopLoss(StopLossP,PointStop); SetStopProfittarget(TakeProfitP,PointStop); # ---- 추가조건: 반전 시 즉시 청산 ---- if MarketPosition == 1 and trend == -1 then ExitLong("TrendRevL",AtMarket); if MarketPosition == -1 and trend == 1 then ExitShort("TrendRevS",AtMarket); 즐거운 하루되세요
프로필 이미지

산수유

2025-10-31 13:11:57

위의 답이 예스랭귀지로 변환한건가요? 제가 한 질문을 그대로 옮겨놓은거 같은데요?

프로필 이미지

예스스탁 예스스탁 답변

2025-10-31 13:44:44

안녕하세요 예스스탁입니다. 변환이 된 식입니다. 내용을 비교해 보시기 바랍니다. 즐거운 하루되세요