Daily data for intraday

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #59391 quote
    Leo
    Participant
    Veteran

    Hi all,

    I am having a problem in a code.

    I would like to shown certain values of daily timeframe  in a short time frame.

    The variable as input is DAYS

    Here the code, it produce an error of an infinite loop which I don’t get why.

    //DAILY VALUES FOR INTRADAY
    //Author: LEO
    
    //Variable as input: DAYS
    
    once DayAverage=Dclose(1)
    once DAYCLOSE=Dclose(1)
    once TYPICALDAY=Dclose(1)
    once DAYHIGHER=Dhigh(1)
    once DAYLOWER=Dlow(1)
    
    IF INTRADAYBARINDEX=2 THEN
    DayAverage=0
    FOR i=1 to DAYS DO
    DayAverage=DCLOSE(i)+DayAverage
    NEXT
    DayAverage=DayAverage/DAYS
    DAYHIGHER=highest[DAYS](Dhigh(1))
    DAYLOWER=lowest[DAYS](Dlow(1))
    DAYCLOSE=Dclose(1)
    TYPICALDAY=(DHIGH(1)+DLOW(1)+DCLOSE(1))/3
    ENDIF
    
    return DayAverage as "Day Close Average", DAYCLOSE as "Yesterday Close", TYPICALDAY as "YesterdTypical Price", DAYHIGHER as "Minimum day", DAYLOWER as "Maximum Day"
    
    #59395 quote
    Vonasi
    Moderator
    Master

    At a guess I would say that it is because DAYS is a potentially ever moving variable so in the middle of the loop it could add another day on before it is finished the loop and so the possibility is that the loop could never end. Plus DAYS is the total number of days since 1900 and so you will never reach the end of the loop because you won’t have enough bars on a chart to test that.

    Leo thanked this post
    #59404 quote
    Leo
    Participant
    Veteran

    Wow! “days” is function in ProRealTime. in my computer Mac it always appear in color black like just a variable .

     

    Now it works. I will posted in the library then

    #59407 quote
    Vonasi
    Moderator
    Master

    Wow! “days” is function in ProRealTime. in my computer Mac it always appear in color black like just a variable .

    I did think it was strange that you were trying to use it! You should report the colour issue on Mac’s to PRT so they might fix it to avoid future confusion for others.

    #59451 quote
    Leo
    Participant
    Veteran

    I will thanks

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

Daily data for intraday


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Leo @leito Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by Leo
8 years ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 01/13/2018
Status: Active
Attachments: No files
Logo Logo
Loading...