Strategy · Pine Script v4 · On the chart

CombinedBinHAndClucV6

by viktors1982· code credited to viktors.s@gmail.com

CombinedBinHAndClucV6 is a trading strategy based on the popular BinHV45 and ClucMay72018 algorithms.

View on GitHub

Repaints

GitHub stars36on the repository
Pine versionv4older, still runs
Lines of code112
Settings14inputs
LicenceNone statedfile: MPL-2.0
Last update2 years ago10 Apr 2024

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

112 lines of Pine Script v4 from tradingview/pinescripts/strategies/CombinedBinHAndClucV6.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

CombinedBinHAndClucV6.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © viktors.s@gmail.com

//@version=4
strategy("CombinedBinHAndClucV6", overlay=true, currency=currency.EUR, default_qty_type=strategy.cash, default_qty_value=150, initial_capital = 33000, calc_on_every_tick=true,commission_type=strategy.commission.percent, commission_value =0.15)


startDate  = input(title="Start Strat", type=input.time, defval=timestamp("01 Jan 2021 00:00 +0000") )
// startYear  = input(title="Start Year", type=input.integer, defval=2021, step =1, minval = 2000 )
// startMonth = input(title="Month", type=input.integer, defval=1, step =1, minval = 1, maxval = 12 )
// startDay   = input(title="Day", type=input.integer, defval=1, step =1, minval = 1, maxval = 31 )

enableROI = input(title="Enable RIO", type=input.bool, defval=true)
ROIValue  = input(title="RIO value %", type=input.float, defval= 1.8, step =0.01, minval = 0.1, maxval = 100 )
enableROIRSILimit  = input(title="Enable RIO RSI limit", type=input.bool, defval= true)
ROIRSILimit   = input(title="RIO RSI limit", type=input.integer, defval=50, step =1, minval = 1, maxval = 100 )

enableTimeout = input(title="Enable Timeout", type=input.bool, defval=true)
timeoutMinuts  = input(title="Timeout minuts", type=input.integer, defval=300, step =1, minval = 100000 )



BinHV45_BB_length = input(title="BinHV45 Bollinger Bands length", type=input.integer, defval=40, step =1, minval = 5, maxval = 100 )

BinHV45_close_bbdelta  = input(title="BinHV45 close bbdelta", type=input.float, defval= 0.031, step =0.001, minval = 0.1, maxval = 100 )
BinHV45_closedelta  = input(title="BinHV45 closedelta", type=input.float, defval= 0.018, step =0.001, minval = 0.1, maxval = 100 )
BinHV45_tail_bbdelta  = input(title="BinHV45 tail bbdelta", type=input.float, defval= 0.223, step =0.001, minval = 0.1, maxval = 100 )

ClucMay72018_BB_length = input(title="ClucMay72018 Bollinger Bands length", type=input.integer, defval=20, step =1, minval = 5, maxval = 100 )
ClucMay72018_close  = input(title="ClucMay72018 close", type=input.float, defval= 0.993, step =0.001, minval = 0.1, maxval = 100 )
ClucMay72018_volume_coef = input(title="ClucMay72018 Volume coef", type=input.integer, defval=21, step =1, minval = 1, maxval = 300 )

//strategy BinHV45
[middle, upper, lower] = bb(close, BinHV45_BB_length, 2)
bbdelta = abs(middle - lower)
closedelta = abs(close -close[1])
tail = abs(close - low)


//strategy ClucMay72018
[middle2, upper2, lower2] = bb(close, ClucMay72018_BB_length, 2)
p_middle = plot(middle2, color=color.aqua)
p_upper = plot(upper2, color=color.silver)
p_lower = plot(lower2, color=color.silver)
fill(p_lower,p_upper)

ema_slow = ema(close,50)
volume_mean_slow = sum(volume,30)/30
plot(ema_slow, color=color.red)

ema_50  =  ema(close,50)
ema_200 =  ema(close,200)
sma_5   =  ema(close,5)
rsi_5m     =  rsi(close,14)
atr_5m  = atr(14)
sma_high = sma(high,20)
sma_low= sma(low,20)


plotchar(rsi_5m, "rsi_5m", "", location = location.top)

//1h ... !


ema_50_1h = security(syminfo.tickerid, '60', ema_50)
ema_200_1h = security(syminfo.tickerid, '60', ema_200)
rsi_1h = security(syminfo.tickerid, '60', rsi_5m)
atr_1h = security(syminfo.tickerid, '60', atr_5m)
sma_high_1h = security(syminfo.tickerid, '60', sma_high) + atr_1h
sma_low_1h = security(syminfo.tickerid, '60', sma_low) - atr_1h
close_1h = security(syminfo.tickerid, '60', close)

float Hlv_1h = na
Hlv_1h := close_1h > sma_high_1h ? 1 : close_1h < sma_low_1h ? -1 : Hlv_1h[1]
sslDown_1h = Hlv_1h < 0 ? sma_high_1h: sma_low_1h
sslUp_1h   = Hlv_1h < 0 ? sma_low_1h : sma_high_1h


// -----------------



BinHV45_Long      = close > ema_200_1h and ema_50 > ema_200 and ema_50_1h > ema_200_1h and  lower[1] > 0 and bbdelta > close * BinHV45_close_bbdelta and closedelta > close * BinHV45_closedelta and tail < bbdelta * BinHV45_tail_bbdelta and close < lower[1] and close <= close[1] 
ClucMay72018_Long = close > ema_200 and close > ema_200_1h and  close < ema_slow and close < ClucMay72018_close * lower2 and volume < volume_mean_slow[1] * ClucMay72018_volume_coef 
Info_Long         = close < sma_5 and sslUp_1h > sslDown_1h and ema_50 > ema_200 and ema_50_1h > ema_200_1h  and rsi_5m < rsi_1h - 43.276


Bin_Sell = close > upper2  and close[1] > upper2[1]

plotchar(BinHV45_Long, "BinHV45_Long", "", location = location.top)
plotchar(ClucMay72018_Long, "ClucMay72018_Long", "", location = location.top)
plotchar(Info_Long, "Info_Long", "", location = location.top)
plotchar(Bin_Sell, "Bin_Sell", "", location = location.top)


//afterStartDate = (time >= timestamp(syminfo.timezone, startYear, startMonth, startDay, 0, 0))

afterStartDate = (time >= startDate)
longCondition = (BinHV45_Long == 1 or ClucMay72018_Long ==1 or Info_Long ==1) and afterStartDate and strategy.position_size <= 0
if (longCondition)
    strategy.entry("Entry", strategy.long, when=(BinHV45_Long) , comment = 'BinHV45_Long')
    strategy.entry("Entry", strategy.long, when=(ClucMay72018_Long) , comment = 'ClucMay72018_Long')
    strategy.entry("Entry", strategy.long, when=(Info_Long) , comment = 'Info_Long')

roi_limit = strategy.position_avg_price * (1 + ROIValue/100 )
plot(roi_limit, color=color.green, style=plot.style_linebr, linewidth=2, title='roi_limit')
roi_sell  = enableROI ? close > roi_limit and (enableROIRSILimit ? (rsi_5m < ROIRSILimit) : true) : na
istimeout = enableTimeout? barssince(longCondition) >= (timeoutMinuts/5): na // 60 * 5 = 300 min
if (strategy.position_size > 0)
    strategy.close(id="Entry", when=(Bin_Sell) , comment = 'bin_sell')
    strategy.close(id="Entry", when=(roi_sell) , comment = 'roi_sell_rsi='+tostring(round(rsi_5m[0])))
    strategy.close(id="Entry", when=(istimeout), comment = 'timout_sell')

Overview

CombinedBinHAndClucV6 calculates dual Bollinger Bands, Exponential Moving Averages, Relative Strength Index, Average True Range, and volume metrics across primary and one-hour higher timeframes. The strategy enters positions during volatility squeezes and trend alignments, while managing exits through configurable ROI targets, RSI filters, or a time-based timeout rule. Indicators plot directly on the chart overlay. Higher-timeframe security requests without offsets introduce historical lookahead and repainting.

Details

Published by

viktors1982 on GitHub

Code credit

viktors.s@gmail.com, as written in the script's header

Type

Strategy, Pine Script v4

Draws

On the price chart

Category

Volatility & bands, Oscillators & momentum, Moving averages, Trend

Markets

Crypto

Timeframes

M15-H1

Risk Notes

  • Signals can change on the live bar or after it closes (repainting)
  • Reads higher-timeframe data with lookahead on, so the history can show signals that were not there in real time
  • The strategy enters trades without a stop loss

Settings

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

SettingTypeDefaultVariable
Start Strattimetimestamp("01 Jan 2021 00:00 +0000")startDate
Enable RIObooltrueenableROI
RIO value %float1.8ROIValue
Enable RIO RSI limitbooltrueenableROIRSILimit
RIO RSI limitint50ROIRSILimit
Enable TimeoutbooltrueenableTimeout
Timeout minutsint300timeoutMinuts
BinHV45 Bollinger Bands lengthint40BinHV45_BB_length
BinHV45 close bbdeltafloat0.031BinHV45_close_bbdelta
BinHV45 closedeltafloat0.018BinHV45_closedelta
BinHV45 tail bbdeltafloat0.223BinHV45_tail_bbdelta
ClucMay72018 Bollinger Bands lengthint20ClucMay72018_BB_length
Show all 14 settings
SettingTypeDefaultVariable
ClucMay72018 closefloat0.993ClucMay72018_close
ClucMay72018 Volume coefint21ClucMay72018_volume_coef
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

106 stars

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

Strategy v4 TrendOscillators & momentum
Updated 2 years ago · GPL-3.0 GitHub repository of 3 x EMA + Stochastic RSI + ATR

Momentum Rider DAILY FINAL

by greenpeas007
58 stars

This strategy combines exponential moving averages (EMA 9, 21, 50), RSI, MACD, and Supertrend indicators to enter long positions. It triggers trades using six dynamic setups based on momentum breakouts, EMA crossovers, and pullbacks. Position sizing is compute

Strategy v6 TrendOscillators & momentum Repaints
Updated 4 months ago · Custom licence GitHub repository of Momentum Rider DAILY FINAL

BB Swing

by benso87
24 stars

This strategy calculates Bollinger Bands, a configurable moving average slope, Stochastic RSI, ATR, and ADX directly on the price chart. It evaluates trend bias and momentum conditions to generate long and short swing entries using percent-of-equity sizing. Th

Strategy v5 Volatility & bandsOscillators & momentum
Updated 4 years ago · MPL-2.0 GitHub repository of BB Swing

This strategy trades long and short on the price chart using a multi-timeframe TradingLatino setup. It requires EMA 10 to cross or sit above or below EMA 55 on the one-hour, four-hour, and daily charts, together with a positive ADX slope, a directional monitor

Strategy v5 TrendMoving averages
Updated 1 year ago · None stated GitHub repository of Ruckard ABCBitcoin TradingLatino A010

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