MEDIA MEDIANA Y MODA PARA PRT

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #183236 quote
    realizedtraderealizedtrade
    Participant
    New

    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.

    mode.png mode.png
    #183606 quote
    realizedtraderealizedtrade
    Participant
    New

    Hola , alguna sugerencia???

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

MEDIA MEDIANA Y MODA PARA PRT


ProBuilder: Indicadores y Herramientas

New Reply
Author
Summary

This topic contains 1 reply,
has 1 voice, and was last updated by realizedtraderealizedtrade
4 years, 9 months ago.

Topic Details
Forum: ProBuilder: Indicadores y Herramientas
Language: Spanish
Started: 12/13/2021
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...