Fadior

Strategy CCT Bollinger Band Oscillator

957 11 77
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
//@version=2
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)

length=input(65)
lengthMA=input(30)
src=close
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)
Fadior
a year ago
Works very good in daily.
Reply
al.tribun Fadior
a year ago
It uses only daily close price for backtesting.
Try lower timeframe and adjust settings.
The lengthMA=input(30) for daily chart, will be 30*24=720 for H1 chart.
It will allow you to backtest strategy using hourly close (not only daily).
Reply
Fadior
a year ago
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
Reply
CryptoRox PRO Fadior
a year ago
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.
Reply
Fadior CryptoRox
a year ago
Hi, unforunnatly it is said in the documentation the parameter does not affect strategy calculation on historical data.
Reply
CryptoRox PRO Fadior
a year ago
Too bad. That'd explain why I've never been able to figure it out. haha. Thanks for letting me know.
Reply
Fadior
a year ago
sttdev = 20
ema = 2
TS= 1.3%

snapshot
Reply
AcerGold
a year ago
nice thx for share!
A question what is this "TO" ? in the settings
thx and greetings
Reply
Fadior AcerGold
a year ago
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
a year ago
oh and i think "TS" was trailling stop, what is then "TS"? thx
Reply
Fadior AcerGold
a year ago
TS is used to fire trailing stop order.
+1 Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out