Reputation: 1
wanted to see if someone can help with an issue using pinescripts highest() and lowest() in relation to multi-timeframes. I'm using mostly lower tf's for my indicators, but want to use higher tf's as my support/resistance. Here's what I've attempted to do using the security function:
highH60 = security(syminfo.tickerid, "60", high)
highest(highH60, 7)
This doesn't seem to have any affect at all, so I've been going the long route and defining each of the index manually:
highH61 = security(syminfo.tickerid, "60", high[1])
highH62 = security(syminfo.tickerid, "60", high[2])
highH63 = security(syminfo.tickerid, "60", high[3])
highH64 = security(syminfo.tickerid, "60", high[4])
highH65 = security(syminfo.tickerid, "60", high[5])
I'm sure there must be a better way to do this, any help is appreciated!
Upvotes: 0
Views: 1464
Reputation: 3833
It has to be done in the context of the security call or it is comparing the values obtained on the previous lower timeframe bar's security calls. ie if your chart is 15m, it will find the highest high of the highH60 variable looking back the last 7 15 minute bars rather than the last 7 1 hour bars.
highH60 = security(syminfo.tickerid, "60", highest(high, 7))
Upvotes: 0