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
JSParticipant
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.
Yeah, I tried that also. It seems when you call gettimeframe from the default TF it always returns -1 , is that a bug ??
JSParticipant
Senior
I guess so, it should return the default timeframe in seconds but always returns -1
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.
JSParticipant
Senior
Hi @JC_Bywan
I can’t find this bug in “Platform Support”, can you put it in?