커뮤니티
문의드립니다.
아래 코드를 지표로 만들려면 어떻게 해야 하나요?
Inputs:
Length(20), // 채널 계산 기간
NumATRs(2); // ATR 배수
Vars:
LowerBand(0), // 하단 밴드
UpperBand(0), // 상단 밴드
MiddleBand(0),
tpusdc(10000),
slUsdC(3000);
LowerBand = keltnerchannel(Close, Length, -NumATRs);
UpperBand = keltnerchannel(Close, Length, NumATRs);
MiddleBand = KeltnerChannel(C, Length, 0);
If marketposition == 0 and CrossUp(Close, upperBand) and adx(14) < 30 then
Buy("L", AtMarket, Def, 1);
If marketposition == 0 and CrossDown(Close, lowerBand) and adx(14) < 30 then
Sell("S", AtMarket, Def, 1);
//손절
If marketposition > 0 and barssinceentry >= 2 and Close <= EntryPrice - (slUsdC / BigPointValue) Then ExitLong("SL_L", AtMarket);
If marketposition < 0 and barssinceentry >= 2 and Close >= EntryPrice + (slUsdC / BigPointValue) Then ExitShort("SL_S", AtMarket);
if CrossDown(c, middleband) Then ExitLong("Exit_L",AtMarket);
if CrossUp(c, middleband) Then ExitShort("Exit_S",AtMarket);
//익절
If marketposition > 0 and barssinceentry >= 2 and Close >= EntryPrice + (tpUsdC / BigPointValue) Then ExitLong("PT_L", AtMarket);
If marketposition < 0 and barssinceentry >= 2 and Close >= EntryPrice - (tpUsdC / BigPointValue) Then ExitShort("PT_S", AtMarket);
아래가 제가 지표로 만든겁니다.
1. 신호는 어떻게 표시하나요?
2. 이대로 지표 삽입하면 캡쳐화면과 같이 이상하게 캔들과 따로 놉니다. 어떻게 해야 하나요?
input: length(80), numatrs(2);
vars:
LowerBand(0), // 하단 밴드
UpperBand(0), // 상단 밴드
MiddleBand(0), // 중심 밴드
adxVal(0); // ADX 값
#--------------------------------------------------------
# 밴드 계산
#--------------------------------------------------------
LowerBand = KeltnerChannel(Close, Length, -NumATRs);
UpperBand = KeltnerChannel(Close, Length, NumATRs);
MiddleBand = KeltnerChannel(Close, Length, 0);
adxVal = ADX(14);
#--------------------------------------------------------
# Plot 출력
#--------------------------------------------------------
plot1(UpperBand, "UpperBand", RGB(255,0,0)); // 상단 밴드
plot2(MiddleBand, "MiddleBand", RGB(255,255,255)); // 중심 밴드
plot3(LowerBand, "LowerBand", RGB(0,255,0)); // 하단 밴드
plot4(adxVal, "ADX(14)", RGB(255,255,0)); // ADX 값 (참고용)
- 1. 2025-11-10_085206.png (0.00 MB)
답변 1
예스스탁 예스스탁 답변
2025-11-10 14:13:31