help with gettimeframe and timeframe

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #184786 quote
    pableitorpableitor
    Participant
    Master

    I am trying to code an indicator that returns the close of the higher timeframe, that is, if the chart is TF 1 minute it returns the close of TF 5min, if chart is in  TF 5 minutes it returns the close of TF 15min etc.

    a = gettimeframe / 60
    
    timeframe(5minutes,updateonclose)
    close5 = close
    timeframe(15minutes,updateonclose)
    close15 = close
    timeframe(default, updateonclose)
    
    if a = 1 then //if  chart TF = 1 minute 
    c = close5 //c = close of 5 minutes TF
    elsif a = 5 then //if  chart TF = 5 minute
    c = close15 //c = close from 15 minutes TF
    endif
    
    return c
    This code seems ok to me but it doesnt work,  it just returns zero ! Any advise would be appreciated , thanks
    Screenshot_1-1.png Screenshot_1-1.png
    #184814 quote
    JSJS
    Participant
    Master
    I tried the following: timeframe(default) c = GetTimeFrame but whatever timeframe you use the result for c is always -1 According to the documentation, “GetTimeFrame” only applies to “linear time units” but I don’t understand what is meant by that.
    #184819 quote
    pableitorpableitor
    Participant
    Master
    Yeah, I tried that also. It seems when you call gettimeframe from the default TF it always returns -1   , is  that a bug  ??
    #184820 quote
    JSJS
    Participant
    Master
    I guess so, it should return the default timeframe in seconds but always returns -1
    #184824 quote
    JC_BywanJC_Bywan
    Moderator
    Master
    Hi, it was a bug highlighted last november, as far as I know, it has been corrected for PRT trading with Interactive Broker, but fix not yet deployed for PRT with IG.
    JS thanked this post
    #184828 quote
    JSJS
    Participant
    Master
    Hi @JC_Bywan I can’t find this bug in “Platform Support”, can you put it in?
    pableitor thanked this post
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

help with gettimeframe and timeframe


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
pableitor @pableitor Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by JSJS
4 years, 8 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 01/06/2022
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...