Strategy CCT Bollinger Band Oscillator

1500 12 150
This strategy buy when ema crossover CCT             BB oscillator and sell when crossunder. No SL neither TP only trailling stop at 1$. CCT             BB oscillator is LaztBear indicator. Thanks to him.
Remove from Favorite Scripts Add to Favorite Scripts
strategy(title="Strategy CCT Bollinger Band Oscillator", shorttitle="Hornkild", calc_on_order_fills=true, default_qty_type=strategy.percent_of_equity, default_qty_value=50, overlay=false)

cctbbo=100 * ( src + 2*stdev( src, length) - sma( src, length ) ) / ( 4 * stdev( src, length ) )

//ul=hline(100, color=gray, editable=true)
//ll=hline(0, color=gray)
//hline(50, color=gray)
//fill(ul,ll, color=blue)
//plot(cctbbo, color=blue, linewidth=2)
//plot(ema(cctbbo, lengthMA), color=red)

TP = input(0) * 10
SL = input(0) * 10
TS = input(1) * 10
TO = input(10) * 10
CQ = 100

TPP = (TP > 0) ? TP : na
SLP = (SL > 0) ? SL : na
TSP = (TS > 0) ? TS : na
TOP = (TO > 0) ? TO : na

longCondition = crossover(cctbbo, ema(cctbbo, lengthMA))
if (longCondition)
    strategy.entry("Long", strategy.long)

shortCondition = crossunder(cctbbo, ema(cctbbo, lengthMA))
if (shortCondition)
    strategy.entry("Short", strategy.short)

strategy.exit("Close Short", "Short", qty_percent=CQ, profit=TPP, loss=SLP, trail_points=TSP, trail_offset=TOP)
strategy.exit("Close Long", "Long", qty_percent=CQ, profit=TPP, loss=SLP, trail_points=TSP, trail_offset=TOP)
calc_on_order_fills=true - repaint :(
nice thx for share!
A question what is this "TO" ? in the settings
thx and greetings
Fadior AcerGold
Hi, TO is the trailing stop price (specified in ticks). From the documentation : "The offset in ticks to determine initial price of the trailing stop order: X ticks lower than 'trail_price' or 'trail_points' to exit long position; X ticks higher than 'trail_price' or 'trail_points' to exit short position. The default value is 'NaN'. "
+1 Reply
AcerGold Fadior
oh and i think "TS" was trailling stop, what is then "TS"? thx
Fadior AcerGold
TS is used to fire trailing stop order.
+1 Reply
sttdev = 20
ema = 2
TS= 1.3%

Some remarks about this strategy :

- backtest doen't recalculate on every tick so historical performance for intrabar trades are biased
- if you want to try use daily candle -> midnight signal
- it is best to have trailing stop in ercent of the current price : 1.3% correspond to ~ 5$

offset = input(0.013, type=float, step=0.01)
TO = close*Offset*100 // 5-digits
TO = close*Offset // 2-digits
Thanks for the share. There is an option in the back test settings to recalculate on every tick, and recalculate after close. Not sure if it'll help you, but worth checking out.
Fadior CryptoRox
Hi, unforunnatly it is said in the documentation the parameter does not affect strategy calculation on historical data.
Too bad. That'd explain why I've never been able to figure it out. haha. Thanks for letting me know.
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out