Total number of bars

Forums ProRealTime English forum ProBuilder support Total number of bars

Viewing 4 posts - 1 through 4 (of 4 total)
  • #67049

    Hi guys,

    I made an indicator with Centered Mobile Averages and to translate the data I have to know how many bars are on the graph, and I use:

    return barindex

    just know the exact number (it changes on different graphs)

    Is there anyway to solve this?

    Thanks

    #67154

    >> Please update your country flag in your profile. Thank you 🙂 <<

    BARINDEX will always return the bars quantity of the opened chart. So sorry if I don’t understand but what do you want to do exactly please? Because if you use BARINDEX as your period for your moving average, it will instantly calculate the good mean for all the data displayed on your chart.

    #67159

    Usually i read the number of total bars and then write it on my indicator as a parameter (see image).

    If I use barindex as a variable inside the code it doesn’t work because it has a different number for every bar, but I want just the last one.

     

    #67197

    To know if you are on the last bar of the chart, you can use the code snippet below:

    But because the history is only read once, in your case, you will not be able to use it as a period for your indicator automatically. Another way would be to make loop in the past starting only on the current bar and with the last barindex as the period.. But still, ProBuilder doesn’t allow to plot curves in the past..

    2 users thanked author for this post.
Viewing 4 posts - 1 through 4 (of 4 total)

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