Indicator on the last 100 bars ?

Forums ProRealTime English forum ProBuilder support Indicator on the last 100 bars ?

Viewing 8 posts - 1 through 8 (of 8 total)
  • #189690

    hi all,

    I want to know how to make an indicator but only on the 100 last bar ?

    this can working ?

    Best Reguards

    #189691
    #189693

    JC_Bywan

    tks you to your quick answer, so if I use the DEFPARAM CalculateOnLastBars for for exemple 20 bars, and I use For boucle from 0 to 100 bars, my For boucle can’t go more then 0 to 10 ?

    I hope my question is clear

    Best Reguards

    #189694

    On the description it said only on the indicators but is it valid for the screener ?

    #189695

    The question is clear only if you meant to write defparam calculateonlastbars=10 (instead of 20)

    And no, in this case x still goes from 0 to 100 in its “for to next” loop, because it could be used for something else than condition[x] not related to a bar number… but the whole indicator including the loop is calculated only for the last 10 bars.

    Then, if left to run live over more candles, values from “return” line are still only for last 10 bars, and graphic objects history (drawtext, drawsegment etc…) remain on all bars since launch.

    You can try all sorts of mini-codes in a fast timeframe to experiment with it and grasp what it does. For exemple, you can use this in a 10s timeframe to quickly illustrate above lines:

     

    1 user thanked author for this post.
    #189707

    Actually, I think I just got what you meant with keeping =20… but the answer is the same: x still goes from 0 to 100 with the loop, because using it in a later line to recall a barindex won’t make this for/next loop stop. Your condition x bars ago at code launch is 0 when that’s more than 20 bars ago, and the calculated value it’s supposed to have if less than 20 bars ago, hence your split in 10 and 10 question I guess… but loop keeps going after 10 until 100. And if your code keeps running for more candles than candle launch, then conditions history gets populated candle by candle, and at some point you’ll have all 100 available.

    The limit is: at launch, and after launch for values in “return” line as it keeps going. The rest (graphic objects, data history) is not deleted as it keeps going and more and more of it is available, unless relaunching the indicator therefore creating a new start point.

    1 user thanked author for this post.
    #189732

    tks a lot for all your answer, I will try the mini programme and I think yes it’s the best way to learn,

    I ask the question by any chance you never know, is there a page or a link with lots of mini program like that to test I think it is a very very good way to learn

    #189745

    Hi, probably not, I just make one up whenever I want to check something

    1 user thanked author for this post.
Viewing 8 posts - 1 through 8 (of 8 total)

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