Where is closetime?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #220251 quote
    LucasBest
    Participant
    Average

    Opentime give the Opening time of the current bar, but is there any instruction for getting the close time of the current bar (for MTF purpose)

    #220258 quote
    JS
    Participant
    Senior

    Hi,

    OpenTime=Open Time of the current bar

    Time=Close Time of the current bar

    #220260 quote
    LucasBest
    Participant
    Average

    Yes, but there is a problem…

    timeframe(1 hour, updateonclose)
    $candleDate[barindex]=date
    $candleCloseTime[barindex]=time
    $close[barindex]=close
    
    //timeframe(1 hour, default)
    //save the candlestick date, open and close time in variable arrays
    //$candleDate[barindex]=date
    //$candleOpenTime[barindex]=OpenTime
    //$open[barindex]=open
    
    timeframe(default)
    //get the 10th back 1-hour candlestick info
    iindex = max(0,lastset($candleDate)-0)
    idate = $candleDate[iindex]
    iopen = $candleOpenTime[iindex]
    iclose = $candleCloseTime[iindex]
    iopenb = $open[iindex]
    icloseb = $close[iindex]
    
    //Drawrectangle(DateToBarindex(idate*1000000+iopen),iopenb,DateToBarindex(idate*1000000+iclose),icloseb)
    
    return iclose

    If i want the accurate open time, it have to use default and not updateonclose. Otherwise i will get the new hour time at 21h45 (supposing default timeframe is 15 min) and not at 22h

    For th close of the hour, i can get it only at 21h45 (not at 21h or 21h15 or 21h30) even with updateonclose

    So i guess i need to do some math with hours to gt close time of the higher timeframe ? and also the barindex of the new or previous hour open ?

    Thanks

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

Where is closetime?


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
LucasBest @lucasbest Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by LucasBest
2 years, 5 months ago.

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