help with gettimeframe and timeframe

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #184786 quote
    pableitor
    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
    JS
    Participant
    Senior
    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
    pableitor
    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
    JS
    Participant
    Senior
    I guess so, it should return the default timeframe in seconds but always returns -1
    #184824 quote
    JC_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
    JS
    Participant
    Senior
    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.

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 JS
4 years, 1 month ago.

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