답변완료
지표 변환 부탁드립니다.
//@version=5
indicator(title="On Balance Volume Scaled", shorttitle="OBV-Scaled", format=format.volume, timeframe="", timeframe_gaps=true)
length=input.int(100,minval=10,title="Length of Scaling", group="Settings",tooltip = "The number of candles measured for the highest price, lowest price and average price in the indicator.")
var cumVol = 0.
cumVol += nz(volume)
if barstate.islast and cumVol == 0
runtime.error("No volume is provided by the data vendor.")
src = close
obv = ta.cum(math.sign(ta.change(src)) * volume)
highest_in_length = ta.highest(obv,length)
highest_in_length_avg= ta.ema(highest_in_length,length)
lowest_in_length = ta.lowest(obv,length)
lowest_in_length_avg= ta.ema(lowest_in_length,length)
avg_range= highest_in_length_avg - lowest_in_length_avg
middle_line =avg_range/2
normalized_obv= if obv>=middle_line
-1*((0.5-((math.abs(math.abs(obv)-math.abs(lowest_in_length_avg)))/(math.abs(avg_range))))*100)
else
1*((-0.5-((math.abs(obv)-math.abs(math.abs(lowest_in_length_avg)))/(math.abs(avg_range))))*100)
band1 = hline(50, "Upper Band", color=#787B86, linestyle=hline.style_dashed)
hline(0, "Middle Band", color=color.new(#787B86, 50))
band0 = hline(-50, "Lower Band", color=#787B86, linestyle=hline.style_dashed)
fill(band1, band0, color=color.rgb(33, 150, 243, 90), title="Background")
plot(normalized_obv, color=#2962FF, title="OnBalanceVolume")
ma(source, length, type) =>
switch type
"SMA" => ta.sma(source, length)
"Bollinger Bands" => ta.sma(source, length)
"EMA" => ta.ema(source, length)
"SMMA (RMA)" => ta.rma(source, length)
"WMA" => ta.wma(source, length)
"VWMA" => ta.vwma(source, length)
typeMA = input.string(title = "Method", defval = "SMA", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="Smoothing")
smoothingLength = input.int(title = "Length", defval = 5, minval = 1, maxval = 100, group="Smoothing")
smoothingLine = ma(normalized_obv, smoothingLength, typeMA)
plot(smoothingLine, title="Smoothing Line", color=#f37f20, display=display.none)
답변완료
안녕하세요 질문 있습니다.
질문) OnClose 손절 시 슬리피지 문제 및 정확한 손절 방법 문의
안녕하세요
해외선물 시스템 매매에서 손절 로직 관련 문의드립니다.
현재 OnClose 방식으로 손절을 구현했는데, 설정한 손절가보다 훨씬 큰 손실로 청산되는 문제가 발생하고 있습니다. ㅠ
현재 코드:
easylanguageInput : StopTicks(1.5); // 1.5포인트 손절 설정
if MarketPosition == 1 Then {
if C <= AvgEntryPrice - StopTicks then
{
ExitLong("Stop_L");
}
}
문제점:
1.5포인트 손절 설정했으나 실제로는 2.0~3.0포인트에서 청산
변동성 큰 구간에서 슬리피지가 심함
갭 발생 시 손실이 예상보다 커짐
질문사항:
SetStopLoss 함수를 사용하면 정확한 손절이 가능한지요?
easylanguage SetStopLoss(StopTicks*PriceScale, PointStop);
진입과 동시에 손절 주문을 설정하는 방법이 있나요? 바로 손절 해줘야 하는데 종가 확인 후 손절하다 보니 1.5 포인트 보다 훨씬 초과 되면서 손절을 하더라고요. ㅠ
OnClose 대신 실시간으로 손절가 터치 시 즉시 청산하는 방법은 없나요?
easylanguage if MarketPosition == 1 and L <= AvgEntryPrice - StopTicks then
ExitLong("Stop_L", AtMarket);
해외선물에서 정확한 손절을 위한 권장 방법이 있다면 알려주심 감사하겠습니다.
슬리피지를 최소화하면서 설정한 손절가에 최대한 가깝게 청산할 수 있는 방법 부탁드립니다.
------------------------------
질문) 제목: 60분 주기별 강제청산 및 시간 만료 청산 방법 문의
해외선물 시스템 매매에서 60분 주기 관리 및 강제청산 로직 관련 문의드립니다.
시스템 구조:
매시 정각에 60분 주기 시작 (예: 8:00, 9:00, 10:00...)
첫 5분간 고가/저가 수집하여 상하단선 설정
5분 후부터 상하단선 돌파 시 진입
해당 60분 주기 종료 시 강제청산 필요
현재 시도한 코드:
easylanguagevar : hour60StartTime(0), minutesFromStart(0);
if TimeToMinutes(stime) % 60 == 0 Then {
hour60StartTime = TimeToMinutes(stime);
// 레인지 초기화
}
minutesFromStart = TimeToMinutes(stime) - hour60StartTime;
// 60분 만료 강제청산 시도
if MarketPosition != 0 and minutesFromStart >= 59 Then {
if MarketPosition == 1 then
ExitLong("Time_L");
else
ExitShort("Time_S");
}
문제점:
60분 주기 종료 시점에 정확한 강제청산이 안됨
다음 주기로 포지션이 넘어가는 경우 발생
시간 계산이 정확하지 않음
질문사항:
매시 정각 기준으로 60분 후 정확한 강제청산 방법이 있나요?
TimeToMinutes 함수를 사용한 시간 계산이 올바른 방법인가요?
60분 주기 관리를 위한 더 정확한 시간 체크 로직은 뭐죠?
해외선물에서 특정 시간 경과 후 강제청산하는 권장 방법이 있나요?
예를 들어 8:00에 시작한 주기는 8:59에, 9:00에 시작한 주기는 9:59에 반드시 청산되어야 합니다.
올바른 60분 주기 관리 및 강제청산 방법 부탁드립니다.
----------------------------------
질문) 혼합 청산 방법 궁금합니다.
손절은 SetStopLoss로 즉시 처리하고
익절은 OnClose로 종가 확인 후 처리하는 방식이 가능한지?
진입과 손절 주문의 타이밍:
easylanguage Buy("BreakUp", OnClose, Def, 1);
SetStopLoss(StopTicks*PriceScale, PointStop);
이렇게 진입 주문과 손절 주문을 동시에 설정할 때 실행 순서는 뭐죠?
CurrentBar 변수의 정확성:
해외선물에서 CurrentBar를 이용한 재진입 방지가 안정적인가요?
24시간 거래에서 봉 번호가 정확히 증가하는지요?
시간 함수 관련:
TimeToMinutes(stime) % 60 == 0 조건이 해외선물에서 정확히 작동할까요?
서머타임 적용 시에도 문제없는지요?
---------------------
질문) 변수 초기화 및 메모리 관리 문의
easylanguage// 60분 주기 초기화 시
if TimeToMinutes(stime) % 60 == 0 Then {
EntryCount = 0;
FirstEntryResult = 0;
LastExitBar = 0;
// 기타 변수들 초기화
}
질문사항:
매시 정각마다 변수를 초기화할 때, 이전 주기의 포지션 정보가 올바르게 유지되는지요?
AvgEntryPrice, MarketPosition 같은 내장 변수들은 자동으로 관리되는지요?
변수 초기화와 포지션 청산의 순서가 중요한지요?
장시간 운영 시 메모리 누수나 변수 오류 방지를 위한 권장사항이 있는지요?
답변 잘 부탁합니다.
감사합니다.
답변완료
종목검색식 부탁드립니다
1. 지수 10 이평이 , 단순 60 이평을 골든크로스할때 종목검색식 부탁드려요.
2. 지수 10 이평이, 단순 60 이평을 골든크로스할때,
단. 0봉전 ~ 10봉전 까지의 모든종목 검색식 부탁드립니다.
3. 지수 10 이평이, 단순 60 이평 을 골든크로스 한후, 단순60이평 위에
있을때 모든종목 검색식 부탁드려요.
4. 주봉에서,
주봉의 60 "단순 이평이" 상승추세로 바뀔때 종목검색식 부탁드려요
5. 주봉에서,
주봉의 60 "지수 이평이" 상승추세 로 바뀔때 종목검색식 부탁드립니다.
6. 아래 수식을 참고하여(하단),
일봉기준차트에 주봉 10일 이평선을(단순) 긋고,
일봉차트에서 주봉 10일 이평선이(단순) , 아래 (수식1)의 이평선을 돌파하고,
위에 있을때 모든 종목 검색식 부탁드려요
---아래---
(수식1) 이평
smoothADD = ma_length + if(smoothingBool, ma_lengthSmoothing, 0);
MS = if(ma_type == 1, ma(C, smoothADD),
if(ma_type == 2, eavg(C, smoothADD),
if(ma_type == 3, ma(C, smoothADD,가중), eavg(C, smoothADD))));
MS
(수식2) 상승
if(MS(1)<MS,MS,0)
(수식3) 하락
if(MS(1)>=MS,MS,0)
- 지표조건설정
ma_length : 80
ma_lengthSmoothing : 20
smoothingBool : 0
ma_type : 2