INVITE-ONLY SCRIPT

Byakko_Telepathy_Logic2

47
//version=6
indicator("白虎② (Gold M1 Long)", overlay=true, max_labels_count=500)

//====================
// Inputs
//====================
osLevel = input.float(30.0, "Oversold level (<=)", step=0.1)
waitBars = input.int(7, "Entry window after oversold (bars)", minval=1)
coolBars = input.int(10, "Cooldown bars (連発防止)", minval=1)

useMA7Filter = input.bool(true, "7MA filter (flat/up only)")
showTriangle = input.bool(true, "Show ▲")

//====================
// Indicators
//====================
// RSI
rsi7 = ta.rsi(close, 7)
rsi9 = ta.rsi(close, 9)

// MFI
mfi7 = ta.mfi(hlc3, 7)
mfi9 = ta.mfi(hlc3, 9)

// Stoch① (7,3,3)
k1_raw = ta.stoch(high, low, close, 7)
k1 = ta.sma(k1_raw, 3)

// Stoch② (9,6,3)
k2_raw = ta.stoch(high, low, close, 9)
k2 = ta.sma(k2_raw, 3)
d2 = ta.sma(k2, 6)

// MA7 filter
ma7 = ta.sma(close, 7)
ma7Ok = not useMA7Filter or (ma7 >= ma7[1])

//====================
// ① 6個中「4個以上」が30以下
//====================
countOS =
(rsi7 <= osLevel ? 1 : 0) +
(rsi9 <= osLevel ? 1 : 0) +
(mfi7 <= osLevel ? 1 : 0) +
(mfi9 <= osLevel ? 1 : 0) +
(k1 <= osLevel ? 1 : 0) +
(k2 <= osLevel ? 1 : 0)

oversoldNow = countOS >= 4

//====================
// State
//====================
var bool armed = false
var int armedBar = na

var int lastSignalBar = na
canFire = na(lastSignalBar) or (bar_index - lastSignalBar > coolBars)

// oversold 検出
if barstate.isconfirmed and oversoldNow and not armed
armed := true
armedBar := bar_index

// 期限切れ(7分)
if armed and not na(armedBar) and (bar_index - armedBar > waitBars)
armed := false
armedBar := na

//====================
// ② Entry(確定足・shift=1)
//====================
entry = barstate.isconfirmed and armed and (d2 < k2) and ma7Ok and canFire

if entry
lastSignalBar := bar_index
armed := false
armedBar := na

//====================
// Plot: ピンク▲(ローソク下)
//====================
plotshape(
showTriangle and entry,
title="Logic② BUY ▲",
style=shape.triangleup,
location=location.belowbar,
color=color.fuchsia,
size=size.small
)

//====================
// Alert
//====================
alertcondition(
entry,
title="Logic② BUY ▲",
message="Logic② BUY ▲\n🐯 白虎②\n{{ticker}} {{interval}}\n6個中4個<=30 → 7分以内に D<K(確定足) + MA7 平行/上向き"
)

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.