Strategy · Pine Script v5 · On the chart

Btc Version5pine

by WMW333· code credited to Arcotrade

This strategy detects volume-based trading signals on Bitcoin perpetual futures.

View on GitHub

GitHub stars3on the repository
Pine versionv5runs as is
Lines of code135
Settings15inputs
LicenceNone statedfile: MPL-2.0
Last update4 years ago22 Aug 2022

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

135 lines of Pine Script v5 from main.pinescript, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

main.pinescript
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Arcotrade

//@version=5

//Strategia per scalping (1min) btcusdtperp binancefutures perpetual

strategy(title="Btc.Version5pine", overlay=true)

//FINESTRA TEMPORALE
// daMese = input(defval= 6, title= 'Dal Mese', minval= 1)
// daGiorno = input(defval= 1, title= 'Dal Giorno', minval= 1)
// daAnno = input(defval= 2020, title= 'Da Anno', minval= 1)

// aMese = input(defval= 2, title= 'Al Mese', minval= 1)
// aGiorno = input(defval= 28, title= 'Al Giorno', minval= 1)
// aAnno = input(defval= 2021, title= 'A anno', minval= 1)

// //bande bollinger
// SmaBB = input(defval = 60, title = "SmaBB" )
// basis = sma(close, SmaBB)
// Dev = input (defval = 3, title = "Dev")
// dev = Dev * stdev(close, SmaBB)
// upper = basis + dev
// lower = basis - dev

//medie mobili esponenziali (usate solo per filtrare operazioni)
// ema10 = ema(close, 10)
// ema15 = ema(close, 15)
// ema60 = ema(close, 60)

//plottare le medie a grafico
//plot(ema10, title= "10", color= #fff100, linewidth=1)
//plot(ema15, title= "15", color= #ff0000, linewidth=1)
//plot(ema60, title= "60", color= #ffffff, linewidth=2)

//POSIZIONE:
margine = input.int(defval = 100, title = "Margine $", minval = 1)
leva = input.int(defval = 100, title = "Leva x", minval = 1)
Qty_Posizione = ((margine * leva) / close [1]) //input(defval = 0.2, title = "Quantità posizione", minval = 0.00000001)


//SOGLIE ALGORITMO DA IMPOSTARE IN INPUT:
Soglia_Volumi = input.int(defval= 1900, title = "Soglia Volumi", minval = 10)
Soglia_Volumi_Precedente = input.int(defval = 3000, title = "Soglia Vol. barra precedente", minval = 1)
Soglia_spikeUpGreen = input.float(defval = 0.06, title = "Soglia SpikeUp Green x Short")
Soglia_spikeDownRed =  input.float(defval = -0.06, title = "Soglia SpikeDown Red x Long") 
Soglia_ATR = input.int(defval = 101, title = "Soglia ATR")
Soglia_SpikeDown_Reverse_per_short = input.float(defval = -0.11, title = "Soglia SpikeDown Reverse x short")
Soglia_SpikeUp_Reverse_per_long = input.float(defval = 0.11, title = "Soglia SpikeUp Reverse x long")

//
V = volume

body = (close - open)



//Spike (N.b: ho differenziato gli spike in base al colore della candela)

//Spikeup 
spikeUpGreen = (((high - close) / close) * 100)
spikeUpRed = (((high - open) / open) * 100)
//SpikeDown
spikeDownGreen = (((low - open) / open) * 100)
spikeDownRed = (((low - close) / close) * 100)

//condizioni di ingresso
shortcondition = body > 0 
                 and spikeUpGreen > Soglia_spikeUpGreen 
                 and V > Soglia_Volumi 
                 and spikeDownGreen > Soglia_SpikeDown_Reverse_per_short 
                 and V[1] < Soglia_Volumi_Precedente 
                 and ta.atr(14) < Soglia_ATR 
                 //and not longcondition//and close > upper//and not short //or body < 0 and spikeUpRed > 0.17 and spikeDownRed > -0.1 and V > 1100 and V[1] < 1500 and close > ema10 and close > ema15

longcondition = body < 0 
                 and spikeDownRed < Soglia_spikeDownRed 
                 and V > Soglia_Volumi 
                 and spikeUpRed < Soglia_SpikeUp_Reverse_per_long  
                 and V [1] < Soglia_Volumi_Precedente 
                 and ta.atr(14) < Soglia_ATR 
                 and not shortcondition
                 // and close < lower or body > 0 and spikeDownRed < -0.2 and V > 1400 and spikeUpGreen < 0.1 and spikeUpRed < 0.1 and spikeUpGreen> -0.1 and V > 1500 and V[1] < 1500


//condizioni di uscita
// closelong = high > ema60 or low < low[+ 1]
// closeshort = low < ema15

//Ingresso a mercato
strategy.entry("long", strategy.long, qty = Qty_Posizione, when = longcondition)
strategy.entry("short", strategy.short, qty = Qty_Posizione, when = shortcondition)


//Trail_points: livello di attivazione trailing stop (profitto specificato in tick.) Verrà piazzato al raggiungimento della soglia prescelta (determinata in base al profitto) 
//il valore di offset (in tick) per determinare il prezzo iniziale dell'ordine di trailing stop viene specificato con il parametro trail offset: x tick sotto livello attivazione per uscire long e vice x short
trailpoints = input.int(defval = 1400, title = "Trailing points(livello attivazione")
//trail_offset: prezzo di stop del trailing (specificato in tick). Rappresenta il valore di offset in tick per determinare il prezzo iniziale dello stop del trailing:
//x tick sotto "trail points" per uscire da poizioni long, x tick sopra "trail points" per uiscire da short.
trailoffset = input.int(defval = 10, title = "Trailing offset (x tick sopra o sotto trail point")
lossLong = input.int(defval = 1250, title = "SL Long in ticks")

//Stop Loss x Short in ticks (anche in input)
lossShort = input.int(defval = 1100, title = "SL Short in ticks")


strategy.exit("exit", "long", trail_points = trailpoints , trail_offset = trailoffset, loss = lossLong) // qty = Qty_Posizione // profit = profitLong
strategy.exit("exit", "short", trail_points = trailpoints, trail_offset = trailoffset, loss = lossShort) //qty = Qty_Posizione// profit = profitShort

//Determinare il numero massimo di ordini eseguiti ogni giorno (anche in input)
Max_trade_giornalieri = input.int(defval = 50, title = "Max trades giornalieri")
strategy.risk.max_intraday_filled_orders(Max_trade_giornalieri)

//Determinare la perdita massima in cash per 1 giorno
Max_loss_giornaliera = input.int(defval = 700, title = "Max perdita giornaliera $")
strategy.risk.max_intraday_loss(Max_loss_giornaliera, strategy.cash)

// strategy.close("long", when = closeshort)
// strategy.close("short", when = closelong)


// longcondition = long and long [0] and not long [1] //aspettare [N candele] prima di aprire la posizione
// shortcondition = short and short [0] and not short [1] // ""


// plot(ema10, title= "10", color= #00ffaa, linewidth=3)
// plot(ema60, title= "60", color= #FFC1CC, linewidth=2)

// start = timestamp(2019, 1, 1,0 ,0)
// end = timestamp(2022, 2, 24,0,0)

// if time >= start and time <= end
//     strategy.entry("long", strategy.long, 1.0, when = longcondition)
//     strategy.entry("short", strategy.short, 1.0, when = shortcondition)

Overview

Btc Version5pine calculates volume spikes on green and red candles along with ATR for volatility filtering. Long entries trigger on red candles with high volume and specific spike conditions while short entries fire on green candles meeting reverse spike rules. Position size adjusts with user-defined margin and leverage. ATR and volume thresholds filter signals and trailing points set dynamic stops. The script draws signals directly on the price chart overlay for BTCUSDT perp on Binance.

Details

Published by

WMW333 on GitHub

Code credit

Arcotrade, as written in the script's header

Type

Strategy, Pine Script v5

Draws

On the price chart

Category

Volume, Volatility & bands, Candlestick patterns, Scalping

Markets

Crypto

Timeframes

M15-H1

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Margine $int100margine
Leva xint100leva
Soglia Volumiint1900Soglia_Volumi
Soglia Vol. barra precedenteint3000Soglia_Volumi_Precedente
Soglia SpikeUp Green x Shortfloat0.06Soglia_spikeUpGreen
Soglia SpikeDown Red x Longfloat-0.06Soglia_spikeDownRed
Soglia ATRint101Soglia_ATR
Soglia SpikeDown Reverse x shortfloat-0.11Soglia_SpikeDown_Reverse_per_short
Soglia SpikeUp Reverse x longfloat0.11Soglia_SpikeUp_Reverse_per_long
Trailing points(livello attivazioneint1400trailpoints
Trailing offset (x tick sopra o sotto trail pointint10trailoffset
SL Long in ticksint1250lossLong
Show all 15 settings
SettingTypeDefaultVariable
SL Short in ticksint1100lossShort
Max trades giornalieriint50Max_trade_giornalieri
Max perdita giornaliera $int700Max_loss_giornaliera
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.

Similar Pine Scripts

7 stars

Calculates volume profile levels over a lookback window to identify support, resistance, and Point of Control (POC) lines on the price chart. It executes trades based on price interaction with these low-volume zones, featuring customizable signal inversion and

Strategy v6 ScalpingVolume
Updated 1 year ago · None stated GitHub repository of Enhanced NQ1 Scalping Strategy
1 stars

The strategy calculates the point of control and value area from the volume profile using a lookback of 150 bars and 24 rows. It applies a fast EMA trend filter, a V18 coherence resonance check with minimum threshold of 1.6, and an ATR volatility filter requir

Strategy v6 VolumeSupport & resistance
Updated 2 months ago · None stated GitHub repository of TnSovereignVolumeProfileScalpV6

YFI XBT Binance 1m

by tseitz
1 stars

This strategy plots a close VWAP and percentage-offset high and low VWAP bands on the price chart. It enters long when the bar opens above the high band, optionally only on a green candle, and short when the bar opens below the low band, optionally only on a r

Strategy v4 VolumeBreakout Repaints
Updated 4 years ago · None stated GitHub repository of YFI XBT Binance 1m
330 stars

Exceeded Candle [Alorse] is a mean-reversion strategy that identifies candlestick engulfing patterns combined with Bollinger Bands filters. It enters a long position when a green candle surpasses the body of the previous red candle while price is below the mid

Strategy v4 Mean reversionCandlestick patterns
Updated 2 months ago · None stated GitHub repository of Exceeded candle [Alorse]
257 stars

This overlay strategy is built for ES futures on the one-minute chart. It plots a volume-weighted moving average of price opens and standard-deviation bands at Fibonacci ratios, plus a second longer volume-weighted average from a higher-timeframe open. Call an

Strategy v5 Volatility & bandsMoving averages
Updated 6 weeks ago · None stated GitHub repository of ES Futures 1M No Repaint
218 stars

This strategy identifies trade opportunities based on candlestick wick imbalances relative to the Average True Range. It enters positions when candle wicks exceed defined thresholds and filters out doji candles using a minimum body ATR requirement. Exits are h

Strategy v6 Candlestick patternsVolatility & bands Repaints
Updated 3 months ago · None stated GitHub repository of Super Negative R:R Wick Strategy

More strategys

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers