count of bars since lowest low of past 10 bars

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #40353 quote
    Seb
    Participant
    Average

    Hello Everyone,

    I am able to return the lowest low of the previous 10 bars with the code “lowest[10](low)”. What I would like to do is count the number of bars since that low. Anybody an idea?

    #40375 quote
    robertogozzi
    Moderator
    Master

    I did not test it, but it should do:

    LowestPrice = lowest[10](low)     //save the lowest price returned
    LowBar      = 0
    for i = 1 to 10                   //scan the previous 10 bars
    if low[i] = LowestPrice then
    LowBar = i                        //when the match is found save te number of the bar
    endif
    next
    //from now on you know LowBar IS the bar within the 10 previous ones with the lowst price
    //            (unless more than one shares the same lowest price!!!)
    
    PriceRange = range[LowBar]       //you can, just as an example, access the RANGE of the bar with the lowest low....
    

    Let me know if you are having problems with that piece of code.

    Roberto

    Seb and Nicolas thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

count of bars since lowest low of past 10 bars


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Seb @seb Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
8 years, 7 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 07/11/2017
Status: Active
Attachments: No files
Logo Logo
Loading...