Convert Pine Script Indicator

MQL4 Indicadores Conversão

Trabalho concluído

Tempo de execução 45 minutos
Comentário do cliente
Developer was responsive and compliant to my requests
Comentário do desenvolvedor
Thank you

Termos de Referência

I need to convert a pine script indicator to MQL4. The name of the pine script indicator is BBWP (Bollinger Band Width Percentage)

The pine script is between the comments below

/////Start of Pine Script////////////

//
// @version=5
//
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// @author  = The_Caretaker
// © The_Caretaker
//
// Much respect to John A Bollinger the creator of Bollinger Bands® and Bollinger Band Width indicators.
//
// Feel free to reuse or develop this script further, please drop me a note below if you find it useful.
//

indicator ( 'Bollinger Band Width Percentile', 'BBWP', overlay = false, format = format.percent, precision = 2, max_bars_back = 1000 )

///////////////////////////////////////////////////////////////////////////////
// Variable declarations

var string s_HMMML = 'High - Mid Hi - Mid - Mid Low - Low'
var string s_HML   = 'High - Mid - Low'
var string s_HL    = 'High - Low'

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

i_priceSrc      = input.source  ( close,        'Price Source',                                                                                               group = 'BBWP Properties')
i_basisType     = input.string  ( 'SMA',        'Basis Type',                       options=[ 'SMA', 'EMA', 'WMA', 'RMA', 'HMA', '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')

i_c_typ_line    = input.string  ( 'Spectrum',   'Color Type',                       options=[ 'Spectrum', 'Solid' ],                          inline = '1',   group = 'Line Plot Settings')
i_c_so_line     = input.color   ( #FFFF00,    'Solid Color',                                                                                inline = '1',   group = 'Line Plot Settings')
i_c_typ_sp_line = input.string  ( s_HMMML,      'Spectrum',                         options=[ s_HL, s_HML, s_HMMML ],                         inline = '2',   group = 'Line Plot Settings')
i_c_sp_hi_line  = input.color   ( #FF0000,    'High',                                                                                       inline = '3',   group = 'Line Plot Settings')
i_c_sp_mhi_line = input.color   ( #ffff00,    'Mid Hi',                                                                                     inline = '3',   group = 'Line Plot Settings')
i_c_sp_mid_line = input.color   ( #00FF00,    'Mid',                                                                                        inline = '3',   group = 'Line Plot Settings')
i_c_sp_mlo_line = input.color   ( #00ffff,    'Mid Lo',                                                                                     inline = '3',   group = 'Line Plot Settings')
i_c_sp_lo_line  = input.color   ( #0000FF,    'Low',                                                                                        inline = '3',   group = 'Line Plot Settings')
i_p_width_line  = input.int     ( 2,            'Line Width',                       minval=1, maxval=4,                                       inline = '4',   group = 'Line Plot Settings')

i_ma1On         = input.bool    ( true,         '',                                                                                           inline = '1',   group = 'Moving Average Settings')
i_ma1Type       = input.string  ( 'SMA',        'MA 1 Type',                        options=[ 'SMA', 'EMA', 'WMA', 'RMA', 'HMA' ],            inline = '1',   group = 'Moving Average Settings')
i_c_ma1         = input.color   ( #FFFFFF,    '',                                                                                           inline = '1',   group = 'Moving Average Settings')
i_ma1Len        = input.int     ( 5,            'Length',                           minval=1,                                                 inline = '1',   group = 'Moving Average Settings')
i_ma2On         = input.bool    ( false,        '',                                                                                           inline = '2',   group = 'Moving Average Settings')
i_ma2Type       = input.string  ( 'SMA',        'MA 2 Type',                        options=[ 'SMA', 'EMA', 'WMA', 'RMA', 'HMA' ],            inline = '2',   group = 'Moving Average Settings')
i_c_ma2         = input.color   ( #00FFFF,    '',                                                                                           inline = '2',   group = 'Moving Average Settings')
i_ma2Len        = input.int     ( 8,            'Length',                           minval=1,                                                 inline = '2',   group = 'Moving Average Settings')

i_alrtsOn       = input.bool    ( true,         'Alerts On',                                                                                                  group = 'Visual Alerts')
i_upperLevel    = input.int     ( 98,           'Extreme High',                     minval=1, inline='1',                                                     group = 'Visual Alerts')
i_lowerLevel    = input.int     ( 2,            'Extreme Low',                      minval=1, inline='1',                                                     group = 'Visual Alerts')

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

f_maType ( _price, _len, _type ) =>
    switch _type
        "SMA" => ta.sma ( _price, _len )
        "EMA" => ta.ema ( _price, _len )
        "WMA" => ta.wma ( _price, _len )
        "RMA" => ta.rma ( _price, _len )
        "HMA" => ta.hma ( _price, _len )
        => ta.vwma ( _price, _len )

     // Returns moving average determined by _type      

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

     // Returns Bollinger Band Width Percentile

f_5Col ( _val, _lowV, _lmV, _midV, _hmV, _hiV, _lowC, _lmC, _midC, _mhC, _hiC ) =>
    _val <= _lmV ? color.from_gradient ( _val, _lowV, _lmV, _lowC, _lmC ) : _val <= _midV ? color.from_gradient ( _val, _lmV, _midV, _lmC, _midC ) : _val <= _hmV ? color.from_gradient ( _val, _midV, _hmV, _midC, _mhC ) : color.from_gradient ( _val, _hmV, _hiV, _mhC, _hiC )

     // Returns a quatruple spectrum color determined by _val from high to mid high to mid to mid low to low

f_3Col ( _val, _lowV, _midV, _hiV, _lowC, _midC, _hiC ) =>
    _val <= _midV ? color.from_gradient ( _val, _lowV, _midV, _lowC, _midC) : color.from_gradient ( _val, _midV, _hiV, _midC, _hiC)

     // Returns a double spectrum color determined by _val from high to mid to low

f_clrSlct ( _val, _type, _solid, _grad, _lowV, _lmV, _midV, _hmV, _hiV, _lowC, _lmC, _midC, _mhC, _hiC ) =>
    _type == 'Solid' ? _solid : _grad == s_HL ? color.from_gradient ( _val, _lowV, _hiV, _lowC, _hiC) : _grad == s_HML ? f_3Col ( _val, _lowV, _midV, _hiV, _lowC, _midC, _hiC ) : f_5Col ( _val, _lowV, _lmV, _midV, _hmV, _hiV, _lowC, _lmC, _midC, _mhC, _hiC )

     // Returns a color determined by _val from user settings of solid, or spectrum from high to low, or double spectrum from high to mid to low, or quatruple spectrum from high to mid high to mid to mid low to low

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

bbwp        = f_bbwp ( i_priceSrc, i_bbwpLen, i_bbwpLkbk, i_basisType )
c_bbwp      = f_clrSlct ( bbwp, i_c_typ_line, i_c_so_line, i_c_typ_sp_line, 0, 25, 50, 75, 100, i_c_sp_lo_line, i_c_sp_mlo_line, i_c_sp_mid_line, i_c_sp_mhi_line, i_c_sp_hi_line )
bbwpMA1     = i_ma1On ? f_maType ( bbwp, i_ma1Len, i_ma1Type ) : na
bbwpMA2     = i_ma2On ? f_maType ( bbwp, i_ma2Len, i_ma2Type ) : na
hiAlrtBar   = i_alrtsOn and bbwp >= i_upperLevel ? bbwp : na
loAlrtBar   = i_alrtsOn and bbwp <= i_lowerLevel ? bbwp : na

///////////////////////////////////////////////////////////////////////////////
// plots

p_scaleHi   = hline ( 100,  'Scale High',#ff0000, hline.style_solid )
p_midLine   = hline ( 50,   'Mid-Line',  #a6a6a6, hline.style_dashed )
p_scaleLo   = hline ( 0,    'Scale Low', #0000ff, hline.style_solid )

p_bbwp      = plot ( bbwp,      'BBWP',         c_bbwp, i_p_width_line, plot.style_line, editable=false )
p_hiAlrt    = plot ( hiAlrtBar, 'Extreme Hi',   c_bbwp, 1, plot.style_columns, histbase=0, editable=false )
p_loAlrt    = plot ( loAlrtBar, 'Extreme Lo',   c_bbwp, 1, plot.style_columns, histbase=100, editable=false )
p_ma1       = plot ( bbwpMA1,   'MA 1',         i_c_ma1, 1, plot.style_line, 0 )
p_ma2       = plot ( bbwpMA2,   'MA 2',         i_c_ma2, 1, plot.style_line, 0 )

/////////////////////////////
// end


//////End of Pine Script///////////

Respondido

1
Desenvolvedor 1
Classificação
(76)
Projetos
93
42%
Arbitragem
4
50% / 50%
Expirado
2
2%
Livre
2
Desenvolvedor 2
Classificação
(170)
Projetos
193
11%
Arbitragem
37
38% / 35%
Expirado
5
3%
Carregado
3
Desenvolvedor 3
Classificação
(254)
Projetos
573
36%
Arbitragem
64
20% / 58%
Expirado
147
26%
Livre
4
Desenvolvedor 4
Classificação
(4)
Projetos
4
0%
Arbitragem
2
0% / 100%
Expirado
1
25%
Livre
5
Desenvolvedor 5
Classificação
(38)
Projetos
50
10%
Arbitragem
1
0% / 0%
Expirado
8
16%
Livre
6
Desenvolvedor 6
Classificação
(128)
Projetos
162
36%
Arbitragem
4
25% / 50%
Expirado
13
8%
Livre
7
Desenvolvedor 7
Classificação
(298)
Projetos
443
64%
Arbitragem
5
40% / 0%
Expirado
4
1%
Trabalhando
8
Desenvolvedor 8
Classificação
(256)
Projetos
415
38%
Arbitragem
86
44% / 19%
Expirado
70
17%
Ocupado
9
Desenvolvedor 9
Classificação
(563)
Projetos
932
47%
Arbitragem
302
59% / 25%
Expirado
124
13%
Carregado
Pedidos semelhantes
Connect from Mt5 via binary deriv account api I have mt5 indicator, need to connect with binary deriv account through api. If anyone can setup via API then contact me. everything control mt5
Hello I am looking for a developer to create an 50% retracement Indicator of the previous candle . So once a candle close the Indicator is supposed to take the full candle size from high to low and make a 61% and 50% level on that candle and I would like the candle to show until the next previous candle is done creating. After this I would look to create an ea with it possibly
Hi, I have 2 indicators which are based on the super trend , the alerts on indicator (1) does not work at all , and on the other indicator the alerts do not come on time on time, which is kind of delayed. see attached file below
Looking for an experienced developer to modify my existing TDI strategy , want to add filter for Buy and Sell Signals, Arrows are displayed on chart and what only to leave high accurate arrows Source code to be provided
I have the mq5 file, I need a buffer adding to the indicator, so it appears in the data window so I can reference it later in an EA. As the below screenshot shows, there is a median ray line from yesterday (the dashed horizontal line) - I want this value in the data window called Median Ray. I want this to be a single value per day, so todays Median Ray would be 17868, and so on each day. So I want all the Developing
I would like to develop my own indicator on metatrader 4 and tradingview. We would start with a basic version that we would improve later. It is an indicator based on several analyses and which would provide several indications. I am looking for someone who can develop on MT4 and Mt5, initially I would like to do it on mt4 and then on mt5. If you have expertise in pinescript it is a plus because I would like to
I urgently require swift assistance to convert a complex indicator into a fully functional scanner, capable of automatically sending real-time data, alerts, and notifications via email, ensuring seamless integration and prompt delivery of critical information to facilitate informed decision-making and timely action
I need to improve the code of an indicator that is too heavy and slow when running and when used with iCustom in an EA. No other changes to the indicator are requested: the original features of the indicator should remain as theay are. I'll provide the indicator after job acceptance. I request final source code mq5 file. Thank you Regards
I have a mt5 indicator that is working perfectly but I will like to make it an expert advisor to have an automated trade. I will be glad if I can get a well experienced developer to execute this project. Thanks
O TRABALHO CONSISTE NA MUDANÇA DO HISTOGRAMA DO INDICADOR TREDN DIRECTION AND FORCE DSEMA SMOOTHED PARA O HISTOGRAMA DA FOTO ANEXA, OBEDECENDO AS TRES CORES VERDE (UP, VERMELHOR(DOWN) E CINZA(TREND). O MESMO TEM QUE ODECER O MESMO CALCULO E COLORIR DA MESMA FORMA POREM COM HISTOGRAMA DDE FORMATO DIFERENTE

Informações sobre o projeto

Orçamento
30 - 100 USD
Desenvolvedor
27 - 90 USD
Prazo
para 2 dias