MEDIA MEDIANA Y MODA PARA PRT

Forums ProRealTime foro Español Soporte ProBuilder MEDIA MEDIANA Y MODA PARA PRT

Viewing 2 posts - 1 through 2 (of 2 total)
  • #183236

    Buenos días,

    He encontrado un indicador de Tradingview que combina la media , mediana y moda, y a mi me ayuda para conocer las simetrias y dismetrias de la cotización.

    Adjunto foto para se vea como es graficamente.

    Alguno sabría convertir el codigo para PRT?

    El código es el siguiente:

    //@version=2
    study(title=’Function Mean Median Mode V0′, overlay=true)

    mean(_src, _length)=>
    _return = sum(_src, _length) / _length

    median(_src, _length)=>
    _return = _src
    for _i = 0 to _length
    _return := _return == 0 ? _src : (_return + _src[_i]) / 2
    _return

    mode_occurance(_value, _src, _length, _discrepancy_range)=>
    _current_value_occurance = 0
    for _i = 0 to _length
    if (_src[_i] >= _value – _discrepancy_range and _src[_i] <= _value + _discrepancy_range)
    _current_value_occurance := _current_value_occurance + 1
    _return = _current_value_occurance

    mode(_src, _length, _discrepancy_range)=>
    _highest_occurence_value = 0
    _highest_occurance_number = 0
    for _i = 0 to _length
    _current_value_occurance = mode_occurance(_src[_i], _src, _length, _discrepancy_range)
    if (_current_value_occurance > _highest_occurance_number)
    _highest_occurance_number := _current_value_occurance
    _highest_occurence_value := _src[_i]
    _return = _highest_occurence_value

    l = input(20)
    r = input(0, type=float)

    plot(series=mean(close, l), title=’Mean’, color=blue)
    plot(series=median(close, l), title=’Median’, color=red)
    plot(series=mode(close, l, r), title=’Mode’, color=black)

     

    Muchas gracias de antemano!

     

    Un saludo.

    #183606

    Hola , alguna sugerencia???

Viewing 2 posts - 1 through 2 (of 2 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login