Average Body Size of last X Candles

Forums ProRealTime English forum ProBuilder support Average Body Size of last X Candles

Viewing 11 posts - 1 through 11 (of 11 total)
  • #72872

    Hello everyone,

    As far as I understand the average[X] function will take the average of the X last bars, including the current one. So i need to create a simple indicator that will provide the average body size of the last N bars. I created the following code but the result is always 1, any thoughts (“Bars” is an indicator variable, an integer)?

    Thanks

     

    #72876

    You must define “Bars”, otherwise your loop will not start to count.

    How to make loop in ProRealTime is a part of the advanced training program.

    About your indicator, you’ll get the same result with just:

     

     

    #72877

    Try this:

     

     

     

    #72880

    Nicolas – he wants it based on body size not range so he would need:

    But he also does not want to include the current forming bar in the calculation which this would do.

    #72881

    You could also turn the idea into an indicator that shows you when the current bar is larger than the average of the last n bars not including this one and present it as a histogram with red for down bars and green for up bars and bar size based on body size like this:

     

    #72882

    This should do for n bars BEFORE the current one, nevertheless it’ll be displayed under the CURRENT forming bar! (it is shifted)

    1 user thanked author for this post.
    #72884

    Thanks for that Robertogozzi. Sometimes it is difficult to see the really simple answer even when it is staring you in the face!

    That would also mean that my histogram indicator becomes this and has the benefit of drawing much faster:

     

    #72889

    In fact I think that it is better to display it as a percentage of the last n bars average range as it is more bounded.

    Here’s the adapted code:

     

    #72899

    Thank you all,

    you are right, the answer was simple than i thought!

    #72968

    Since you posted this question I have been playing around with looking for candles that have a larger range than n candles before and larger body size than n candles before as interesting times to be in the market (good volatility) and so I came up with this indicator that counts back to see how long it is since a candle with the current range and size of body was last seen.

    I thought that I would post it here in case it is of any interest to anybody.

    You can set the minimum period that you wish the count back to start from and also the maximum period to count back.

    The result is returned in a histogram with down red candles if the close was lower than the open and green up candles if it was higher than the open. Hover over the candle and the size represents the number of candles since one with a body size and range bigger was last seen.

     

     

    2 users thanked author for this post.
    #72970

    Another alternative is to look for the smallest body size and range in n bars. This is a good way to see if a market is running out of momentum and maybe a turning point.

    Here is the code showing how long it is since a candle this small was last seen:

     

     

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

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