Recognize daily timeframe inside the code

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #61961 quote
    Asedubelin
    Participant
    Junior

    Dear Sir,

    is it possible inside the code to have a function that understands if the indicator is based on a daily chart or a 1-hour chart ?

    #61967 quote
    Nicolas
    Keymaster
    Master

    Yes, this code snippet will return the minutes quantity of the current timeframe:

    once NbBar = 1
    
    //if BarIndex < NbBar+2 then
    MyDay=openday
    dayminutes = 1440*(MyDay-MyDay[1])
    MyHour=openhour
    hourminutes = 60*(MyHour-MyHour[1])
    MyMin=openminute
    barminutes = MyMin - MyMin[1] + hourminutes + dayminutes
    barminutes=abs(barminutes)
    Mybarminutes = lowest[NbBar](barminutes)[1]
    //endif
    
    return Mybarminutes as "Timeframe"

    I don’t remember who post this snippet initially, but thanks to him.

    #61969 quote
    Asedubelin
    Participant
    Junior

    Thanks

    #62126 quote
    Leo
    Participant
    Veteran

    It was you Nicolas 😉

    here

    INTRADAY DILATATION FACTOR

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

Recognize daily timeframe inside the code


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Asedubelin @asedubelin Participant
Summary

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

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