Mega Crypto Bot Strategy
Mega Crypto Bot Strategy
//--------------------Trend colour
ema------------------------------------------------//
src0 = close
len0 = input.int(13, minval=1, title='EMA 1')
ema0 = ta.ema(src0, len0)
falling_1 = ta.falling(ema0, 2)
direction = ta.rising(ema0, 2) ? +1 : falling_1 ? -1 : 0
plot_color = direction > 0 ? color.lime : direction < 0 ? color.red : na
plot(ema0, title='EMA', style=plot.style_line, linewidth=1, color=plot_color)
//=============Hull MA//
show_hma = input(false, title='Display Hull MA Set:')
hma_src = input(close, title='Hull MA\'s Source:')
hma_base_length = input.int(8, minval=1, title='Hull MA\'s Base Length:')
hma_length_scalar = input.int(5, minval=0, title='Hull MA\'s Length Scalar:')
hullma(src, length) =>
ta.wma(2 * ta.wma(src, length / 2) - ta.wma(src, length),
math.round(math.sqrt(length)))
hullma__1 = hullma(hma_src, hma_base_length + hma_length_scalar * 6)
plot(not show_hma ? na : hullma__1, color=color.new(color.black, 0), linewidth=2,
title='Hull MA')
//============ signal Generator ==================================//
period = input('720')
ch1 = request.security(syminfo.tickerid, period, open)
ch2 = request.security(syminfo.tickerid, period, close)
longCondition = ta.crossover(request.security(syminfo.tickerid, period, close),
request.security(syminfo.tickerid, period, open))
if longCondition
strategy.entry('BUY', strategy.long)
shortCondition = ta.crossunder(request.security(syminfo.tickerid, period, close),
request.security(syminfo.tickerid, period, open))
if shortCondition
strategy.entry('SELL', strategy.short)
///////////////////////////////////////////////////////////////////////////////////
////////