Attachments forums

List of attachments posted on this forum.


All files on forums: 136890

Re: Already Converted TradingView Indicators to MT4 Indicators

ionone, Wed Aug 31, 2022 6:18 pm

these arrows look good. (the best i've seen in a while) I made the code so it becomes a strategy (just copy the code into TV pine code panel and save it and add it to chart)

If you guys find a good set file then I'll convert it to MT4

thanks

Jeff

Code: Select all

//@version=5
//
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © apaulcalypse


//indicator('BBWP Boom & Doom', 'Boom & Doom', overlay=true, precision=2, max_bars_back = 1000)
//@version=5
strategy("boom doom Strategy", overlay = true, default_qty_value = 100, default_qty_type = strategy.percent_of_equity, initial_capital = 1000000)



///////////////////////////////////////////////////////////////////////////////
// BBWP formula by The_Caretaker


///////////////////////////////////////////////////////////////////////////////
// inputs

volume_ma_input = input.int(14, title="Volume Moving Average", group="Boom & Doom Settings")
bbwp_minimum = input.float(20, title="BBWP Crossunder Point", step=0.1, group="Boom & Doom Settings")
bbwp_middle = input.float(50, title="BBWP Reset Point", step=0.1, group="Boom & Doom Settings")
emafilter = input.bool(false, title="Filter over/under EMA", group="Boom & Doom Settings")
emalength = input.int(200, title="EMA Length", group="Boom & Doom Settings")

// BBWP formula is by The_Caretaker
// BBWP Inputs
i_priceSrc      = input.source  ( close,    'Price Source',                                                                         group='BBWP Properties')
i_basisType     = input.string  ( 'SMA',    'Basis Type',                       options=['SMA', 'EMA', 'VWMA'],                     group='BBWP Properties')
i_bbwpLen       = input.int     ( 13,       'Length',                           minval=1,                                           group='BBWP Properties')
i_bbwpLkbk      = input.int     ( 252,      'Lookback',                         minval=1,                                           group='BBWP Properties')

///////////////////////////////////////////////////////////////////////////////
// function declarations

f_maType ( _price, _len, _type ) =>
    _type == 'SMA' ? ta.sma ( _price, _len ) : _type == 'EMA' ? ta.ema ( _price, _len ) : ta.vwma ( _price, _len )

f_bbwp ( _price, _bbwLen, _bbwpLen, _type ) =>
    float _basis = f_maType ( _price, _bbwLen, _type )
    float _dev = ta.stdev ( _price, _bbwLen )
    _bbw = ( _basis + _dev - ( _basis - _dev )) / _basis
    _bbwSum = 0.0
    _len = bar_index < _bbwpLen ? bar_index : _bbwpLen
    for _i = 1 to _len by 1
        _bbwSum += ( _bbw[_i] > _bbw ? 0 : 1 )
        _bbwSum
    _return = bar_index >= _bbwLen ? ( _bbwSum / _len) * 100 : na
    _return

f_clrSlct ( _percent, _select, _type, _solid, _array1, _array2 ) =>
    _select == 'Solid' ? _solid : array.get ( _type == 'Blue Green Red' ? _array1 : _array2, math.round ( _percent ) )

/////////////////////////////////////////////////////////////////////////////// 
// calculations

bbwp        = f_bbwp ( i_priceSrc, i_bbwpLen, i_bbwpLkbk, i_basisType )

// END BBWP
/////////////////////////////////////////////////////////////////////////////// 



// use Heikin Ashi candle data to catch momentum
openHA = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, open)
closeHA = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close)
highHA = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, high)
lowHA = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, low)



volume_ma = ta.sma(volume, volume_ma_input)

var bbwp_lower_bound = false
var bbwp_reset = false

if ta.crossunder(bbwp, bbwp_middle)
    bbwp_reset := true

if ta.crossunder(bbwp, bbwp_minimum)
    bbwp_lower_bound := true


shadowless_rise = (openHA <= lowHA)  ? 1 : 0
shadowless_fall = (openHA >= highHA)  ? 1 : 0


boom = bbwp_lower_bound and bbwp_reset and shadowless_rise and volume > volume_ma and bbwp < 50 and bbwp > 15 ? 1 : 0
doom = bbwp_lower_bound and bbwp_reset and shadowless_fall and volume > volume_ma and bbwp < 50 and bbwp > 15 ? 1 : 0


emaline = ta.ema(close, emalength)

if emafilter and close < emaline
    boom := 0

if emafilter and close > emaline
    doom := 0



if boom or doom
    bbwp_lower_bound := false
    bbwp_reset := false
    
if ta.crossover(bbwp, 50) and bbwp_lower_bound == true
    bbwp_lower_bound := false
    


plotshape(boom ? boom : na, title='Lambo', text='Boom!', location=location.belowbar, style=shape.labelup, size=size.normal, color=color.green, textcolor=color.new(color.white, 0))
plotshape(doom ? doom : na, title='Rambo', text='Doom!', location=location.abovebar, style=shape.labeldown, size=size.normal, color=color.red, textcolor=color.new(color.white, 0))


alertcondition(boom, "Boom!", "Bullish Boom Signal")
alertcondition(doom, "Doom!", "Bearish Doom Signal")

if (boom)
	strategy.entry("Buy", strategy.long, comment="buy")
if (doom)
	strategy.entry("Sell", strategy.short, comment="sell")

// End Devastation
All files in topic