📚 Strategy Examples
Pine Script V5 sample trading strategies with webhook integration
How It Works?
Choose Strategy
Select one of the examples below or write your own strategy
Add to TradingView
Copy the Pine Script code and add it as a new indicator/strategy in TradingView
Create Alert
Get your webhook URL from Alarm Creator page and create an alert in TradingView
Automated Trading
Orders are automatically sent to Binance when strategy signals
Webhook JSON Parameters
JSON format for the alert() function in your strategies:
| Parameter | Description | Example Value |
|---|---|---|
borsa |
Hedef borsa YENİ | "Binance" / "MEXC" |
piyasa |
Market to trade | "FUTURES" / "SPOT" |
sembol |
Trading pair (TradingView variable) | "{{ticker}}" |
yon |
Trade direction | "BUY" / "SELL" |
tip |
Order type | "MARKET", "LIMIT", "STOP" |
tutar |
Trade amount (USDT) | 10 |
fiyat |
Limit/Stop price (0 for MARKET) | 0 |
Pine Script V5 Strategy Examples
Strategy Description
This strategy uses two moving averages (EMA). When the fast EMA (9 period) crosses above the slow EMA (21 period), it gives a BUY signal, and when it crosses below, it gives a SELL signal. This is the simplest example of trend-following strategies.
When to Use: In strong trending markets, may give false signals in sideways markets.
//@version=5
strategy("AlgoCripto - EMA Crossover", overlay=true)
// Parametreler
fastLength = input.int(9, "Fast EMA Length")
slowLength = input.int(21, "Slow EMA Length")
// EMA Hesaplama
fastEMA = ta.ema(close, fastLength)
slowEMA = ta.ema(close, slowLength)
// Al/Sat Sinyalleri
longCondition = ta.crossover(fastEMA, slowEMA)
shortCondition = ta.crossunder(fastEMA, slowEMA)
// Görseller
plot(fastEMA, color=color.blue, title="Fast EMA")
plot(slowEMA, color=color.red, title="Slow EMA")
// Strateji Emirleri
if longCondition
strategy.entry("Long", strategy.long)
alert('{"borsa": "Binance", "piyasa": "FUTURES", "sembol": "{{ticker}}", "yon": "BUY", "tip": "MARKET", "tutar": 10, "fiyat": 0}', alert.freq_once_per_bar)
if shortCondition
strategy.entry("Short", strategy.short)
alert('{"borsa": "Binance", "piyasa": "FUTURES", "sembol": "{{ticker}}", "yon": "SELL", "tip": "MARKET", "tutar": 10, "fiyat": 0}', alert.freq_once_per_bar)
TradingView Alert Setup
When creating an alert, select "Alert function calls only" and get your webhook URL from Alarm Creator page.
Strategy Description
RSI (Relative Strength Index) is a momentum indicator. When RSI falls below 30, it indicates oversold (BUY signal), and when it rises above 70, it indicates overbought (SELL signal).
When to Use: Works well in consolidation/sideways markets. May give false signals in strong trends.
//@version=5
strategy("AlgoCripto - RSI Strategy", overlay=false)
// Parametreler
rsiLength = input.int(14, "RSI Length")
oversoldLevel = input.int(30, "Oversold Level")
overboughtLevel = input.int(70, "Overbought Level")
// RSI Hesaplama
rsi = ta.rsi(close, rsiLength)
// Al/Sat Sinyalleri
longCondition = ta.crossover(rsi, oversoldLevel)
shortCondition = ta.crossunder(rsi, overboughtLevel)
// Görseller
hline(oversoldLevel, "Oversold", color=color.green)
hline(overboughtLevel, "Overbought", color=color.red)
hline(50, "Middle", color=color.gray)
plot(rsi, color=color.blue, title="RSI")
// Strateji Emirleri
if longCondition
strategy.entry("Long", strategy.long)
alert('{"borsa": "Binance", "piyasa": "FUTURES", "sembol": "{{ticker}}", "yon": "BUY", "tip": "MARKET", "tutar": 10, "fiyat": 0}', alert.freq_once_per_bar)
if shortCondition
strategy.entry("Short", strategy.short)
alert('{"borsa": "Binance", "piyasa": "FUTURES", "sembol": "{{ticker}}", "yon": "SELL", "tip": "MARKET", "tutar": 10, "fiyat": 0}', alert.freq_once_per_bar)
İpucu
RSI değerlerini (30/70) piyasa koşullarına göre ayarlayabilirsiniz. Daha az sinyal için 20/80, daha çok sinyal için 35/65 değerlerini deneyebilirsiniz.
Strategy Description
This strategy uses pivot points to identify support and resistance levels. When price breaks resistance, it gives a BUY signal, and when it breaks support, it gives a SELL signal.
When to Use: Used when expecting a breakout after consolidation or in ranging markets.
//@version=5
strategy("AlgoCripto - Support/Resistance Breakout", overlay=true)
// Parametreler
pivotLength = input.int(10, "Pivot Length")
breakoutConfirmation = input.int(2, "Breakout Confirmation Bars")
// Pivot Noktalarını Bul
pivotHigh = ta.pivothigh(high, pivotLength, pivotLength)
pivotLow = ta.pivotlow(low, pivotLength, pivotLength)
// Direnç ve Destek Seviyeleri
var float resistance = na
var float support = na
if not na(pivotHigh)
resistance := pivotHigh
if not na(pivotLow)
support := pivotLow
// Kırılma Sinyalleri
longCondition = close > resistance and close[breakoutConfirmation] <= resistance
shortCondition = close < support and close[breakoutConfirmation] >= support
// Görseller
plot(resistance, color=color.red, style=plot.style_line, linewidth=2, title="Resistance")
plot(support, color=color.green, style=plot.style_line, linewidth=2, title="Support")
// Strateji Emirleri
if longCondition
strategy.entry("Long", strategy.long)
alert('{"borsa": "Binance", "piyasa": "FUTURES", "sembol": "{{ticker}}", "yon": "BUY", "tip": "MARKET", "tutar": 10, "fiyat": 0}', alert.freq_once_per_bar)
if shortCondition
strategy.entry("Short", strategy.short)
alert('{"borsa": "Binance", "piyasa": "FUTURES", "sembol": "{{ticker}}", "yon": "SELL", "tip": "MARKET", "tutar": 10, "fiyat": 0}', alert.freq_once_per_bar)
Dikkat
Kırılma stratejileri yanlış kırılma (false breakout) riski taşır. Stop-loss kullanımı önerilir.
Ready to Start?
Copy the strategies and start using them in TradingView right away!
Go to Alarm Creator API Settings