StefParticipant
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
You can retrieve it easily in Daily timeframe while counting the barindex difference between these 2 dates.
In other timeframes it would be tricky.
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