Hello, this is my first posting here so please accept my apologies in advance if I accidentally fluff up any of the forum’s procedures. I’m not sure if this is something “everybody already knows”, or an “undocumented feature”, or just my own dumb coding failure.
I cobbled together some code to test an idea. The idea involves comparing the status of an indicator across two different timeframes, in this case the 15 minute and the 1 hour timeframes. The indicator I’m aiming for would display in the 15 minute timeframe window, so checking that the 15 minute status matches the containing 1 hour status.
Anyway, the code I wrote looks (something) like this:
TIMEFRAME(15 minutes, updateonclose)
result15 = somerandomoperation()
TIMEFRAME(1 hour, updateonclose)
result60 = somerandomoperation()
IF result15 > result60 THEN
DRAWARROWUP(barindex, Close - 8) COLOURED(0,255,10)
ENDIF
This seems to work.. except it only puts the up arrow on the first bar of the hour where the condition matches even if the conditions are met on other bars in the same hour. If I reverse the order of the timeframes to look like this:
TIMEFRAME(1 hour, updateonclose)
result60 = somerandomoperation()
TIMEFRAME(15 minutes, updateonclose)
result15 = somerandomoperation()
IF result15 > result60 THEN DRAWARROWUP(barindex, Close - 8) COLOURED(0,255,10)
ENDIF
it will draw up arrows under all the bars that match the required conditions.
The question I have is, is this a “known feature” of PRT code, that you have to reference timeframes in a certain order? Or, that you have to use the current timeframe as the last operation?
I’ve looked in the documentation and can’t find any warning about what order timeframes should be used in, or whether they need to be “reset” to the current working timeframe.Have I missed something or is there some further additional documention about the TIMEFRAME call that explains this sort of thing?
Any advice, or clarification is appreciated.