//@version=6
// Universal Strategy — Any Market / Her Piyasa
// github.com/trugurpala/pinescriptv6 — Author: Ugur Pala
//
// TR: Bu strateji herhangi bir enstrümanda çalışacak şekilde tasarlandı.
// syminfo.* değişkenleri ile otomatik uyum sağlar.
// EN: This strategy adapts automatically to any instrument.
// Uses syminfo.* variables for automatic adaptation.
strategy("Universal Strategy [trugurpala]",
overlay = true,
initial_capital = 10000,
default_qty_type = strategy.percent_of_equity,
default_qty_value = 5,
commission_type = strategy.commission.percent,
commission_value = 0.1,
slippage = 2)
// ── Inputs ───────────────────────────────────────────────────────────────────
int fastLen = input.int(9, "Fast EMA", minval=1)
int slowLen = input.int(21, "Slow EMA", minval=1)
int trendLen = input.int(50, "Trend EMA", minval=1)
int atrLen = input.int(14, "ATR", minval=1)
float slMult = input.float(1.5, "SL ATR Mult", step=0.1)
float tpMult = input.float(2.5, "TP ATR Mult", step=0.1)
bool longOnly = input.bool(false, "Long Only")
bool useTrend = input.bool(true, "Use Trend Filter")
// ── Hesaplamalar ──────────────────────────────────────────────────────────────
float fastEma = ta.ema(close, fastLen)
float slowEma = ta.ema(close, slowLen)
float trendEma = ta.ema(close, trendLen)
float atrVal = ta.atr(atrLen)
bool trendUp = not useTrend or close > trendEma
bool trendDown = not useTrend or close < trendEma
bool bullCross = ta.crossover(fastEma, slowEma) and trendUp
bool bearCross = ta.crossunder(fastEma, slowEma) and trendDown
// ── Debug: Enstrüman Bilgisi / Instrument Info ────────────────────────────────
if barstate.isconfirmed and barstate.islastconfirmedhistory
label.new(bar_index, high,
syminfo.exchange + ":" + syminfo.ticker + "\n" +
"Type: " + syminfo.type + "\n" +
"Currency: " + syminfo.currency + "\n" +
"Mintick: " + str.tostring(syminfo.mintick),
style = label.style_label_down,
color = color.new(color.blue, 70),
textcolor = color.white,
size = size.small)
// ── Entries ──────────────────────────────────────────────────────────────────
if bullCross
strategy.entry("Long", strategy.long)
strategy.exit("Long Exit", "Long",
stop=close - slMult*atrVal, limit=close + tpMult*atrVal)
if bearCross and not longOnly
strategy.entry("Short", strategy.short)
strategy.exit("Short Exit", "Short",
stop=close + slMult*atrVal, limit=close - tpMult*atrVal)
// ── Visuals ──────────────────────────────────────────────────────────────────
plot(fastEma, "Fast", fastEma > slowEma ? color.green : color.red, linewidth=2)
plot(slowEma, "Slow", fastEma > slowEma ? color.lime : color.orange,linewidth=2)
plot(trendEma, "Trend", color.new(color.gray, 40), linewidth=1)
bgcolor(bullCross[1] ? color.new(color.green, 95) : bearCross[1] ? color.new(color.red, 95) : na)
plotshape(bullCross, "Long", shape.triangleup, location.belowbar, color.green, size=size.normal)
plotshape(bearCross, "Short", shape.triangledown, location.abovebar, color.red, size=size.normal)
Overview
A long opens when the fast average crosses above the slow average, and a short opens on a cross below unless long-only mode is on. An optional trend filter requires price to be on the matching side of a longer average. Each entry sets an ATR-based stop and take profit using the chosen multipliers. Position size defaults to five percent of equity. A small label shows exchange, ticker, type, currency, and mintick.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Fast EMA
int
9
fastLen
Slow EMA
int
21
slowLen
Trend EMA
int
50
trendLen
ATR
int
14
atrLen
SL ATR Mult
float
1.5
slMult
TP ATR Mult
float
2.5
tpMult
Long Only
bool
false
longOnly
Use Trend Filter
bool
true
useTrend
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This mean-reversion strategy plots Bollinger Bands and a long-term moving average directly on the price chart. It enters trades when price candles penetrate the outer Bollinger Bands beyond a user-defined body percentage, anticipating a price reversal. Entries
This overlay strategy targets one-minute ES futures and plots volume-weighted moving-average bands from the open, scaled by a standard-deviation multiple, plus a slower band from ten-minute opens. A higher-timeframe exponential moving average can filter trades
STRG-BBForce is a Bollinger Bands trend-following strategy. It calculates standard Bollinger Bands and tracks directional alignment across the upper, lower, and basis lines. When all three lines slope upward, it opens a long position and closes short positions
This trading strategy combines three Exponential Moving Averages (8, 14, and 50 periods by default) with Stochastic RSI and Average True Range (ATR). It enters a long position when EMA 1 is above EMA 2, EMA 2 is above EMA 3, and the Stochastic RSI %K line cros
This strategy generates buy and sell signals based on Bollinger Band crossovers combined with a simple moving average trend filter. It enters a long position when price crosses above the lower band while trading above the SMA filter line, and enters a short po
This overlay strategy combines a Chandelier Exit with a zero-lag least squares moving average. Although the header mentions Heikin Ashi candles, the calculations use ordinary closes. An ATR trailing stop sets long and short levels, and direction flips when pri