HIGHEST command for all visible bars

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #105963 quote
    tested4perfection
    Participant
    Average

    Hi,

    I’m hopeful someone can assist me with this task that keeps giving me errors.

    I would like to find the highest value of the CCI[20](close) for all bars that are loaded minus 20 bars – so not to cause problems with the first 20 bars needed for the calculations.

    Some of the code I’ve tried:

    CCIindex = CCI[20](close)
    
    Bars = BarIndex - 20          //(Gives me the max bars minus the first 20 bars to not cause problems)
    
    MaxValue = HIGHEST[Bars](CCIindex)

     

    And this is where it fails. I get error Null.

     

    I’ve even tried a FOR / NEXT loop to count the bars in the loop and then use that number. But still – I can’t get it to work.

    If I manually put in the maximum bars minus 20 in the HIGHEST[Bars] command, then it works.

    What am I doing wrong? This should be a no brainer…

    Many thanks!

    #105969 quote
    Vonasi
    Moderator
    Master

    tested4perfection – welcome to the forums. Please use the ‘Insert PRT Code’ button when posting code in future posts as it makes it far easier for others to read. I have tidied up your post for you. 🙂

    #105971 quote
    Vonasi
    Moderator
    Master
    if barindex >= 20 then
    CCIindex = CCI[20](close) 
    MaxValue = max(Maxvalue, CCIindex)
    endif
    #105977 quote
    GraHal
    Participant
    Master

    Above added to here

    Snippet Link Library

    Looks like others have added 6 to 8 links to the Library since I last entered a link … thank you to those folks! 🙂

    #105981 quote
    Vonasi
    Moderator
    Master

    Looks like others have added 6 to 8 links to the Library since I last entered a link

    I thought that you’d done it but just didn’t tell anybody!

    #106213 quote
    Nicolas
    Keymaster
    Master

    I did, but maybe some others too! 🙂

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

HIGHEST command for all visible bars


ProBuilder: Indicators & Custom Tools

New Reply
Summary

This topic contains 5 replies,
has 4 voices, and was last updated by Nicolas
6 years, 5 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 08/31/2019
Status: Active
Attachments: No files
Logo Logo
Loading...