답변완료
수식검토 부탁드립니다.
안녕하세요. 운영자님
보내주신 수식 검토 결과 수정이 필요한 부분이 있어 추가 요청 드립니다.
거래시간이 가령 20시00에 시작하여 다음날 오전 05시00분 (나스닥 기준)에 종료되도록 하려고 하니 잘되지 않습니다. 수정 좀 부탁 드립니다.
====================================================================================
Inputs:
ShortMAPeriod(10),
LongMAPeriod(30),
RSIPeriod(14),
StochKPeriod(14),
StochDPeriod(3),
MACDFast(12),
MACDSlow(26),
MACDSignal(9),
BBLength(20),
NumDevs(2),
ProfitTarget(20),
StopLoss(10),
TrailStop(15),
TradeStartTime(93000),
TradeEndTime(150000);
Vars:
ShortMA(0), LongMA(0), RSIVal(0), SlowKVal(0), SlowDVal(0),
MACDVal(0), MACDSignalVal(0),
BBMid(0), BBUpper(0), BBLower(0),
EntryPrice(0), MaxProfit(0);
ShortMA = ma(Close, ShortMAPeriod);
LongMA = ma(Close, LongMAPeriod);
RSIVal = RSI(RSIPeriod);
SlowKVal = SlowK(StochKPeriod,3);
SlowDVal = ma(SlowKVal, StochDPeriod);
// MACD
MACDVal = Ema(Close, MACDFast) - Ema(Close, MACDSlow);
MACDSignalVal = Ema(MACDVal, MACDSignal);
// Bollinger Bands
BBMid = ma(Close, BBLength);
BBUpper = BBMid + Std(Close, BBLength) * NumDevs;
BBLower = BBMid - Std(Close, BBLength) * NumDevs;
If (sTime >= TradeStartTime) and (sTime <= TradeEndTime) Then Begin
// ==== 롱 진입 ====
If (ShortMA > LongMA) and (RSIVal > 50) and
(SlowKVal > SlowDVal) and (SlowKVal > 50) and
(MACDVal > MACDSignalVal) and (Close > BBMid) Then
Begin
If MarketPosition <= 0 Then Begin
Buy("b",AtMarket);
EntryPrice = Close;
MaxProfit = Close;
End;
End;
// ==== 숏 진입 ====
If (ShortMA < LongMA) and (RSIVal < 50) and
(SlowKVal < SlowDVal) and (SlowKVal < 50) and
(MACDVal < MACDSignalVal) and (Close < BBMid) Then
Begin
If MarketPosition >= 0 Then Begin
Sell("s",AtMarket);
EntryPrice = Close;
MaxProfit = Close;
End;
End;
End;
If MarketPosition == 1 Then Begin
MaxProfit = MaxList(MaxProfit, Close);
If (Close - EntryPrice) >= ProfitTarget Then
ExitLong("bx1",AtMarket);
If (EntryPrice - Close) >= StopLoss Then
ExitLong("bx2",AtMarket);
If (MaxProfit - Close) >= TrailStop Then
ExitLong("bx3",AtMarket);
End;
If MarketPosition == -1 Then Begin
MaxProfit = MinList(MaxProfit, Close);
If (EntryPrice - Close) >= ProfitTarget Then
exitshort("sx1",atmarket);
If (Close - EntryPrice) >= StopLoss Then
exitshort("sx2",atmarket);
If (Close - MaxProfit) >= TrailStop Then
exitshort("sx3",atmarket);
End;
2025-08-27
162
글번호 193548
시스템
답변완료
검색식 부탁드려요 항상 감사합니다.
다음 수식은 음에서 양으로 바뀌는 종목을 찾으려고 만들었는데 일부 종목이 원래 양인 종목이 포함되서 나오는데 오류를 못찾겠습니다. 오류 수정 부탁드리겠습니다.
즉 전일까지는 상단선(음) 당일에 하단선(양)으로 변경되는 종목검색입니다.
추가로 당일에 양으로 바뀌는 선의 값이 일목 구름 상단에 있는 조건도 함께 부탁드립니다. 감사합니다.
Input : period(14), multiplier(3);
Var : src(0), alpha(0), source(0), AtrV(0),
upperBand(0), lowerBand(0), prevUpperBand(0), prevLowerBand(0),
prevRed(0);
If CurrentBar > 2 Then
{
// ── 지표식 동일: 지수 ATR
src = (H + L) / 2;
alpha = 1 / period;
source = Max(H - L, Max(Abs(H - C[1]), Abs(L - C[1])));
AtrV = alpha * source + (1 - alpha) * AtrV[1];
upperBand = src + multiplier * AtrV;
lowerBand = src - multiplier * AtrV;
prevUpperBand = upperBand[1];
prevLowerBand = lowerBand[1];
if (lowerBand > prevLowerBand) or (C[1] < prevLowerBand) then
lowerBand = lowerBand;
else
lowerBand = prevLowerBand;
if (upperBand < prevUpperBand) or (C[1] > prevUpperBand) then
upperBand = upperBand;
else
upperBand = prevUpperBand;
upperRaw[t-1] : upperRaw[t-2]
if (upperBand[1] < upperBand[2]) or (C[2] > upperBand[2]) then
prevRed = upperBand[1];
else
prevRed = upperBand[2];
if CrossUp(C, prevRed) Then
Find(1);
}
2025-08-27
176
글번호 193537
종목검색
답변완료
수식좀 부탁드립니다
input : Period1(20),Period2(60),Period3(120); var1 = ma(C,Period1); var2 = ma(C,Period2); var3 = ma(c,Period3); if CrossUp(var1, var3) then buy(); if CrossUp(var1, var2) and var1 > var3 and var2 > var3 then buy(); } if Crossdown(var1, var3) then sell(); if Crossdown(var1, var2) and var1 < var3 and var2 < var3 then sell(); } 위의 수식에서 매수 신호 : - 매수신호 캔들 저가보다 - 저가가 작은 직전캔들 3개의 저가 라인과 수치좀 부탁드립니다 매도는 반대로 부탁드립니다
2025-08-27
160
글번호 193536
시스템
답변완료
지표 변환부탁드립니다.
// 시가, 고가, 저가 변수
openPrice = open
highPrice = high
lowPrice = low
// 매시간 정시에 해당하는 캔들인지 확인
isHourClose = (minute == 0)
// 양의 조건: 시가가 저가와 같고 저가가 더 이상 갱신되지 않는 경우
isPositive = isHourClose and (openPrice == lowPrice) and (lowPrice == ta.lowest(lowPrice, 1))
// 음의 조건: 시가가 고가와 같고 고가가 더 이상 갱신되지 않는 경우
isNegative = isHourClose and (openPrice == highPrice) and (highPrice == ta.highest(highPrice, 1))
// 텍스트를 저장할 변수
var string ssText = na
// 양의 텍스트 및 선 표시
if (isPositive)
ssText := str.tostring(openPrice)
label.new(bar_index, lowPrice - 1, text=ssText, style=label.style_label_up, color=color.green, textcolor=color.white, size=size.large, textalign=text.align_center)
line.new(bar_index[1], lowPrice, bar_index, lowPrice, color=color.red, width=1)
// 음의 텍스트 및 선 표시
if (isNegative)
ssText := str.tostring(openPrice)
label.new(bar_index, highPrice + 1, text=ssText, style=label.style_label_down, color=color.green, textcolor=color.white, size=size.large, textalign=text.align_center)
line.new(bar_index[1], highPrice, bar_index, highPrice, color=color.blue, width=1)
else
ssText := na // 조건이 충족되지 않으면 텍스트를 비움
2025-08-27
178
글번호 193535
지표