Number of days between two dates

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #13452 quote
    Stef
    Participant
    Average

    Hi All,

    What is the easiest way to calculate the number of days between two dates in ProBuilder?

    If I have:

    startdate=01012008
    curbardate=date
    

    How do I calculate the number of days between date and startdate?

    Regards

    #13454 quote
    Nicolas
    Keymaster
    Master

    You can retrieve it easily in Daily timeframe while counting the barindex difference between these 2 dates.

    In other timeframes it would be tricky.

    #13469 quote
    Stef
    Participant
    Average

    Tx. Let me try that.

    #13521 quote
    Stef
    Participant
    Average

    Should have been:

    startdate=20080101
    #161330 quote
    Vincent 3555
    Participant
    Junior

    In other than daily time frame, I use the fonction ” DAYS ” which return the number of days from 01/01/1900.

    If you use the DATE fonction it is difficult to extract the difference .

    Please find an example below

    Indicator1 = Average  [20] (close)   // SMA of close
    
    if Close Crosses Over Indicator1 then  // Close Crosses SMA
    FirstDateSignal =  Days                // First signal
    endif
    
    If Close  Crosses Under Indicator1  then   // close Crosses under
    SecondDateSignal = Days                //   Second Signal
    Endif
    
    Difference =  SecondDateSignal -  FirstDateSignal   // the difference in REAL days, not traded days
    
    Return Difference
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Number of days between two dates


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Stef @stef Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by Vincent 3555
4 years, 12 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 09/21/2016
Status: Active
Attachments: No files
Logo Logo
Loading...