Convert Pine Script Indicator

MQL4 Indicators Converting

Job finished

Execution time 45 minutes
Feedback from customer
Developer was responsive and compliant to my requests
Feedback from employee
Thank you

Specification

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///////////

Responded

1
Developer 1
Rating
(59)
Projects
67
36%
Arbitration
3
33% / 33%
Overdue
2
3%
Working
2
Developer 2
Rating
(167)
Projects
191
10%
Arbitration
37
38% / 35%
Overdue
5
3%
Working
3
Developer 3
Rating
(252)
Projects
570
36%
Arbitration
64
20% / 58%
Overdue
147
26%
Free
4
Developer 4
Rating
(4)
Projects
4
0%
Arbitration
2
0% / 50%
Overdue
1
25%
Working
5
Developer 5
Rating
(38)
Projects
50
10%
Arbitration
1
0% / 0%
Overdue
8
16%
Free
6
Developer 6
Rating
(126)
Projects
160
36%
Arbitration
4
25% / 50%
Overdue
13
8%
Free
7
Developer 7
Rating
(281)
Projects
421
63%
Arbitration
5
40% / 0%
Overdue
4
1%
Free
8
Developer 8
Rating
(251)
Projects
402
38%
Arbitration
82
41% / 20%
Overdue
70
17%
Loaded
9
Developer 9
Rating
(562)
Projects
929
48%
Arbitration
301
59% / 25%
Overdue
123
13%
Loaded
Similar orders
Hello, I am looking for a coder who could translate or convert an MT4 indicator (.mq4 file, source code available) to TradingView's Pine Script. It should be exactly the same indicator, with the same inputs and other settings. Once you complete the job, you will send me the indicator, with full source code for Pine Script. This work will remain confidential. Aslo need to add some extra features to It like visible
I have mt4 indicator that is working perfectly but I want to convert it into tradingview strategy. Can I get an expert to get this done for me? I want the strategy to work perfectly on Tradingview
Hello I am new to MT4/MT5, I previously traded for a company with their own internal execution platform. I am looking for someone who can help me understand MT5, how to set up charts, indicators, advisors and back-testing etc.. basically a intro to a new user. I am particularly interested in learning is it possible to trade/execute spreads via MT5 - ie simultaneously buy MSFT and sell DELL, and when you trade out you
Am nevoie de o conversie a unui EA din mql4 in mql5. La final sa fie testata, compilata si rezultatul sa nu aiba erori. Modificarea parametrilor sa se faca dint-un fisier cu extensia txt. Am eu modelul Hi. I need a conversion of an EA from mql4 to mql5. At the end, it should be tested, compiled and the result should have no errors. Modifying the parameters should be done from a file with the extension txt. I have the
Hello, I am looking for someone to convert my MQL4 code project to MQL5. A brief description of my current strategy: MT4 'Spreadsheet' EA collects data from 28 FX currency pairs -> sends it to Excel, then Excel calculates and makes a decision -> Excel sends a signal to MT4 'Trading' EA and manages trades I want the MT4 EA to be converted into MT5. For Back testing purposes, I want to withdraw from using Excel and let
I wanted to convert from mt4 to Ctrader Cbot and you want a particular option/feature to work as a bot. A nd can you update this point: the option to check the account name/number on which the CBOT will work, if the wrong account number is given the CBOT should not work
I want to develop a NinjaTrader automated strategy that has a high win rate for trading futures. So the strategy will automatically enter and exit for an account. Do you have any experience with this? If so, can you please share some past results
👋 Hey can you help me to convert mt4 to ctrader cbot? Options Required along with the conversion from given MQL4 source code to Ctrader Cbot just need one option on top of converting mt4 to cbot need an option to run cbot in selected direction with options as Buy/Sell/Buy-and-Sell
I have a strategy on Tradingview but I want to convert it to either ctrader or mt4. I need an expert developer to help me get this done. Let me know if you can do this. Thanks
MetaTrader MT4 to MT5 Conversion I'm on the lookout for a skilled developer proficient in MetaTrader who can assist me in converting my custom indicators and Expert Advisors (EAs) from MT4 to MT5. The primary goal of this project is to ensure that my tools are seamlessly compatible with both platforms. Key Requirements: - Proven experience in MetaTrader programming - A deep understanding of the differences between

Project information

Budget
30 - 100 USD
For the developer
27 - 90 USD
Deadline
to 2 day(s)