Three Black Crows Penanda & Statistik

edwinardyanto · study · 38 行 · 点赞 5 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

//@version=6
// Three Black Crows penanda + statistik jujur — @edwinardyanto (aturan sama dengan Reels 21 Okt 2026)
// Pola: 3 candle merah berturut, tiap close lebih rendah, close sebelum gagak pertama > SMA 20. Dihitung tiap kali 3 merah terbentuk (termasuk berurutan).
// Tabel: berapa % sudah turun selama pola, % candle berikutnya hijau, % lebih rendah N candle sesudah masuk vs sembarang. Bahan belajar, bukan sinyal.
indicator("Three Black Crows Penanda & Statistik", overlay = true, max_labels_count = 500)
N = input.int(5, "Ukur N candle sesudah masuk")
sma = ta.sma(close, 20)
red(k) => close[k] < open[k]
bc = red(0) and red(1) and red(2) and close < close[1] and close[1] < close[2] and close[3] > sma[3]
plotshape(bc, "3 Black Crows", shape.labeldown, location.abovebar, color.new(color.black, 0), text = "3BC", textcolor = color.white, size = size.tiny)
var int n = 0
var int hijau = 0
var int nN = 0
var int bN = 0
var int nA = 0
var int bA = 0
var float drop = 0.0
if bc
    n += 1
    drop += (close / open[2] - 1) * 100
if bc[1]
    hijau += close > open ? 1 : 0
if bc[N] and not na(open[N - 1])
    nN += 1
    bN += close < open[N - 1] ? 1 : 0
if bar_index > N
    nA += 1
    bA += close < open[N - 1] ? 1 : 0
var table t = table.new(position.top_right, 2, 4, bgcolor = color.new(color.white, 10), border_width = 1)
if barstate.islast and n > 0
    table.cell(t, 0, 0, "Three Black Crows", text_color = color.black)
    table.cell(t, 1, 0, str.tostring(n) + " kali", text_color = color.black)
    table.cell(t, 0, 1, "turun selama pola (rata-rata)", text_color = color.black)
    table.cell(t, 1, 1, str.tostring(drop / n, "#.##") + "%", text_color = color.red)
    table.cell(t, 0, 2, "candle berikutnya hijau", text_color = color.black)
    table.cell(t, 1, 2, str.tostring(100.0 * hijau / n, "#.#") + "%", text_color = color.green)
    table.cell(t, 0, 3, "turun " + str.tostring(N) + " candle sesudah vs sembarang", text_color = color.black)
    table.cell(t, 1, 3, (nN > 0 ? str.tostring(100.0 * bN / nN, "#.#") : "-") + "% vs " + (nA > 0 ? str.tostring(100.0 * bA / nA, "#.#") : "-") + "%", text_color = color.gray)

← 返回列表