INVITE-ONLY SCRIPT

FMT by C.ball

30
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org/MPL/2.0/
// © 2025 Ball Goldricher

//version=5
indicator("FMT by C.ball", shorttitle="FMT", overlay=true)

// === Moving Averages ===
ema20 = ta.ema(close, 20)
ema50 = ta.ema(close, 50)

// === Cross Logic ===
crossUp = ta.crossover(close, ema20)
crossDown = ta.crossunder(close, ema20)

// === Persistent Counters ===
var int upCount = 0
var int downCount = 0

if crossUp
upCount := upCount + 1
if crossDown
downCount := downCount + 1

// === Entry Signals on 2nd Cross + EMA50 condition ===
buySignal = crossUp and upCount == 2 and close > ema50
sellSignal = crossDown and downCount == 2 and close < ema50

// === Plot Buy/Sell Signal ===
plotshape(buySignal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(sellSignal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")

// === Reset Counters After Signal ===
if buySignal or sellSignal
upCount := 0
downCount := 0

// === Plot EMAs (Optional for visual confirmation) ===
plot(ema20, color=color.orange, title="EMA 20")
plot(ema50, color=color.blue, title="EMA 50")

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.